From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs Subject: bug#27470: 26.0.50; this-command-keys and interactive input Date: Sat, 24 Jun 2017 10:01:17 +0300 Message-ID: <831sq9vphe.fsf@gnu.org> References: <87y3siapuw.fsf@drachen> Reply-To: Eli Zaretskii NNTP-Posting-Host: blaine.gmane.org X-Trace: blaine.gmane.org 1498287733 22211 195.159.176.226 (24 Jun 2017 07:02:13 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Sat, 24 Jun 2017 07:02:13 +0000 (UTC) Cc: 27470@debbugs.gnu.org To: Michael Heerdegen Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sat Jun 24 09:02:09 2017 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dOf56-0005VC-4Y for geb-bug-gnu-emacs@m.gmane.org; Sat, 24 Jun 2017 09:02:08 +0200 Original-Received: from localhost ([::1]:38391 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dOf5B-0005YO-AG for geb-bug-gnu-emacs@m.gmane.org; Sat, 24 Jun 2017 03:02:13 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:57143) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dOf55-0005YI-6o for bug-gnu-emacs@gnu.org; Sat, 24 Jun 2017 03:02:08 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dOf50-0003Hl-Ag for bug-gnu-emacs@gnu.org; Sat, 24 Jun 2017 03:02:07 -0400 Original-Received: from debbugs.gnu.org ([208.118.235.43]:60662) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1dOf50-0003Hh-7h for bug-gnu-emacs@gnu.org; Sat, 24 Jun 2017 03:02:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1dOf4z-0002ba-WB for bug-gnu-emacs@gnu.org; Sat, 24 Jun 2017 03:02:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 24 Jun 2017 07:02:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 27470 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 27470-submit@debbugs.gnu.org id=B27470.14982877089993 (code B ref 27470); Sat, 24 Jun 2017 07:02:01 +0000 Original-Received: (at 27470) by debbugs.gnu.org; 24 Jun 2017 07:01:48 +0000 Original-Received: from localhost ([127.0.0.1]:35106 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dOf4m-0002b7-Cb for submit@debbugs.gnu.org; Sat, 24 Jun 2017 03:01:48 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:37900) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dOf4k-0002av-6H for 27470@debbugs.gnu.org; Sat, 24 Jun 2017 03:01:46 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dOf4a-0003Au-0q for 27470@debbugs.gnu.org; Sat, 24 Jun 2017 03:01:41 -0400 Original-Received: from fencepost.gnu.org ([2001:4830:134:3::e]:59736) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dOf4Z-0003Aq-Tq; Sat, 24 Jun 2017 03:01:35 -0400 Original-Received: from 84.94.185.246.cable.012.net.il ([84.94.185.246]:1508 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1dOf4Y-0002Z0-OS; Sat, 24 Jun 2017 03:01:35 -0400 In-reply-to: <87y3siapuw.fsf@drachen> (message from Michael Heerdegen on Sat, 24 Jun 2017 07:58:47 +0200) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] 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: 208.118.235.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.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.org gmane.emacs.bugs:133842 Archived-At: > From: Michael Heerdegen > Date: Sat, 24 Jun 2017 07:58:47 +0200 > > (defun test (arg) > (interactive (list (read-from-minibuffer "Input: "))) > (message "%S" (cons this-command (this-command-keys))) > arg) > > (global-set-key [f12] #'test) > > where f12 stands for some random key sequence. > > Hit f12 and give any input. I get the following message: > > (test . "^M") > > I would expect (test . f12). This happens because read-from-minibuffer enters recursive-edit, and we don't preserve this-command-keys across recursive-edit invocations. This has been Emacs behavior since forever. The patch below seems to fix this, but I have no idea what it could break, given how old this behavior is. So if we are to accept this, I'd like to have a few people step forward and run with the change for a month or so, to see there are no adverse effects. We've been burnt several times lately by changes in keyboard-input stuff that broke subtle but very useful features. Thanks. diff --git a/src/minibuf.c b/src/minibuf.c index 1bbe276..5617941 100644 --- a/src/minibuf.c +++ b/src/minibuf.c @@ -497,6 +497,8 @@ read_minibuf (Lisp_Object map, Lisp_Object initial, Lisp_Object prompt, Fcons (Vminibuffer_history_position, Fcons (Vminibuffer_history_variable, minibuf_save_list)))))); + minibuf_save_list + = Fcons (Fthis_command_keys_vector (), minibuf_save_list); record_unwind_protect_void (read_minibuf_unwind); minibuf_level++; @@ -836,6 +838,11 @@ read_minibuf_unwind (void) Fset_buffer (XWINDOW (window)->contents); /* Restore prompt, etc, from outer minibuffer level. */ + Lisp_Object key_vec = Fcar (minibuf_save_list); + eassert (VECTORP (key_vec)); + this_command_key_count = XFASTINT (Flength (key_vec)); + this_command_keys = key_vec; + minibuf_save_list = Fcdr (minibuf_save_list); minibuf_prompt = Fcar (minibuf_save_list); minibuf_save_list = Fcdr (minibuf_save_list); minibuf_prompt_width = XFASTINT (Fcar (minibuf_save_list));