all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Eric Abrahamsen <eric@ericabrahamsen.net>
To: help-gnu-emacs@gnu.org
Subject: Re: was a command called via M-x?
Date: Sat, 19 Jul 2014 20:37:06 +0800	[thread overview]
Message-ID: <8738dxo77x.fsf@ericabrahamsen.net> (raw)
In-Reply-To: e01f121d-a4ef-47b0-ae87-3f49bf2b61d3@default

Drew Adams <drew.adams@oracle.com> writes:

>> (let* ((command-name (symbol-name this-command))
>>        (pref-arg current-prefix-arg)
>>        (keys (this-command-keys))
>>        (key-string (key-description keys))
>>        (title-string (if pref-arg
>>                          (format "%s %s" pref-arg key-string)
>>                        (format "%s" key-string))))
>>   (alert command-name :title title-string))
>> 
>> I don't want to just check for "RET" and replace it with "M-x", because
>> the command might very well have been called with "RET". Do I have any
>> other way of knowing for sure that the command was called using
>> `execute-extended-command'? last-command doesn't seem to get it
>> either...
>
> You might want to show more of how your code is invoked etc.
>
> `execute-extended-command' changes `this-command'.  The command invoked
> by `execute-extended-command' is instead the value of `real-this-command',
> and you can get its key binding (if there is one) using:
> (where-is-internal real-this-command overriding-local-map t) instead of
> (this-command-keys).
>
> But if you want `execute-extended-command' or `M-x' instead of that
> information, then you will probably need to either advise that function
> or (depending on when you need the info) advise `read-extended-command',
> recording for yourself the fact that `execute-extended-command' was
> invoked.

Hmm, that's sounding like maybe more work than it's worth. Let me clean
up the module as it is, and have another hard look at it.

Thanks,
Eric




      reply	other threads:[~2014-07-19 12:37 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-07-17  8:31 was a command called via M-x? Eric Abrahamsen
2014-07-17 13:57 ` Drew Adams
2014-07-19 12:37   ` Eric Abrahamsen [this message]

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=8738dxo77x.fsf@ericabrahamsen.net \
    --to=eric@ericabrahamsen.net \
    --cc=help-gnu-emacs@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.