]> git.eshelyaron.com Git - emacs.git/commitdiff
; Minor improvements in 'visual-wrap-prefix-mode'
authorEli Zaretskii <eliz@gnu.org>
Sat, 27 Jan 2024 08:38:14 +0000 (10:38 +0200)
committerEshel Yaron <me@eshelyaron.com>
Wed, 31 Jan 2024 20:07:33 +0000 (21:07 +0100)
* lisp/visual-wrap.el (visual-wrap-extra-indent): Add :version.
(visual-wrap-fill-context-prefix): Doc fix.
* lisp/menu-bar.el (menu-bar-line-wrapping-menu): Move the menu to
a better place, improve the help-echo text.

* etc/NEWS:
* doc/emacs/basic.texi (Continuation Lines): Improve documentation
and indexing of 'visual-wrap-prefix-mode'.

(cherry picked from commit 43e2f3acdd2dbd040ec2fc473ca60ee3179bb796)

doc/emacs/basic.texi
etc/NEWS
lisp/menu-bar.el
lisp/visual-wrap.el

index a6b71db4bea6ab3bca032af62cd8061a3eb59c2b..cdc183c2a40785cecda333e1cae5e95caa9197bb 100644 (file)
@@ -630,7 +630,7 @@ before they get too long, by inserting newlines.  If you prefer, you
 can make Emacs insert a newline automatically when a line gets too
 long, by using Auto Fill mode.  @xref{Filling}.
 
-@cindex continuation lines, wrapping with prefix
+@cindex continuation lines, visual wrap prefix
 @findex visual-wrap-prefix-mode
   Normally, the first character of each continuation line is
 positioned at the beginning of the screen line where it is displayed.
@@ -639,7 +639,8 @@ continuation lines be prefixed by slightly adjusted versions of the
 fill prefixes (@pxref{Fill Prefix}) of their respective logical lines,
 so that indentation characters or the prefixes of source code comments
 are replicated across every continuation line, and the appearance of
-such comments or indentation is not broken.
+such comments or indentation is not broken.  These prefixes are only
+shown on display, and does not change the buffer text in any way.
 
   Sometimes, you may need to edit files containing many long logical
 lines, and it may not be practical to break them all up by adding
index 4f40eb050067d523e1006aff2f74b2517b984c1e..ff15e00a9787994ef580c8d4018e137aca07c3e5 100644 (file)
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -311,15 +311,15 @@ name detection.
 
 +++
 ** New minor mode 'visual-wrap-prefix-mode'.
-
-When enabled, continuation lines displayed for a folded long line will
-receive a 'wrap-prefix' automatically computed from the line's
-surrounding context by the function 'fill-context-prefix', which
-generally indents continuation lines as if the line were filled with
-'M-q', or similar.
-
-This minor mode is the 'adaptive-wrap' ELPA package renamed and
-lightly edited for inclusion in Emacs.
+When enabled, continuation lines displayed for a wrapped long line
+will receive a 'wrap-prefix' automatically computed from the line's
+surrounding context, such that continuation lines are indented on
+display as if they were filled with 'M-q' or similar.  Unlike 'M-q',
+the indentation only happens on display, and doesn't change the buffer
+text in any way.
+
+(This minor mode is the 'adaptive-wrap' ELPA package renamed and
+lightly edited for inclusion in Emacs.)
 
 +++
 ** New user option 'gud-highlight-current-line'.
index 722b2d6810a22f18e528a2d750ddf62ea22ea9bf..05de0578bec19f541a553dbed86aa5784557a9fc 100644 (file)
@@ -1438,6 +1438,14 @@ mail status in mode line"))
 (defvar menu-bar-line-wrapping-menu
   (let ((menu (make-sparse-keymap "Line Wrapping")))
 
+    (bindings--define-key menu [visual-wrap]
+      '(menu-item "Visual Wrap Prefix mode" visual-wrap-prefix-mode
+                  :help "Display continuation lines with visual context-dependent prefix"
+                  :visible (menu-bar-menu-frame-live-and-visible-p)
+                  :button (:toggle
+                           . (bound-and-true-p visual-wrap-prefix-mode))
+                  :enable t))
+
     (bindings--define-key menu [word-wrap]
       '(menu-item "Word Wrap (Visual Line mode)"
                   menu-bar--visual-line-mode-enable
@@ -1467,13 +1475,6 @@ mail status in mode line"))
                                   (not word-wrap)))
                   :visible (menu-bar-menu-frame-live-and-visible-p)
                   :enable (not (truncated-partial-width-window-p))))
-
-    (bindings--define-key menu [visual-wrap]
-      '(menu-item "Visual Wrap Prefix" visual-wrap-prefix-mode
-                  :help "Display continuation lines with contextual prefix"
-                  :visible (menu-bar-menu-frame-live-and-visible-p)
-                  :button (:toggle . (bound-and-true-p visual-wrap-prefix-mode))
-                  :enable t))
     menu))
 
 (defvar menu-bar-search-options-menu
index f8e00b9c68547a866bdb869a0dbdb5310d1b7795..1cb49538eaea99ce364e66552c05acfdda6e6395 100644 (file)
@@ -59,6 +59,7 @@ extra indent = 2
     ullamco laboris nisi ut aliquip ex ea commodo consequat."
   :type 'integer
   :safe 'integerp
+  :version "30.1"
   :group 'visual-line)
 
 (defun visual-wrap--face-extend-p (face)
@@ -111,8 +112,9 @@ extra indent = 2
       ""))))
 
 (defun visual-wrap-fill-context-prefix (beg end)
-  "Like `fill-context-prefix', but with length adjusted by
-`visual-wrap-extra-indent'."
+  "Compute visual wrap prefix from text between FROM and TO.
+This is like `fill-context-prefix', but with prefix length adjusted
+by `visual-wrap-extra-indent'."
   (let* ((fcp
           ;; `fill-context-prefix' ignores prefixes that look like
           ;; paragraph starts, in order to avoid inadvertently