]> git.eshelyaron.com Git - emacs.git/commitdiff
Introduce a global variant of visual-wrap-prefix-mode
authorPo Lu <luangruo@yahoo.com>
Thu, 1 Feb 2024 08:08:47 +0000 (16:08 +0800)
committerEshel Yaron <me@eshelyaron.com>
Fri, 2 Feb 2024 18:05:15 +0000 (19:05 +0100)
* doc/emacs/basic.texi (Continuation Lines):

* etc/NEWS:

* lisp/visual-wrap.el (visual-wrap-prefix-mode): Document this
new global minor mode.
(global-visual-wrap-prefix-mode): New global minor mode.

(cherry picked from commit b86bc02096c65517b9a29c20635ece100864fc62)

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

index cdc183c2a40785cecda333e1cae5e95caa9197bb..c00cd6e20cf54270dafec23c48a5196808d1ea12 100644 (file)
@@ -632,15 +632,18 @@ long, by using Auto Fill mode.  @xref{Filling}.
 
 @cindex continuation lines, visual wrap prefix
 @findex visual-wrap-prefix-mode
+@findex global-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.
-The minor mode @code{visual-wrap-prefix-mode} arranges that
-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.  These prefixes are only
-shown on display, and does not change the buffer text in any way.
+The minor mode @code{visual-wrap-prefix-mode} and its global
+counterpart @code{global-visual-wrap-prefix-mode} (@pxref{Minor
+Modes}) arranges that 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.  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 b2cd80b15057d74611fbccc147f1d49c256abb4c..57d6ea24270b5090dbc1152aa69955aa69cb29d9 100644 (file)
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -316,7 +316,9 @@ 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.
+text in any way.  The global minor mode
+'global-visual-wrap-prefix-mode' enables this minor mode in all
+buffers.
 
 (This minor mode is the 'adaptive-wrap' ELPA package renamed and
 lightly edited for inclusion in Emacs.)
index 20e554440821b2bc890676b78cf38a54d095e6d2..d95cf4bb56915c3baeac128399f2c1d4aa9342fe 100644 (file)
@@ -173,7 +173,9 @@ by `visual-wrap-extra-indent'."
 
 ;;;###autoload
 (define-minor-mode visual-wrap-prefix-mode
-  "Display continuation lines with prefixes from surrounding context."
+  "Display continuation lines with prefixes from surrounding context.
+To enable this minor mode across all buffers, enable
+`global-visual-wrap-prefix-mode'."
   :lighter ""
   :group 'visual-line
   (if visual-wrap-prefix-mode
@@ -192,5 +194,11 @@ by `visual-wrap-extra-indent'."
         (widen)
         (remove-text-properties (point-min) (point-max) '(wrap-prefix nil))))))
 
+;;;###autoload
+(define-globalized-minor-mode global-visual-wrap-prefix-mode
+  visual-wrap-prefix-mode visual-wrap-prefix-mode
+  :init-value nil
+  :group 'visual-line)
+
 (provide 'visual-wrap)
 ;;; visual-wrap.el ends here