diff options
| author | Sean Whitton | 2025-06-27 14:14:36 +0100 |
|---|---|---|
| committer | Sean Whitton | 2025-06-27 14:14:36 +0100 |
| commit | 0c0ac8d48a154779bc349da9fae2a2cf0230ff5d (patch) | |
| tree | c1ceb641d532a26acd344902ea7b566ea712be27 /lisp/textmodes | |
| parent | 772099bc9b8043d46154992e1f06d7b4aa9ceccd (diff) | |
| download | emacs-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.
Diffstat (limited to 'lisp/textmodes')
| -rw-r--r-- | lisp/textmodes/fill.el | 23 |
1 files changed, 13 insertions, 10 deletions
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. | |||
| 78 | See the documentation of `kinsoku' for more information." | 78 | See 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. |
| 83 | Filling expects lines to start with the fill prefix and | 83 | Filling expects lines to start with the fill prefix and |
| 84 | reinserts the fill prefix in each resulting line." | 84 | reinserts the fill prefix in each resulting line. |
| 85 | (interactive) | 85 | With 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." |