unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Antoine Levitt <antoine.levitt@gmail.com>
To: 53874@debbugs.gnu.org
Subject: bug#53874: Patch: make set-fill-column show the current fill-column
Date: Tue, 08 Feb 2022 13:04:33 +0100	[thread overview]
Message-ID: <871r0dbm3y.fsf@inria.fr> (raw)

[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))





             reply	other threads:[~2022-02-08 12:04 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-02-08 12:04 Antoine Levitt [this message]
2022-02-09  8:27 ` bug#53874: Patch: make set-fill-column show the current fill-column Lars Ingebrigtsen
2022-02-09  9:53   ` Antoine Levitt
2022-02-09  9:53     ` Lars Ingebrigtsen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=871r0dbm3y.fsf@inria.fr \
    --to=antoine.levitt@gmail.com \
    --cc=53874@debbugs.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).