From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Noam Postavsky Newsgroups: gmane.emacs.bugs Subject: bug#29399: 26.0.90; `edit-kbd-macro' has bad prompt Date: Sun, 26 Nov 2017 19:55:11 -0500 Message-ID: <87efoko80g.fsf@users.sourceforge.net> References: <4fea6ba6-0003-4422-97d6-51098197b1eb@default> <87y3mxzwb1.fsf@users.sourceforge.net> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Trace: blaine.gmane.org 1511744178 24893 195.159.176.226 (27 Nov 2017 00:56:18 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Mon, 27 Nov 2017 00:56:18 +0000 (UTC) User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.0.90 (gnu/linux) Cc: 29399@debbugs.gnu.org To: Drew Adams Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Mon Nov 27 01:56:12 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 1eJ7iT-0005vV-Td for geb-bug-gnu-emacs@m.gmane.org; Mon, 27 Nov 2017 01:56:10 +0100 Original-Received: from localhost ([::1]:58670 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eJ7ib-0000kQ-BL for geb-bug-gnu-emacs@m.gmane.org; Sun, 26 Nov 2017 19:56:17 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:47185) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eJ7iQ-0000hi-2J for bug-gnu-emacs@gnu.org; Sun, 26 Nov 2017 19:56:07 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eJ7iM-0007Nk-V0 for bug-gnu-emacs@gnu.org; Sun, 26 Nov 2017 19:56:06 -0500 Original-Received: from debbugs.gnu.org ([208.118.235.43]:51118) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1eJ7iM-0007NK-Ot for bug-gnu-emacs@gnu.org; Sun, 26 Nov 2017 19:56:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1eJ7iM-0002vg-FN for bug-gnu-emacs@gnu.org; Sun, 26 Nov 2017 19:56:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Noam Postavsky Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 27 Nov 2017 00:56:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 29399 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 29399-submit@debbugs.gnu.org id=B29399.151174413011219 (code B ref 29399); Mon, 27 Nov 2017 00:56:02 +0000 Original-Received: (at 29399) by debbugs.gnu.org; 27 Nov 2017 00:55:30 +0000 Original-Received: from localhost ([127.0.0.1]:59799 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eJ7ho-0002um-Fm for submit@debbugs.gnu.org; Sun, 26 Nov 2017 19:55:28 -0500 Original-Received: from mail-it0-f46.google.com ([209.85.214.46]:41831) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eJ7hl-0002uT-Re; Sun, 26 Nov 2017 19:55:26 -0500 Original-Received: by mail-it0-f46.google.com with SMTP id x28so18972871ita.0; Sun, 26 Nov 2017 16:55:25 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:in-reply-to:references:user-agent:date :message-id:mime-version; bh=qgzLhDbQnlgC7MiCBzjHXVVIzwjCoLIr7OISj0gKz9I=; b=s7ULaXp0nbft9BGv/8D4M4Gdf7a+D4CX7LW5YmTTep3lQSYGdU+T/JQfogHP/Y7cjp 0BxLgUmt5Ytj1BuFRySouhzECDKdIwCeL+bLLZ8rcLJimjuLgGa4ybWZb5fGrmwqj8lP 7YX4TGRvgF5Y6Ng3XL6X8LKhFKwO0W/o35gLDMwwfK5omb+B+Gm3C2c90IEM6qiPfyaC XwwJdvP51jRu5fY22TwwQ5azZbTFHzgaZmbMSjKKSrtrAa9G3fsLEteFUjPu5idHY1hO 8wTiBKhKYEEI7EpKYhfX8J65upkx/l0VY9ipYxkHrWuJa7WK1ZO7UMyFBlVtupUgjlqw 3s9g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:in-reply-to:references :user-agent:date:message-id:mime-version; bh=qgzLhDbQnlgC7MiCBzjHXVVIzwjCoLIr7OISj0gKz9I=; b=OIIaU/KGokQwMNNqfhri1rmvnafeEC5V6vOwmjUg7ympUoZO/tG3Qaxkn/GHZFoZH/ ytmLzrMOdKLAUbiopLZj5ufBVwJ/EVvPhjWiBEzmikYVxhF4cqEjPh0zfWK8xs3qi0bo /rvwIe/INBEzFSizrJw1dFoWqGV4Lig2mbb0DrcU5+t/3qKwz5BBpSwc+mh82klSnK26 3ZttQQH2+z1jSrMRAi80Nps8vbbCxuWcXZpFSWPV2mfpGzupJfTk446rEumW9edVCgLI 0ErUzfPfgHHH2kZX+0qFrW+HgRJD4/d1oWblafFFzHf8FvGIpo4X/crXWkO+wjDcU+5z h1Eg== X-Gm-Message-State: AJaThX7SdLEXb5bXMF495gcaudvcEINkIRfQeLENf+QoS/TV6HcBJ2z3 idi0vtEckw6lMhedhbGukfY3Aw== X-Google-Smtp-Source: AGs4zMbmC4Xq4W9/6yP/eK27KevM9qfbFHyjZ+rf7aGoENSY6hlJUYbmdMp2o026BmUoiQRkSyt6KA== X-Received: by 10.36.148.134 with SMTP id j128mr25761097ite.17.1511744119759; Sun, 26 Nov 2017 16:55:19 -0800 (PST) Original-Received: from zebian ([45.2.119.34]) by smtp.googlemail.com with ESMTPSA id c36sm8981650iod.11.2017.11.26.16.55.17 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sun, 26 Nov 2017 16:55:17 -0800 (PST) In-Reply-To: (Drew Adams's message of "Wed, 22 Nov 2017 17:15:53 -0800 (PST)") 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:140431 Archived-At: --=-=-= Content-Type: text/plain tags 29399 + patch quit Drew Adams writes: > UNLESS the user (or `smex-mode' or whatever) actually > substitutes `smex' for `execute-extended-command' keys, > using remapping or using `substitute-key-definition'. Ah, I didn't realize before, but if you do (define-key global [remape execute-extended-command] 'smex) then substitute-command-keys still shows M-x for \\[execute-extended-command]. The following patch updates the prompt, and also the checks non-remapped key bindings for the key sequence entered. --=-=-= Content-Type: text/x-diff Content-Disposition: inline; filename=0001-Improve-edit-kbd-macro-prompting-in-case-of-remapped.patch Content-Description: patch >From dec6f0ccf57ea590c199b6cdf39c6fe93d67d06b Mon Sep 17 00:00:00 2001 From: Noam Postavsky Date: Sun, 26 Nov 2017 19:16:16 -0500 Subject: [PATCH] Improve edit-kbd-macro prompting in case of remapped keys (Bug#29399) * lisp/edmacro.el (edit-kbd-macro): Use substitute-command-keys to present the current bindings in the prompt. Check the the non-remapped binding of the entered key sequence as well. --- lisp/edmacro.el | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/lisp/edmacro.el b/lisp/edmacro.el index b050f4d64c..dc840ef1f1 100644 --- a/lisp/edmacro.el +++ b/lisp/edmacro.el @@ -88,20 +88,26 @@ edmacro-original-buffer (defun edit-kbd-macro (keys &optional prefix finish-hook store-hook) "Edit a keyboard macro. At the prompt, type any key sequence which is bound to a keyboard macro. -Or, type `C-x e' or RET to edit the last keyboard macro, `C-h l' to edit -the last 300 keystrokes as a keyboard macro, or `\\[execute-extended-command]' to edit a macro by -its command name. +Or, type `\\[kmacro-end-and-call-macro]' or RET to edit the last +keyboard macro, `\\[view-lossage]' to edit the last 300 +keystrokes as a keyboard macro, or `\\[execute-extended-command]' +to edit a macro by its command name. With a prefix argument, format the macro in a more concise way." - (interactive "kKeyboard macro to edit (C-x e, M-x, C-h l, or keys): \nP") + (interactive + (list (read-key-sequence (substitute-command-keys "Keyboard macro to edit \ +\(\\[kmacro-end-and-call-macro], \\[execute-extended-command], \\[view-lossage],\ + or keys): ")) + current-prefix-arg)) (when keys (let ((cmd (if (arrayp keys) (key-binding keys) keys)) + (cmd-noremap (when (arrayp keys) (key-binding keys nil t))) (mac nil) (mac-counter nil) (mac-format nil) kmacro) (cond (store-hook (setq mac keys) (setq cmd nil)) - ((or (memq cmd '(call-last-kbd-macro kmacro-call-macro - kmacro-end-or-call-macro kmacro-end-and-call-macro)) + ((or (memq cmd '(call-last-kbd-macro kmacro-call-macro kmacro-end-or-call-macro kmacro-end-and-call-macro)) + (memq cmd-noremap '(call-last-kbd-macro kmacro-call-macro kmacro-end-or-call-macro kmacro-end-and-call-macro)) (member keys '("\r" [return]))) (or last-kbd-macro (y-or-n-p "No keyboard macro defined. Create one? ") @@ -109,13 +115,14 @@ edit-kbd-macro (setq mac (or last-kbd-macro "")) (setq keys nil) (setq cmd 'last-kbd-macro)) - ((eq cmd 'execute-extended-command) + ((memq 'execute-extended-command (list cmd cmd-noremap)) (setq cmd (read-command "Name of keyboard macro to edit: ")) (if (string-equal cmd "") (error "No command name given")) (setq keys nil) (setq mac (symbol-function cmd))) - ((memq cmd '(view-lossage electric-view-lossage)) + ((or (memq cmd '(view-lossage electric-view-lossage)) + (memq cmd-noremap '(view-lossage electric-view-lossage))) (setq mac (recent-keys)) (setq keys nil) (setq cmd 'last-kbd-macro)) -- 2.11.0 --=-=-=--