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

Full log


View this message in rfc822 format

From: Eli Zaretskii <eliz <at> gnu.org>
To: Eshel Yaron <me <at> eshelyaron.com>
Cc: 79393 <at> debbugs.gnu.org
Subject: 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.