all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Bob Newell <bobnewell@bobnewell.net>
To: help-gnu-emacs@gnu.org
Subject: Re: I'd like to advise a /keybinding/, how do I do it?
Date: Wed, 28 Apr 2021 14:29:45 -1000	[thread overview]
Message-ID: <878s52lypy.fsf@emailmessageidheader.nil> (raw)
In-Reply-To: <jwv8s52ij0b.fsf-monnier+emacs@gnu.org> (Stefan Monnier's message of "Wed, 28 Apr 2021 10:33:31 -0400")


>> A "finishing" action is often bound to C-c C-c (sending an email and
>> commiting something to Git come to mind), so I'd like to advise whatever
>> C-c C-c calls to check the buffer for occurrences of a string like TODO.

> Or you could do it by advising the command bound to the particular key

I've done this when I want the underlying command to be
affected in all cases. For instance I don't wish send out an
email until I've verified that I have a network connection, so
I advise "message-send" and "message-send-and-exit" rather
than the associated keystrokes.

But be at least a little wary. Sometimes the keystrokes fool
you about the underlying function. In my Gnus reply buffer
right now, C-h k on C-c C-c shows 'orgtbl-ctrl-c-ctrl-c'.

> Or you could do it with a minor-mode map (i.e. without modifying any

I've done this on several occasions when I don't want to mess
with the use of a command outside of a particular minor
mode. That's a less common case, I think, but still very
useful for certain things.

-- 
Bob Newell
Honolulu, Hawai`i

- Via GNU/Linux/Emacs/Gnus/BBDB



      reply	other threads:[~2021-04-29  0:29 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-28  5:25 I'd like to advise a /keybinding/, how do I do it? Marcin Borkowski
2021-04-28  7:08 ` Omar Polo
2021-04-28  9:21   ` Philip Kaludercic
2021-04-28 11:44 ` Eli Zaretskii
2021-04-28 14:33 ` Stefan Monnier
2021-04-29  0:29   ` Bob Newell [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=878s52lypy.fsf@emailmessageidheader.nil \
    --to=bobnewell@bobnewell.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.