emacs-devel
[Top][All Lists]
Advanced

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

Patch: make set-fill-column show the current fill-column


From: Antoine Levitt
Subject: Patch: make set-fill-column show the current fill-column
Date: Mon, 31 Jan 2022 21:15:45 +0100
User-agent: mu4e 1.6.6; emacs 28.0.90

I recently used set-fill-column again after years of neglect, and I
remember being mystified by what it did before; I think this is because
I misunderstood the word "default" (I understood it as "the default
setting of fill-column" whereas emacs meant "the thing that will be if
you just press RET"). I think changing the prompt would go a long way
towards making it more accessible to new users, and be more informative
for long-time emacsers as well. Removing the "default" part is tricky
because it's customizable (via minibuffer-default-prompt-format) and
used in several functions, but something like "Set fill-column to
(default 60, currently 80)" looks like a good compromise. Here is a
simple patch doing this.

diff --git a/lisp/simple.el b/lisp/simple.el
index c878fda..b7986ed 100644
--- a/lisp/simple.el
+++ b/lisp/simple.el
@@ -7903,7 +7903,14 @@ set-fill-column
              ;; We used to use current-column silently, but C-x f is too easily
              ;; typed as a typo for C-x C-f, so we turned it into an error and
              ;; now an interactive prompt.
-             (read-number "Set fill-column to: " (current-column)))))
+             (let ((prompt (concat "Set fill-column to"
+                                   (format minibuffer-default-prompt-format
+                                           (concat (number-to-string 
(current-column))
+                                                   ", currently "
+                                                   (number-to-string 
fill-column)))
+                                   ": "))
+                   (minibuffer-default-prompt-format ""))
+               (read-number prompt (current-column))))))
   (if (consp arg)
       (setq arg (current-column)))
   (if (not (integerp arg))



reply via email to

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