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#25612: 26.0.50; Slightly suboptimal message for disabled commands Date: Fri, 03 Feb 2017 23:16:27 +0200 Message-ID: <83vasrt1p0.fsf@gnu.org> References: <831svfv2d5.fsf@gnu.org> <83wpd7tin9.fsf@gnu.org> Reply-To: Eli Zaretskii NNTP-Posting-Host: blaine.gmane.org X-Trace: blaine.gmane.org 1486156638 12218 195.159.176.226 (3 Feb 2017 21:17:18 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Fri, 3 Feb 2017 21:17:18 +0000 (UTC) Cc: 25612@debbugs.gnu.org To: Philipp Stephani Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Fri Feb 03 22:17:11 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 1cZlEE-0002uH-5W for geb-bug-gnu-emacs@m.gmane.org; Fri, 03 Feb 2017 22:17:10 +0100 Original-Received: from localhost ([::1]:36876 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cZlEJ-0000NA-Dx for geb-bug-gnu-emacs@m.gmane.org; Fri, 03 Feb 2017 16:17:15 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:58423) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cZlEB-0000Mu-Lb for bug-gnu-emacs@gnu.org; Fri, 03 Feb 2017 16:17:08 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cZlE6-0006E3-MQ for bug-gnu-emacs@gnu.org; Fri, 03 Feb 2017 16:17:07 -0500 Original-Received: from debbugs.gnu.org ([208.118.235.43]:57199) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1cZlE6-0006Dy-JM for bug-gnu-emacs@gnu.org; Fri, 03 Feb 2017 16:17:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1cZlE6-0002mV-DM for bug-gnu-emacs@gnu.org; Fri, 03 Feb 2017 16:17:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 03 Feb 2017 21:17:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 25612 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 25612-submit@debbugs.gnu.org id=B25612.148615661110672 (code B ref 25612); Fri, 03 Feb 2017 21:17:02 +0000 Original-Received: (at 25612) by debbugs.gnu.org; 3 Feb 2017 21:16:51 +0000 Original-Received: from localhost ([127.0.0.1]:55398 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cZlDv-0002m3-6b for submit@debbugs.gnu.org; Fri, 03 Feb 2017 16:16:51 -0500 Original-Received: from eggs.gnu.org ([208.118.235.92]:39175) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cZlDu-0002ls-4O for 25612@debbugs.gnu.org; Fri, 03 Feb 2017 16:16:50 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cZlDj-00065J-Gb for 25612@debbugs.gnu.org; Fri, 03 Feb 2017 16:16:44 -0500 Original-Received: from fencepost.gnu.org ([2001:4830:134:3::e]:37390) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cZlDj-00065B-Cj; Fri, 03 Feb 2017 16:16:39 -0500 Original-Received: from 84.94.185.246.cable.012.net.il ([84.94.185.246]:4246 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1cZlDi-0004EC-E8; Fri, 03 Feb 2017 16:16:39 -0500 In-reply-to: (message from Philipp Stephani on Fri, 03 Feb 2017 15:54:06 +0000) 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:128928 Archived-At: > From: Philipp Stephani > Date: Fri, 03 Feb 2017 15:54:06 +0000 > Cc: 25612@debbugs.gnu.org > > Yes, this-command-keys returns just "^M" instead of the expected > "\370erase-buffer^M" it returned in Emacs 24.2 and older. > > git bisect says > > b593d6a999b21dfee6939b24866a5ec6fbe7d11b is the first bad commit > commit b593d6a999b21dfee6939b24866a5ec6fbe7d11b > Author: Aaron S. Hawley > Date: Tue May 1 12:10:02 2012 -0400 > > Reimplement execute-extended-command in Elisp. > * src/keyboard.c (Fexecute_extended_command, Vsuggest_key_bindings): > Move to simple.el. > * lisp/simple.el (suggest-key-bindings, execute-extended-command): > Move from keyboard.c. Yes, when execute-extended-command was reimplemented in Lisp, the special code which produced "\370erase-buffer^M" was lost. Does the change below produce good results? If so, can anyone suggest a more elegant way of squirreling M-x into this-command-keys? diff --git a/lisp/simple.el b/lisp/simple.el index 441713a..c0dad2d 100644 --- a/lisp/simple.el +++ b/lisp/simple.el @@ -1733,6 +1733,9 @@ execute-extended-command (where-is-internal function overriding-local-map t)))) (unless (commandp function) (error "`%s' is not a valid command name" command-name)) + ;; Some features, such as novice.el, rely on this-command-keys + ;; including M-x COMMAND-NAME RET. + (set--this-command-keys (concat "\M-x" (symbol-name function) "\r")) (setq this-command function) ;; Normally `real-this-command' should never be changed, but here we really ;; want to pretend that M-x RET is nothing more than a "key diff --git a/src/keyboard.c b/src/keyboard.c index a86e7c5..b1eeb03 100644 --- a/src/keyboard.c +++ b/src/keyboard.c @@ -10001,6 +10001,28 @@ See also `this-command-keys-vector'. */) XVECTOR (this_command_keys)->contents); } +DEFUN ("set--this-command-keys", Fset__this_command_keys, + Sset__this_command_keys, 1, 1, 0, + doc: /* Set the vector to be returned by `this-command-keys'. +The argument KEYS must be a string. +Internal use only. */) + (Lisp_Object keys) +{ + CHECK_STRING (keys); + + this_command_key_count = 0; + this_single_command_key_start = 0; + int key0 = SREF (keys, 0); + + if (key0 == 248) + add_command_key (make_number ('x' | meta_modifier)); + else + add_command_key (make_number (key0)); + for (int i = 1; i < SCHARS (keys); i++) + add_command_key (make_number (SREF (keys, i))); + return Qnil; +} + DEFUN ("this-command-keys-vector", Fthis_command_keys_vector, Sthis_command_keys_vector, 0, 0, 0, doc: /* Return the key sequence that invoked this command, as a vector. However, if the command has called `read-key-sequence', it returns @@ -11211,6 +11233,7 @@ syms_of_keyboard (void) defsubr (&Sthis_command_keys_vector); defsubr (&Sthis_single_command_keys); defsubr (&Sthis_single_command_raw_keys); + defsubr (&Sset__this_command_keys); defsubr (&Sclear_this_command_keys); defsubr (&Ssuspend_emacs); defsubr (&Sabort_recursive_edit);