From: Federico Tedin <federicotedin@gmail.com>
To: Eli Zaretskii <eliz@gnu.org>
Cc: 39291@debbugs.gnu.org, pogonyshev@gmail.com,
Juri Linkov <juri@linkov.net>
Subject: bug#39291: M-: history doesn't store erroneous input
Date: Wed, 29 Jan 2020 22:32:16 +0100 [thread overview]
Message-ID: <87blqm0x0f.fsf@gmail.com> (raw)
In-Reply-To: <83sgjymbdy.fsf@gnu.org> (Eli Zaretskii's message of "Wed, 29 Jan 2020 19:16:09 +0200")
[-- Attachment #1: Type: text/plain, Size: 709 bytes --]
> Federico, please look into fixing this regression.
>
> TIA
I found that the minibuffer input string in `read_minibuf' was being
added to the history list after we tried to parse an object from it (if
`expflag' was true). So if the parsing failed, then the value wasn't
added to the history. I'm attaching a patch with my changes.
My only doubt is that now, the call to `string_to_object' (which calls
`read-from-string', which calls `read1', and then `read0') is located
outside the context (not sure what the right term is) set up with
`specbind'. Could this be a problem? Do any of these functions depend on
the context set up in `read_minibuf'? (They don't appear to, just want
to be sure).
Thanks.
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: patch --]
[-- Type: text/x-diff, Size: 1310 bytes --]
From 6a35a1390d1f1924d0fd52dbb885af66d089273c Mon Sep 17 00:00:00 2001
From: Federico Tedin <federicotedin@gmail.com>
Date: Wed, 29 Jan 2020 22:24:40 +0100
Subject: [PATCH 1/1] Ensure input is added to history in read_minibuf
* src/minibuf.c (read_minibuf): Parse input string after saving the
string to the history list instead of before, in case parsing
fails. (Bug#39291)
---
src/minibuf.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/src/minibuf.c b/src/minibuf.c
index 8ebdff1252..9d870ce364 100644
--- a/src/minibuf.c
+++ b/src/minibuf.c
@@ -697,10 +697,6 @@ read_minibuf (Lisp_Object map, Lisp_Object initial, Lisp_Object prompt,
else
histstring = Qnil;
- /* If Lisp form desired instead of string, parse it. */
- if (expflag)
- val = string_to_object (val, defalt);
-
/* The appropriate frame will get selected
in set-window-configuration. */
unbind_to (count, Qnil);
@@ -711,6 +707,10 @@ read_minibuf (Lisp_Object map, Lisp_Object initial, Lisp_Object prompt,
if (! (NILP (Vhistory_add_new_input) || NILP (histstring)))
call2 (intern ("add-to-history"), histvar, histstring);
+ /* If Lisp form desired instead of string, parse it. */
+ if (expflag)
+ val = string_to_object (val, defalt);
+
return val;
}
--
2.17.1
next prev parent reply other threads:[~2020-01-29 21:32 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-01-26 15:16 bug#39291: M-: history doesn't store erroneous input Paul Pogonyshev
2020-01-28 23:35 ` Juri Linkov
2020-01-29 17:16 ` Eli Zaretskii
2020-01-29 18:09 ` Federico Tedin
2020-01-29 21:32 ` Federico Tedin [this message]
2020-01-30 14:14 ` Eli Zaretskii
2020-01-30 14:20 ` Stefan Monnier
2020-01-30 14:23 ` Stefan Monnier
2020-01-31 0:44 ` Federico Tedin
2020-01-31 9:20 ` Eli Zaretskii
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=87blqm0x0f.fsf@gmail.com \
--to=federicotedin@gmail.com \
--cc=39291@debbugs.gnu.org \
--cc=eliz@gnu.org \
--cc=juri@linkov.net \
--cc=pogonyshev@gmail.com \
/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).