GNU bug report logs - #53874
Patch: make set-fill-column show the current fill-column

Previous Next

Package: emacs;

Reported by: Antoine Levitt <antoine.levitt <at> gmail.com>

Date: Tue, 8 Feb 2022 12:06:02 UTC

Severity: wishlist

Tags: patch

Fixed in version 29.1

Done: Lars Ingebrigtsen <larsi <at> gnus.org>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 53874 in the body.
You can then email your comments to 53874 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#53874; Package emacs. (Tue, 08 Feb 2022 12:06:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Antoine Levitt <antoine.levitt <at> gmail.com>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Tue, 08 Feb 2022 12:06:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Antoine Levitt <antoine.levitt <at> gmail.com>
To: bug-gnu-emacs <at> gnu.org
Subject: Patch: make set-fill-column show the current fill-column
Date: Tue, 08 Feb 2022 13:04:33 +0100
[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))




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#53874; Package emacs. (Wed, 09 Feb 2022 08:29:01 GMT) Full text and rfc822 format available.

Message #8 received at 53874 <at> debbugs.gnu.org (full text, mbox):

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Antoine Levitt <antoine.levitt <at> gmail.com>
Cc: 53874 <at> debbugs.gnu.org
Subject: Re: bug#53874: Patch: make set-fill-column show the current
 fill-column
Date: Wed, 09 Feb 2022 09:27:55 +0100
Antoine Levitt <antoine.levitt <at> 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




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#53874; Package emacs. (Wed, 09 Feb 2022 09:53:02 GMT) Full text and rfc822 format available.

Message #11 received at 53874 <at> debbugs.gnu.org (full text, mbox):

From: Antoine Levitt <antoine.levitt <at> gmail.com>
To: Lars Ingebrigtsen <larsi <at> gnus.org>
Cc: 53874 <at> debbugs.gnu.org
Subject: Re: bug#53874: Patch: make set-fill-column show the current
 fill-column
Date: Wed, 09 Feb 2022 10:53:03 +0100
> 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))




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#53874; Package emacs. (Wed, 09 Feb 2022 09:54:02 GMT) Full text and rfc822 format available.

Message #14 received at 53874 <at> debbugs.gnu.org (full text, mbox):

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Antoine Levitt <antoine.levitt <at> gmail.com>
Cc: 53874 <at> debbugs.gnu.org
Subject: Re: bug#53874: Patch: make set-fill-column show the current
 fill-column
Date: Wed, 09 Feb 2022 10:53:29 +0100
Antoine Levitt <antoine.levitt <at> 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




bug marked as fixed in version 29.1, send any further explanations to 53874 <at> debbugs.gnu.org and Antoine Levitt <antoine.levitt <at> gmail.com> Request was from Lars Ingebrigtsen <larsi <at> gnus.org> to control <at> debbugs.gnu.org. (Wed, 09 Feb 2022 09:54:02 GMT) Full text and rfc822 format available.

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Wed, 09 Mar 2022 12:24:10 GMT) Full text and rfc822 format available.

This bug report was last modified 3 years and 104 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.