aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEli Zaretskii2024-01-27 10:38:14 +0200
committerEli Zaretskii2024-01-27 10:38:14 +0200
commit43e2f3acdd2dbd040ec2fc473ca60ee3179bb796 (patch)
tree5ebaebfa6fc961461c79991976b746152c56bbec
parent08007a030e03762b888dcfcd64e84f03e5a2d54f (diff)
downloademacs-43e2f3acdd2dbd040ec2fc473ca60ee3179bb796.tar.gz
emacs-43e2f3acdd2dbd040ec2fc473ca60ee3179bb796.zip
; Minor improvements in 'visual-wrap-prefix-mode'
* 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'.
-rw-r--r--doc/emacs/basic.texi5
-rw-r--r--etc/NEWS18
-rw-r--r--lisp/menu-bar.el15
-rw-r--r--lisp/visual-wrap.el6
4 files changed, 24 insertions, 20 deletions
diff --git a/doc/emacs/basic.texi b/doc/emacs/basic.texi
index a6b71db4bea..cdc183c2a40 100644
--- a/doc/emacs/basic.texi
+++ b/doc/emacs/basic.texi
@@ -630,7 +630,7 @@ before they get too long, by inserting newlines. If you prefer, you
630can make Emacs insert a newline automatically when a line gets too 630can make Emacs insert a newline automatically when a line gets too
631long, by using Auto Fill mode. @xref{Filling}. 631long, by using Auto Fill mode. @xref{Filling}.
632 632
633@cindex continuation lines, wrapping with prefix 633@cindex continuation lines, visual wrap prefix
634@findex visual-wrap-prefix-mode 634@findex visual-wrap-prefix-mode
635 Normally, the first character of each continuation line is 635 Normally, the first character of each continuation line is
636positioned at the beginning of the screen line where it is displayed. 636positioned 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
639fill prefixes (@pxref{Fill Prefix}) of their respective logical lines, 639fill prefixes (@pxref{Fill Prefix}) of their respective logical lines,
640so that indentation characters or the prefixes of source code comments 640so that indentation characters or the prefixes of source code comments
641are replicated across every continuation line, and the appearance of 641are replicated across every continuation line, and the appearance of
642such comments or indentation is not broken. 642such comments or indentation is not broken. These prefixes are only
643shown on display, and does not change the buffer text in any way.
643 644
644 Sometimes, you may need to edit files containing many long logical 645 Sometimes, you may need to edit files containing many long logical
645lines, and it may not be practical to break them all up by adding 646lines, and it may not be practical to break them all up by adding
diff --git a/etc/NEWS b/etc/NEWS
index 37a017c4db1..d69d0001135 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -319,15 +319,15 @@ name detection.
319 319
320+++ 320+++
321** New minor mode 'visual-wrap-prefix-mode'. 321** New minor mode 'visual-wrap-prefix-mode'.
322 322When enabled, continuation lines displayed for a wrapped long line
323When enabled, continuation lines displayed for a folded long line will 323will receive a 'wrap-prefix' automatically computed from the line's
324receive a 'wrap-prefix' automatically computed from the line's 324surrounding context, such that continuation lines are indented on
325surrounding context by the function 'fill-context-prefix', which 325display as if they were filled with 'M-q' or similar. Unlike 'M-q',
326generally indents continuation lines as if the line were filled with 326the indentation only happens on display, and doesn't change the buffer
327'M-q', or similar. 327text in any way.
328 328
329This minor mode is the 'adaptive-wrap' ELPA package renamed and 329(This minor mode is the 'adaptive-wrap' ELPA package renamed and
330lightly edited for inclusion in Emacs. 330lightly edited for inclusion in Emacs.)
331 331
332+++ 332+++
333** New user option 'gud-highlight-current-line'. 333** New user option 'gud-highlight-current-line'.
diff --git a/lisp/menu-bar.el b/lisp/menu-bar.el
index 761f0603c75..47c6a8f0613 100644
--- a/lisp/menu-bar.el
+++ b/lisp/menu-bar.el
@@ -1438,6 +1438,14 @@ mail status in mode line"))
1438(defvar menu-bar-line-wrapping-menu 1438(defvar menu-bar-line-wrapping-menu
1439 (let ((menu (make-sparse-keymap "Line Wrapping"))) 1439 (let ((menu (make-sparse-keymap "Line Wrapping")))
1440 1440
1441 (bindings--define-key menu [visual-wrap]
1442 '(menu-item "Visual Wrap Prefix mode" visual-wrap-prefix-mode
1443 :help "Display continuation lines with visual context-dependent prefix"
1444 :visible (menu-bar-menu-frame-live-and-visible-p)
1445 :button (:toggle
1446 . (bound-and-true-p visual-wrap-prefix-mode))
1447 :enable t))
1448
1441 (bindings--define-key menu [word-wrap] 1449 (bindings--define-key menu [word-wrap]
1442 '(menu-item "Word Wrap (Visual Line mode)" 1450 '(menu-item "Word Wrap (Visual Line mode)"
1443 menu-bar--visual-line-mode-enable 1451 menu-bar--visual-line-mode-enable
@@ -1467,13 +1475,6 @@ mail status in mode line"))
1467 (not word-wrap))) 1475 (not word-wrap)))
1468 :visible (menu-bar-menu-frame-live-and-visible-p) 1476 :visible (menu-bar-menu-frame-live-and-visible-p)
1469 :enable (not (truncated-partial-width-window-p)))) 1477 :enable (not (truncated-partial-width-window-p))))
1470
1471 (bindings--define-key menu [visual-wrap]
1472 '(menu-item "Visual Wrap Prefix" visual-wrap-prefix-mode
1473 :help "Display continuation lines with contextual prefix"
1474 :visible (menu-bar-menu-frame-live-and-visible-p)
1475 :button (:toggle . (bound-and-true-p visual-wrap-prefix-mode))
1476 :enable t))
1477 menu)) 1478 menu))
1478 1479
1479(defvar menu-bar-search-options-menu 1480(defvar menu-bar-search-options-menu
diff --git a/lisp/visual-wrap.el b/lisp/visual-wrap.el
index f8e00b9c685..1cb49538eae 100644
--- a/lisp/visual-wrap.el
+++ b/lisp/visual-wrap.el
@@ -59,6 +59,7 @@ extra indent = 2
59 ullamco laboris nisi ut aliquip ex ea commodo consequat." 59 ullamco laboris nisi ut aliquip ex ea commodo consequat."
60 :type 'integer 60 :type 'integer
61 :safe 'integerp 61 :safe 'integerp
62 :version "30.1"
62 :group 'visual-line) 63 :group 'visual-line)
63 64
64(defun visual-wrap--face-extend-p (face) 65(defun visual-wrap--face-extend-p (face)
@@ -111,8 +112,9 @@ extra indent = 2
111 "")))) 112 ""))))
112 113
113(defun visual-wrap-fill-context-prefix (beg end) 114(defun visual-wrap-fill-context-prefix (beg end)
114 "Like `fill-context-prefix', but with length adjusted by 115 "Compute visual wrap prefix from text between FROM and TO.
115`visual-wrap-extra-indent'." 116This is like `fill-context-prefix', but with prefix length adjusted
117by `visual-wrap-extra-indent'."
116 (let* ((fcp 118 (let* ((fcp
117 ;; `fill-context-prefix' ignores prefixes that look like 119 ;; `fill-context-prefix' ignores prefixes that look like
118 ;; paragraph starts, in order to avoid inadvertently 120 ;; paragraph starts, in order to avoid inadvertently