1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2025-12-15 10:30:25 -08:00

'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.
This commit is contained in:
Sean Whitton 2025-06-27 14:14:36 +01:00
parent 772099bc9b
commit 0c0ac8d48a
3 changed files with 21 additions and 12 deletions

View file

@ -78,21 +78,24 @@ placed at the beginning or end of a line by filling.
See the documentation of `kinsoku' for more information."
:type 'boolean)
(defun set-fill-prefix ()
(defun set-fill-prefix (&optional arg)
"Set the fill prefix to the current line up to point.
Filling expects lines to start with the fill prefix and
reinserts the fill prefix in each resulting line."
(interactive)
(let ((left-margin-pos (save-excursion (move-to-left-margin) (point))))
(if (> (point) left-margin-pos)
(progn
(setq fill-prefix (buffer-substring left-margin-pos (point)))
(if (equal fill-prefix "")
reinserts the fill prefix in each resulting line.
With a prefix argument, cancel the fill prefix."
(interactive "P")
(if arg
(setq fill-prefix nil)
(let ((left-margin-pos (save-excursion (move-to-left-margin) (point))))
(if (> (point) left-margin-pos)
(progn
(setq fill-prefix (buffer-substring left-margin-pos (point)))
(when (equal fill-prefix "")
(setq fill-prefix nil)))
(setq fill-prefix nil)))
(setq fill-prefix nil))))
(if fill-prefix
(message "fill-prefix: \"%s\"" fill-prefix)
(message "fill-prefix canceled")))
(message "fill-prefix cancelled")))
(defcustom adaptive-fill-mode t
"Non-nil means determine a paragraph's fill prefix from its text."