* Need a predicate to tell whether a command was invoked from the menu-bar
@ 2016-06-28 21:01 Robert Weiner
2016-06-28 21:18 ` Drew Adams
0 siblings, 1 reply; 3+ messages in thread
From: Robert Weiner @ 2016-06-28 21:01 UTC (permalink / raw)
To: emacs-devel
[-- Attachment #1: Type: text/plain, Size: 142 bytes --]
Does anyone have a predicate function that determines whether or not a
command was invoked from a menu-bar menu?
That would be helpful.
Bob
[-- Attachment #2: Type: text/html, Size: 610 bytes --]
^ permalink raw reply [flat|nested] 3+ messages in thread
* RE: Need a predicate to tell whether a command was invoked from the menu-bar
2016-06-28 21:01 Need a predicate to tell whether a command was invoked from the menu-bar Robert Weiner
@ 2016-06-28 21:18 ` Drew Adams
2016-06-29 0:24 ` Robert Weiner
0 siblings, 1 reply; 3+ messages in thread
From: Drew Adams @ 2016-06-28 21:18 UTC (permalink / raw)
To: rswgnu, emacs-devel
> Does anyone have a predicate function that determines whether or not
> a command was invoked from a menu-bar menu?
I use this:
(and (> (length (this-command-keys-vector)) 0)
(equal '(menu-bar) (elt (this-command-keys-vector) 0))
;; Exclude uninterned symbols such as `menu-function-356'.
(symbolp this-command)
(intern-soft this-command))
(But please consider using plain-text mail, not HTML, for this
mailing list.)
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Need a predicate to tell whether a command was invoked from the menu-bar
2016-06-28 21:18 ` Drew Adams
@ 2016-06-29 0:24 ` Robert Weiner
0 siblings, 0 replies; 3+ messages in thread
From: Robert Weiner @ 2016-06-29 0:24 UTC (permalink / raw)
Cc: emacs-devel
On Tue, Jun 28, 2016 at 5:18 PM, Drew Adams <drew.adams@oracle.com> wrote:
> (and (> (length (this-command-keys-vector)) 0)
> (equal '(menu-bar) (elt (this-command-keys-vector) 0))
Thanks, Drew. I will try it out.
Bob
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2016-06-29 0:24 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-06-28 21:01 Need a predicate to tell whether a command was invoked from the menu-bar Robert Weiner
2016-06-28 21:18 ` Drew Adams
2016-06-29 0:24 ` Robert Weiner
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).