mirror of
git://git.sv.gnu.org/emacs.git
synced 2026-02-16 09:14:18 +00:00
; Remove superfluous POSITION argument from 'visual-wrap--apply-to-line'
* lisp/visual-wrap.el (visual-wrap--apply-to-line): Remove POSITION and just use point instead. Update caller.
This commit is contained in:
parent
90c0c9a01e
commit
38c57855ae
1 changed files with 22 additions and 24 deletions
|
|
@ -143,29 +143,27 @@ members of `visual-wrap--safe-display-specs' (which see)."
|
|||
(t
|
||||
"")))))
|
||||
|
||||
(defun visual-wrap--apply-to-line (position)
|
||||
"Apply visual-wrapping properties to the logical line starting at POSITION."
|
||||
(save-excursion
|
||||
(goto-char position)
|
||||
(when-let* ((first-line-prefix (fill-match-adaptive-prefix))
|
||||
(next-line-prefix (visual-wrap--content-prefix
|
||||
first-line-prefix position)))
|
||||
(when (numberp next-line-prefix)
|
||||
;; Set a minimum width for the prefix so it lines up correctly
|
||||
;; with subsequent lines. Make sure not to do this past the end
|
||||
;; of the line though! (`fill-match-adaptive-prefix' could
|
||||
;; potentially return a prefix longer than the current line in
|
||||
;; the buffer.)
|
||||
(add-display-text-property
|
||||
position (min (+ position (length first-line-prefix))
|
||||
(pos-eol))
|
||||
'min-width `((,next-line-prefix . width))))
|
||||
(setq next-line-prefix (visual-wrap--adjust-prefix next-line-prefix))
|
||||
(put-text-property
|
||||
position (pos-eol) 'wrap-prefix
|
||||
(if (numberp next-line-prefix)
|
||||
`(space :align-to (,next-line-prefix . width))
|
||||
next-line-prefix)))))
|
||||
(defun visual-wrap--apply-to-line ()
|
||||
"Apply visual-wrapping properties to the logical line starting at point."
|
||||
(when-let* ((first-line-prefix (fill-match-adaptive-prefix))
|
||||
(next-line-prefix (visual-wrap--content-prefix
|
||||
first-line-prefix (point))))
|
||||
(when (numberp next-line-prefix)
|
||||
;; Set a minimum width for the prefix so it lines up correctly
|
||||
;; with subsequent lines. Make sure not to do this past the end
|
||||
;; of the line though! (`fill-match-adaptive-prefix' could
|
||||
;; potentially return a prefix longer than the current line in the
|
||||
;; buffer.)
|
||||
(add-display-text-property
|
||||
(point) (min (+ (point) (length first-line-prefix))
|
||||
(pos-eol))
|
||||
'min-width `((,next-line-prefix . width))))
|
||||
(setq next-line-prefix (visual-wrap--adjust-prefix next-line-prefix))
|
||||
(put-text-property
|
||||
(point) (pos-eol) 'wrap-prefix
|
||||
(if (numberp next-line-prefix)
|
||||
`(space :align-to (,next-line-prefix . width))
|
||||
next-line-prefix))))
|
||||
|
||||
(defun visual-wrap--content-prefix (prefix position)
|
||||
"Get the next-line prefix for the specified first-line PREFIX.
|
||||
|
|
@ -254,7 +252,7 @@ by `visual-wrap-extra-indent'."
|
|||
;; If so, we can apply our visual wrapping properties to this
|
||||
;; line and continue to the next line.
|
||||
(progn
|
||||
(visual-wrap--apply-to-line (point))
|
||||
(visual-wrap--apply-to-line)
|
||||
(forward-line))
|
||||
;; Otherwise, skip ahead until the end of any unsafe display
|
||||
;; properties. NOTE: We do this out of an abundance of caution to
|
||||
|
|
|
|||
Loading…
Reference in a new issue