all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Drew Adams <drew.adams@oracle.com>
To: rswgnu@gmail.com, emacs-devel <emacs-devel@gnu.org>
Subject: RE: Need a predicate to tell whether a command was invoked from the menu-bar
Date: Tue, 28 Jun 2016 14:18:42 -0700 (PDT)	[thread overview]
Message-ID: <aeceafae-e57d-4190-b494-03eb76d8c917@default> (raw)
In-Reply-To: <CA+OMD9j4J6hBNDtED6kW5Hjh7BSMef5h_qvW3prwxvTNPr_kxQ@mail.gmail.com>

> 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.)



  reply	other threads:[~2016-06-28 21:18 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
2016-06-29  0:24   ` Robert Weiner

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=aeceafae-e57d-4190-b494-03eb76d8c917@default \
    --to=drew.adams@oracle.com \
    --cc=emacs-devel@gnu.org \
    --cc=rswgnu@gmail.com \
    /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.