emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

master b86bc02096c 1/4: Introduce a global variant of visual-wrap-prefix


From: Po Lu
Subject: master b86bc02096c 1/4: Introduce a global variant of visual-wrap-prefix-mode
Date: Thu, 1 Feb 2024 03:27:53 -0500 (EST)

branch: master
commit b86bc02096c65517b9a29c20635ece100864fc62
Author: Po Lu <luangruo@yahoo.com>
Commit: Po Lu <luangruo@yahoo.com>

    Introduce a global variant of visual-wrap-prefix-mode
    
    * 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.
---
 doc/emacs/basic.texi | 17 ++++++++++-------
 etc/NEWS             |  4 +++-
 lisp/visual-wrap.el  | 10 +++++++++-
 3 files changed, 22 insertions(+), 9 deletions(-)

diff --git a/doc/emacs/basic.texi b/doc/emacs/basic.texi
index cdc183c2a40..c00cd6e20cf 100644
--- a/doc/emacs/basic.texi
+++ b/doc/emacs/basic.texi
@@ -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
diff --git a/etc/NEWS b/etc/NEWS
index 8fccc299c6b..9bd4d0f631b 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -318,7 +318,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.)
diff --git a/lisp/visual-wrap.el b/lisp/visual-wrap.el
index 20e55444082..d95cf4bb569 100644
--- a/lisp/visual-wrap.el
+++ b/lisp/visual-wrap.el
@@ -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



reply via email to

[Prev in Thread] Current Thread [Next in Thread]