GNU bug report logs - #79393
[PATCH] ; (read-string-from-buffer): Fix thinko and typo.

Previous Next

Package: emacs;

Reported by: Eshel Yaron <me <at> eshelyaron.com>

Date: Sat, 6 Sep 2025 08:23:02 UTC

Severity: normal

Tags: patch

To reply to this bug, email your comments to 79393 AT debbugs.gnu.org.

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#79393; Package emacs. (Sat, 06 Sep 2025 08:23:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Eshel Yaron <me <at> eshelyaron.com>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Sat, 06 Sep 2025 08:23:02 GMT) Full text and rfc822 format available.

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

From: Eshel Yaron <me <at> eshelyaron.com>
To: bug-gnu-emacs <at> gnu.org
Subject: [PATCH] ; (read-string-from-buffer): Fix thinko and typo.
Date: Sat, 06 Sep 2025 10:22:20 +0200
[Message part 1 (text/plain, inline)]
Tags: patch

This patch fixes an apparent thinko in read-string-from-buffer, which
causes the function to return the input string when the user aborts the
edit with C-c C-k, instead of actually aborting.  :/

Note that this bug could be caught by simple unreachable code analysis,
as requested in Bug#73526.  In particular, exit-recursive-edit and
friends only make sense in tail positions, since they never return.

[0001-read-string-from-buffer-Fix-thinko-and-typo.patch (text/patch, attachment)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#79393; Package emacs. (Sat, 13 Sep 2025 08:46:02 GMT) Full text and rfc822 format available.

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

From: Eli Zaretskii <eliz <at> gnu.org>
To: Eshel Yaron <me <at> eshelyaron.com>
Cc: 79393 <at> debbugs.gnu.org
Subject: Re: bug#79393: [PATCH] ;
 (read-string-from-buffer): Fix thinko and typo.
Date: Sat, 13 Sep 2025 11:45:05 +0300
> Date: Sat, 06 Sep 2025 10:22:20 +0200
> From:  Eshel Yaron via "Bug reports for GNU Emacs,
>  the Swiss army knife of text editors" <bug-gnu-emacs <at> gnu.org>
> 
> This patch fixes an apparent thinko in read-string-from-buffer, which
> causes the function to return the input string when the user aborts the
> edit with C-c C-k, instead of actually aborting.  :/
> 
> Note that this bug could be caught by simple unreachable code analysis,
> as requested in Bug#73526.  In particular, exit-recursive-edit and
> friends only make sense in tail positions, since they never return.
> 
> >From cca1f9099784486374aebfa4eea0fd4f4e7721c6 Mon Sep 17 00:00:00 2001
> From: Eshel Yaron <me <at> eshelyaron.com>
> Date: Sat, 6 Sep 2025 07:56:44 +0200
> Subject: [PATCH] ; (read-string-from-buffer): Fix thinko and typo.
> 
> ---
>  lisp/textmodes/string-edit.el | 6 ++----
>  1 file changed, 2 insertions(+), 4 deletions(-)
> 
> diff --git a/lisp/textmodes/string-edit.el b/lisp/textmodes/string-edit.el
> index dda70437f78..4e292227cda 100644
> --- a/lisp/textmodes/string-edit.el
> +++ b/lisp/textmodes/string-edit.el
> @@ -93,7 +93,7 @@ string-edit
>  ;;;###autoload
>  (defun read-string-from-buffer (prompt string)
>    "Switch to a new buffer to edit STRING in a recursive edit.
> -The user finishes editing with \\<string-edit-mode-map>\\[string-edit-done], or aborts with \\<string-edit-mode-map>\\[string-edit-abort]).
> +The user finishes editing with \\<string-edit-mode-map>\\[string-edit-done], or aborts with \\<string-edit-mode-map>\\[string-edit-abort].
>  
>  Insert PROMPT at the start of the buffer.  If nil, no prompt is
>  inserted.
> @@ -108,9 +108,7 @@ read-string-from-buffer
>     (lambda (edited)
>       (setq string edited)
>       (exit-recursive-edit))
> -   :abort-callback (lambda ()
> -                     (exit-recursive-edit)
> -                     (error "Aborted edit")))
> +   :abort-callback #'abort-recursive-edit)
>    (recursive-edit)
>    string)

Thanks, but that change shows just "Quit" in the echo area, whereas
the intent here was to show "Aborted edit" there.  Can we do better by
showing that text to the user?  Because "Quit" is confusing in this
case, IMO.




This bug report was last modified today.

Previous Next


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