aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSean Whitton2025-06-27 14:14:36 +0100
committerSean Whitton2025-06-27 14:14:36 +0100
commit0c0ac8d48a154779bc349da9fae2a2cf0230ff5d (patch)
treec1ceb641d532a26acd344902ea7b566ea712be27
parent772099bc9b8043d46154992e1f06d7b4aa9ceccd (diff)
downloademacs-0c0ac8d48a154779bc349da9fae2a2cf0230ff5d.tar.gz
emacs-0c0ac8d48a154779bc349da9fae2a2cf0230ff5d.zip
'C-u C-x .' clears the fill prefix
* lisp/textmodes/fill.el (set-fill-prefix): When called interactively with a prefix argument, clear the fill prefix, just like how 'C-u C-x C-n' clears the goal column. * doc/emacs/text.texi (Fill Prefix): * etc/NEWS: Document the change.
-rw-r--r--doc/emacs/text.texi5
-rw-r--r--etc/NEWS5
-rw-r--r--lisp/textmodes/fill.el23
3 files changed, 21 insertions, 12 deletions
diff --git a/doc/emacs/text.texi b/doc/emacs/text.texi
index 5635171f5cf..51c6c2c5dc7 100644
--- a/doc/emacs/text.texi
+++ b/doc/emacs/text.texi
@@ -699,8 +699,9 @@ a new paragraph.
699 To specify a fill prefix for the current buffer, move to a line that 699 To specify a fill prefix for the current buffer, move to a line that
700starts with the desired prefix, put point at the end of the prefix, 700starts with the desired prefix, put point at the end of the prefix,
701and type @w{@kbd{C-x .}}@: (@code{set-fill-prefix}). (That's a period 701and type @w{@kbd{C-x .}}@: (@code{set-fill-prefix}). (That's a period
702after the @kbd{C-x}.) To turn off the fill prefix, specify an empty 702after the @kbd{C-x}.) To turn off the fill prefix, either type
703prefix: type @w{@kbd{C-x .}}@: with point at the beginning of a line. 703@w{@kbd{C-u C-x .}}@: or specify an empty prefix: type @w{@kbd{C-x .}}@:
704with point at the beginning of a line.
704 705
705 When a fill prefix is in effect, the fill commands remove the fill 706 When a fill prefix is in effect, the fill commands remove the fill
706prefix from each line of the paragraph before filling, and insert it 707prefix from each line of the paragraph before filling, and insert it
diff --git a/etc/NEWS b/etc/NEWS
index 32f08d63c68..ea1a4ebeffa 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -619,6 +619,11 @@ sentence. The new command 'fill-region-as-paragraph-semlf' fills a
619region of text using semantic linefeeds as if the region were a single 619region of text using semantic linefeeds as if the region were a single
620paragraph. 620paragraph.
621 621
622+++
623** 'C-u C-x .' clears the fill prefix.
624You can now use 'C-u C-x .' to clear the fill prefix, similarly to how
625you could already use 'C-u C-x C-n' to clear the goal column.
626
622 627
623* Changes in Specialized Modes and Packages in Emacs 31.1 628* Changes in Specialized Modes and Packages in Emacs 31.1
624 629
diff --git a/lisp/textmodes/fill.el b/lisp/textmodes/fill.el
index 386a88bda3a..1583ba4df05 100644
--- a/lisp/textmodes/fill.el
+++ b/lisp/textmodes/fill.el
@@ -78,21 +78,24 @@ placed at the beginning or end of a line by filling.
78See the documentation of `kinsoku' for more information." 78See the documentation of `kinsoku' for more information."
79 :type 'boolean) 79 :type 'boolean)
80 80
81(defun set-fill-prefix () 81(defun set-fill-prefix (&optional arg)
82 "Set the fill prefix to the current line up to point. 82 "Set the fill prefix to the current line up to point.
83Filling expects lines to start with the fill prefix and 83Filling expects lines to start with the fill prefix and
84reinserts the fill prefix in each resulting line." 84reinserts the fill prefix in each resulting line.
85 (interactive) 85With a prefix argument, cancel the fill prefix."
86 (let ((left-margin-pos (save-excursion (move-to-left-margin) (point)))) 86 (interactive "P")
87 (if (> (point) left-margin-pos) 87 (if arg
88 (progn 88 (setq fill-prefix nil)
89 (setq fill-prefix (buffer-substring left-margin-pos (point))) 89 (let ((left-margin-pos (save-excursion (move-to-left-margin) (point))))
90 (if (equal fill-prefix "") 90 (if (> (point) left-margin-pos)
91 (progn
92 (setq fill-prefix (buffer-substring left-margin-pos (point)))
93 (when (equal fill-prefix "")
91 (setq fill-prefix nil))) 94 (setq fill-prefix nil)))
92 (setq fill-prefix nil))) 95 (setq fill-prefix nil))))
93 (if fill-prefix 96 (if fill-prefix
94 (message "fill-prefix: \"%s\"" fill-prefix) 97 (message "fill-prefix: \"%s\"" fill-prefix)
95 (message "fill-prefix canceled"))) 98 (message "fill-prefix cancelled")))
96 99
97(defcustom adaptive-fill-mode t 100(defcustom adaptive-fill-mode t
98 "Non-nil means determine a paragraph's fill prefix from its text." 101 "Non-nil means determine a paragraph's fill prefix from its text."