GNU bug report logs -
#29399
26.0.90; `edit-kbd-macro' has bad prompt
Previous Next
Reported by: Drew Adams <drew.adams <at> oracle.com>
Date: Wed, 22 Nov 2017 16:28:02 UTC
Severity: minor
Tags: fixed, patch
Found in version 26.0.90
Fixed in version 26.1
Done: Noam Postavsky <npostavs <at> users.sourceforge.net>
Bug is archived. No further changes may be made.
To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 29399 in the body.
You can then email your comments to 29399 AT debbugs.gnu.org in the normal way.
Toggle the display of automated, internal messages from the tracker.
Report forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#29399
; Package
emacs
.
(Wed, 22 Nov 2017 16:28:02 GMT)
Full text and
rfc822 format available.
Acknowledgement sent
to
Drew Adams <drew.adams <at> oracle.com>
:
New bug report received and forwarded. Copy sent to
bug-gnu-emacs <at> gnu.org
.
(Wed, 22 Nov 2017 16:28:02 GMT)
Full text and
rfc822 format available.
Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):
emacs -Q
C-x ( C-f C-f C-f C-x )
M-: (global-set-key (kbd "C-o") 'execute-extended-command)
M-: (global-set-key (kbd "M-x") 'forward-char)
C-o edit-kbd-macro RET
The prompt says:
"Keyboard macro to edit (C-x e, M-x, C-h l, or keys):"
It should use \\[execute-extended-command] and thus say:
"Keyboard macro to edit (C-x e, C-o, C-h l, or keys):"
This prompt is anyway not clear. The command should instead accept
a key sequence that shows more complete info/help, and the prompt should
just mention that key sequence.
In GNU Emacs 26.0.90 (build 3, x86_64-w64-mingw32)
of 2017-10-13 built on LAPHROAIG
Repository revision: 906224eba147bdfc0514090064e8e8f53160f1d4
Windowing system distributor 'Microsoft Corp.', version 6.1.7601
Recent messages:
For information about GNU Emacs and the GNU system, type C-h C-a.
Defining kbd macro...
Keyboard macro defined
Quit [2 times]
execute-extended-command
forward-char
Quit
Configured using:
'configure --without-dbus --host=x86_64-w64-mingw32
--without-compress-install 'CFLAGS=-O2 -static -g3''
Configured features:
XPM JPEG TIFF GIF PNG RSVG SOUND NOTIFY ACL GNUTLS LIBXML2 ZLIB
TOOLKIT_SCROLL_BARS
Important settings:
value of $LANG: ENU
locale-coding-system: cp1252
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#29399
; Package
emacs
.
(Thu, 23 Nov 2017 00:14:01 GMT)
Full text and
rfc822 format available.
Message #8 received at 29399 <at> debbugs.gnu.org (full text, mbox):
Drew Adams <drew.adams <at> oracle.com> writes:
> emacs -Q
>
> C-x ( C-f C-f C-f C-x )
>
> M-: (global-set-key (kbd "C-o") 'execute-extended-command)
> M-: (global-set-key (kbd "M-x") 'forward-char)
>
> C-o edit-kbd-macro RET
>
> The prompt says:
>
> "Keyboard macro to edit (C-x e, M-x, C-h l, or keys):"
>
> It should use \\[execute-extended-command] and thus say:
>
> "Keyboard macro to edit (C-x e, C-o, C-h l, or keys):"
>
> This prompt is anyway not clear. The command should instead accept
> a key sequence that shows more complete info/help, and the prompt should
> just mention that key sequence.
I'm not sure if this would help so much for the OP's case [1], which is
more like:
(defun my/execute-extended-command () ; actually `smex'[2] in OP's case
(interactive)
(call-interactively 'execute-extended-command))
(global-set-key (kbd "M-x") 'my/execute-extended-command)
With that kind of config, I get
Keyboard macro to edit (C-x e, <execute>, C-h l, or keys):
I have no idea how to produce <execute> on my keyboard. If also do
(define-key global-map [execute] 'ignore)
I get
Keyboard macro to edit (C-x e, <menu>, C-h l, or keys):
which I know is the "Menu key" [3]. But personally, I disable the <menu>
key also, because otherwise I sometimes accidentally lean on it,
producing deeply nested minibuffer prompt which is annoying.
(define-key global-map [menu] 'ignore)
Which ends up with this:
"Keyboard macro to edit (C-x e, M-x execute-extended-command, C-h l, or keys):"
[1]: https://emacs.stackexchange.com/questions/37017/unable-to-supply-macro-name-to-edit-kbd-macro-when-m-x-is-bound-to-smex
[2]: https://github.com/nonsequitur/smex
[3]: https://en.wikipedia.org/wiki/Menu_key
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#29399
; Package
emacs
.
(Thu, 23 Nov 2017 01:17:02 GMT)
Full text and
rfc822 format available.
Message #11 received at 29399 <at> debbugs.gnu.org (full text, mbox):
> > It should use \\[execute-extended-command] and thus say:
> > "Keyboard macro to edit (C-x e, C-o, C-h l, or keys):"
>
> I'm not sure if this would help so much for the OP's case [1], which is
> more like:
>
> (defun my/execute-extended-command () ; actually `smex'[2] in OP's
> case
> (interactive)
> (call-interactively 'execute-extended-command))
> (global-set-key (kbd "M-x") 'my/execute-extended-command)
>
> With that kind of config, I get
> Keyboard macro to edit (C-x e, <execute>, C-h l, or keys):
Well, that's at least correct. ;-) The problem is that
there is no way to tell Emacs which binding to show.
I suppose you could use `set-advertised-calling-convention',
but a user shouldn't need to bother (or know about)
that, here.
This is a general Emacs gotcha/problem. It's not the
problem of this bug report.
Except for this, which I also said:
>> This prompt is anyway not clear. The command should
>> instead accept a key sequence that shows more complete
>> info/help, and the prompt should just mention that key
>> sequence.
That's the right thing to do. The prompt shouldn't
try to mention lots of keys. That's only good when
the command itself will actually read keys - it then
knows just which keys to mention: those it uses.
This command should mention only (at most) a help key
that it provides (would provide). Using that help key
(at that time - while prompted) would show whatever
help we want to show, including mentioning any keys
or commands, if appropriate.
Of course that help could itself fall into the problem
of showing a key such as `<execute>' or `<menu>'. But
as I said, that's a general problem.
It could choose to mention only command names, i.e.,
not use \\[...].
> I have no idea how to produce <execute> on my keyboard.
You probably cannot.
> Which ends up with this:
>
> "Keyboard macro to edit (C-x e, M-x execute-extended-command, C-h l,
> or keys):"
And that's as good as it could get. The command can
reasonably assume that you can use `execute-extended-command'
(which you can, I think, regardless of whether `M-x' is
bound to `smex'). The command cannot know that a user
always wants to use `smex' instead of `M-x'.
UNLESS the user (or `smex-mode' or whatever) actually
substitutes `smex' for `execute-extended-command' keys,
using remapping or using `substitute-key-definition'.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#29399
; Package
emacs
.
(Mon, 27 Nov 2017 00:56:02 GMT)
Full text and
rfc822 format available.
Message #14 received at 29399 <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
tags 29399 + patch
quit
Drew Adams <drew.adams <at> oracle.com> 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.
[0001-Improve-edit-kbd-macro-prompting-in-case-of-remapped.patch (text/x-diff, inline)]
From dec6f0ccf57ea590c199b6cdf39c6fe93d67d06b Mon Sep 17 00:00:00 2001
From: Noam Postavsky <npostavs <at> gmail.com>
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
Added tag(s) patch.
Request was from
Noam Postavsky <npostavs <at> users.sourceforge.net>
to
control <at> debbugs.gnu.org
.
(Mon, 27 Nov 2017 00:56:02 GMT)
Full text and
rfc822 format available.
Added tag(s) fixed.
Request was from
Noam Postavsky <npostavs <at> users.sourceforge.net>
to
control <at> debbugs.gnu.org
.
(Sat, 02 Dec 2017 14:55:04 GMT)
Full text and
rfc822 format available.
bug marked as fixed in version 26.1, send any further explanations to
29399 <at> debbugs.gnu.org and Drew Adams <drew.adams <at> oracle.com>
Request was from
Noam Postavsky <npostavs <at> users.sourceforge.net>
to
control <at> debbugs.gnu.org
.
(Sat, 02 Dec 2017 14:55:04 GMT)
Full text and
rfc822 format available.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#29399
; Package
emacs
.
(Sat, 02 Dec 2017 14:55:05 GMT)
Full text and
rfc822 format available.
Message #23 received at 29399 <at> debbugs.gnu.org (full text, mbox):
tags 29399 fixed
close 29399 26.1
quit
Noam Postavsky <npostavs <at> users.sourceforge.net> writes:
> The following patch updates the prompt, and also the checks
> non-remapped key bindings for the key sequence entered.
Pushed to emacs-26.
[1: 98ca7d5f26]: 2017-12-02 09:35:44 -0500
Improve edit-kbd-macro prompting in case of remapped keys (Bug#29399)
https://git.savannah.gnu.org/cgit/emacs.git/commit/?id=98ca7d5f26f5bdde44864c7f24dafb6725fca09f
bug archived.
Request was from
Debbugs Internal Request <help-debbugs <at> gnu.org>
to
internal_control <at> debbugs.gnu.org
.
(Sun, 31 Dec 2017 12:24:04 GMT)
Full text and
rfc822 format available.
This bug report was last modified 7 years and 170 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.