From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.ciao.gmane.io!not-for-mail From: Federico Tedin Newsgroups: gmane.emacs.bugs Subject: bug#39291: M-: history doesn't store erroneous input Date: Wed, 29 Jan 2020 22:32:16 +0100 Message-ID: <87blqm0x0f.fsf@gmail.com> References: <87mua7b1dm.fsf@mail.linkov.net> <83sgjymbdy.fsf@gnu.org> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Injection-Info: ciao.gmane.io; posting-host="ciao.gmane.io:159.69.161.202"; logging-data="25545"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.3 (gnu/linux) Cc: 39291@debbugs.gnu.org, pogonyshev@gmail.com, Juri Linkov To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Wed Jan 29 22:42:17 2020 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1iwv6H-0006Yf-Jr for geb-bug-gnu-emacs@m.gmane-mx.org; Wed, 29 Jan 2020 22:42:17 +0100 Original-Received: from localhost ([::1]:51858 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iwv6G-0000dG-JM for geb-bug-gnu-emacs@m.gmane-mx.org; Wed, 29 Jan 2020 16:42:16 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:34291) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iwuxL-0003F0-SA for bug-gnu-emacs@gnu.org; Wed, 29 Jan 2020 16:33:04 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iwuxK-0003Ni-NF for bug-gnu-emacs@gnu.org; Wed, 29 Jan 2020 16:33:03 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]:56920) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1iwuxK-0003Nb-J0 for bug-gnu-emacs@gnu.org; Wed, 29 Jan 2020 16:33:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1iwuxK-0000c5-FU for bug-gnu-emacs@gnu.org; Wed, 29 Jan 2020 16:33:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Federico Tedin Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 29 Jan 2020 21:33:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 39291 X-GNU-PR-Package: emacs Original-Received: via spool by 39291-submit@debbugs.gnu.org id=B39291.15803335462309 (code B ref 39291); Wed, 29 Jan 2020 21:33:02 +0000 Original-Received: (at 39291) by debbugs.gnu.org; 29 Jan 2020 21:32:26 +0000 Original-Received: from localhost ([127.0.0.1]:34660 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1iwuwk-0000bA-IH for submit@debbugs.gnu.org; Wed, 29 Jan 2020 16:32:26 -0500 Original-Received: from mail-wm1-f46.google.com ([209.85.128.46]:51630) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1iwuwj-0000ay-1b for 39291@debbugs.gnu.org; Wed, 29 Jan 2020 16:32:25 -0500 Original-Received: by mail-wm1-f46.google.com with SMTP id t23so1398901wmi.1 for <39291@debbugs.gnu.org>; Wed, 29 Jan 2020 13:32:24 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version; bh=1e2y7MacX1ZekV6SIDv2iJmOO0MDlOHgY6XJCoIQIX0=; b=hgmHWX1aYfNuKySRkEFA9C8dLtos17WoIhbj4k2E6LVwDqdVt4GJ2IPnwMwjh+F1Rn ZVqzbv9h/TWe9ZODnIWqkrwKRDuUlWdSHHWXyPPp056SnN6tCoOpSBLVhrANmCaC+jT9 yg0Z6gzBK3SJJpFDfJeP6x+hg7OX6tCRVg8jM9SYqkffzF0sxt8ADQY79YXFZ5iHNqAq kAHpgDnXVL9Oe/Cg7VHB8r5eD9Fxaq55wPB+XBRMRNn4fSWg32y4Zj0IS6ZLlsPQcc2R 77XjYmjdKEGw2/kXhR7r2V3Je0je5lriDaPeieno8BF/ORrwcIo2J7HgGtW1d9u64qio NGxw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:references:date:in-reply-to :message-id:user-agent:mime-version; bh=1e2y7MacX1ZekV6SIDv2iJmOO0MDlOHgY6XJCoIQIX0=; b=pTIwgXmr8I/YwfYHoddQ/pm3pDYL/wUTmwiZngFlPFifTKwvuJKYh0o4PrQkDpSk7e i81UlEbLrqGdApvN9fma5uvMdeaf7O26ppk7Hedu8WB8Gnm4dDlvHBvvjWh4iiRi6wVR pY/s2XcYZSQIhRw7AV+BibdX2K6TppKchE0c//AmAZdUQ+BnqtkAWZwf1o8k/LdfvRYW lNIS/fIExSP5UXUj0rwkcdU0q/ynxJZd37H25JV3bRSgqbPIVxI276TDqwSEkP+posxb GsRxBoU1Q/nESv1jIY4ZLvIudJGt4eQrwKQBooD2tp6Xv282HLdZpYvK9o74gf5KdgYY cvhw== X-Gm-Message-State: APjAAAVLV59x9eNZDbPAZmrzsDyzmLSY0+OjVQX2yZxdkClcD1lRuBvd ndd9ExwzrL+aRJqnvTVnw5M= X-Google-Smtp-Source: APXvYqyag/qE017UJ4s6tEYzy3I8kV+oPEhM+M+ysPDSOcoZjkxBhllIHTNMIQmL9wt2+pDgGbCc5w== X-Received: by 2002:a1c:a947:: with SMTP id s68mr1226483wme.61.1580333539005; Wed, 29 Jan 2020 13:32:19 -0800 (PST) Original-Received: from lead ([2a02:8109:8ac0:2ff0:2567:e80e:1e48:c1ac]) by smtp.gmail.com with ESMTPSA id b16sm4617302wrj.23.2020.01.29.13.32.17 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 29 Jan 2020 13:32:18 -0800 (PST) In-Reply-To: <83sgjymbdy.fsf@gnu.org> (Eli Zaretskii's message of "Wed, 29 Jan 2020 19:16:09 +0200") X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.51.188.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:175412 Archived-At: --=-=-= Content-Type: text/plain > 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. --=-=-= Content-Type: text/x-diff Content-Disposition: attachment; filename=minibuf.patch Content-Description: patch >From 6a35a1390d1f1924d0fd52dbb885af66d089273c Mon Sep 17 00:00:00 2001 From: Federico Tedin 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 --=-=-=--