* bug#53874: Patch: make set-fill-column show the current fill-column
@ 2022-02-08 12:04 Antoine Levitt
2022-02-09 8:27 ` Lars Ingebrigtsen
0 siblings, 1 reply; 4+ messages in thread
From: Antoine Levitt @ 2022-02-08 12:04 UTC (permalink / raw)
To: 53874
[I posted this on emacs-devel but apparently patches should go to
bug-gnu-emacs so here goes]
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))
^ permalink raw reply related [flat|nested] 4+ messages in thread
* bug#53874: Patch: make set-fill-column show the current fill-column
2022-02-08 12:04 bug#53874: Patch: make set-fill-column show the current fill-column Antoine Levitt
@ 2022-02-09 8:27 ` Lars Ingebrigtsen
2022-02-09 9:53 ` Antoine Levitt
0 siblings, 1 reply; 4+ messages in thread
From: Lars Ingebrigtsen @ 2022-02-09 8:27 UTC (permalink / raw)
To: Antoine Levitt; +Cc: 53874
Antoine Levitt <antoine.levitt@gmail.com> writes:
> + (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 ""))
Instead of doing it this way, I think it might make more sense to just
change the prompt to "Change fill-column from %s to:" instead? People
may have set minibuffer-default-prompt-format to something weird.
--
(domestic pets only, the antidote for overdose, milk.)
bloggy blog: http://lars.ingebrigtsen.no
^ permalink raw reply [flat|nested] 4+ messages in thread
* bug#53874: Patch: make set-fill-column show the current fill-column
2022-02-09 8:27 ` Lars Ingebrigtsen
@ 2022-02-09 9:53 ` Antoine Levitt
2022-02-09 9:53 ` Lars Ingebrigtsen
0 siblings, 1 reply; 4+ messages in thread
From: Antoine Levitt @ 2022-02-09 9:53 UTC (permalink / raw)
To: Lars Ingebrigtsen; +Cc: 53874
> Instead of doing it this way, I think it might make more sense to just
> change the prompt to "Change fill-column from %s to:" instead? People
> may have set minibuffer-default-prompt-format to something weird.
Good idea and much simpler than what I did ! Here's the patch.
diff --git a/lisp/simple.el b/lisp/simple.el
index dd48039..247f68d 100644
--- a/lisp/simple.el
+++ b/lisp/simple.el
@@ -8258,7 +8258,7 @@ 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)))))
+ (read-number (format "Change fill-column from %s to: " fill-column) (current-column)))))
(if (consp arg)
(setq arg (current-column)))
(if (not (integerp arg))
^ permalink raw reply related [flat|nested] 4+ messages in thread
* bug#53874: Patch: make set-fill-column show the current fill-column
2022-02-09 9:53 ` Antoine Levitt
@ 2022-02-09 9:53 ` Lars Ingebrigtsen
0 siblings, 0 replies; 4+ messages in thread
From: Lars Ingebrigtsen @ 2022-02-09 9:53 UTC (permalink / raw)
To: Antoine Levitt; +Cc: 53874
Antoine Levitt <antoine.levitt@gmail.com> writes:
> Good idea and much simpler than what I did ! Here's the patch.
Thanks; pushed to Emacs 29.
--
(domestic pets only, the antidote for overdose, milk.)
bloggy blog: http://lars.ingebrigtsen.no
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2022-02-09 9:53 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-02-08 12:04 bug#53874: Patch: make set-fill-column show the current fill-column Antoine Levitt
2022-02-09 8:27 ` Lars Ingebrigtsen
2022-02-09 9:53 ` Antoine Levitt
2022-02-09 9:53 ` Lars Ingebrigtsen
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.