From: Drew Adams <drew.adams@oracle.com>
To: 46243@debbugs.gnu.org
Subject: bug#46243: 26.3; If invoke menu item that reads a char, get keystrokes echo
Date: Mon, 1 Feb 2021 18:50:56 +0000 [thread overview]
Message-ID: <SA2PR10MB4474FD13A36681DF54645E61F3B69@SA2PR10MB4474.namprd10.prod.outlook.com> (raw)
There's no doubt a simpler thing to repro this with. Sorry, I'm pressed
for time.
I see this starting with Emacs 24, and still in Emacs 27.1. There's no
such problem before Emacs 24.
If I have a menu item that reads a character, the prompt for that read
is not seen; the menu selection key sequence gets echoed instead. This
shouldn't happen (should it?).
Binding `echo-keystrokes' in the command's `interactive' spec doesn't
prevent this. The workaround I've found is to add a call to (message
nil).
Example command:
(defun diredp-mark-with-char (char &optional arg)
"Mark this line with CHAR.
With numeric prefix arg N, mark the next N lines."
(interactive
(progn (message nil)
(list (read-char "Mark this line with char: ")
(prefix-numeric-value current-prefix-arg))))
(let ((dired-marker-char char))
(dired-mark arg)))
If the `interactive' spec does not have that (message nil) then it
doesn't work - you then see the menu-invocation key sequence instead of
the prompt. And this is so whether I use "cChar: \np" or a sexp with
`read-char'.
If I change to reading a string then there's no such problem:
(defun diredp-mark-with-char (char &optional arg)
"Mark this line with CHAR.
With numeric prefix arg N, mark the next N lines."
(interactive "sChar: \np")
(let ((dired-marker-char (string-to-char char)))
(dired-mark arg)))
So that's another possible workaround. (Is one of those better?)
Haven't been able to see why this problem occurs.
This is the menu item I have for the above command:
(define-key diredp-marks-mark-menu [diredp-mark-with-char]
'(menu-item "Mark This with Char..." diredp-mark-with-char
:visible (not (diredp-nonempty-region-p))
:help "Mark this line with a character you type"))
I see the problem also with `easy-menu-create-menu':
(easy-menu-create-menu
"This File"
'(["Mark with Char..." diredp-mark-with-char]))
Please advise. Am I missing something? As I say, this was not a
problem before Emacs 24.
In GNU Emacs 26.3 (build 1, x86_64-w64-mingw32)
of 2019-08-29
Repository revision: 96dd0196c28bc36779584e47fffcca433c9309cd
Windowing system distributor `Microsoft Corp.', version 10.0.18362
Configured using:
`configure --without-dbus --host=x86_64-w64-mingw32
--without-compress-install 'CFLAGS=-O2 -static -g3''
next reply other threads:[~2021-02-01 18:50 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-02-01 18:50 Drew Adams [this message]
2021-02-01 19:06 ` bug#46243: 26.3; If invoke menu item that reads a char, get keystrokes echo Drew Adams
2021-02-01 19:33 ` Eli Zaretskii
2021-02-01 22:30 ` bug#46243: [External] : " Drew Adams
2021-02-02 17:04 ` Eli Zaretskii
2021-02-03 15:56 ` Eli Zaretskii
2021-02-03 16:16 ` Stefan Monnier
2021-02-03 17:15 ` Eli Zaretskii
2021-02-03 17:42 ` Stefan Monnier
2021-02-03 19:56 ` Stefan Monnier
2021-02-04 15:50 ` Eli Zaretskii
2021-02-04 16:50 ` Stefan Monnier
2021-02-04 17:37 ` Eli Zaretskii
2021-02-04 19:23 ` Drew Adams
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=SA2PR10MB4474FD13A36681DF54645E61F3B69@SA2PR10MB4474.namprd10.prod.outlook.com \
--to=drew.adams@oracle.com \
--cc=46243@debbugs.gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.