all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* I'd like to advise a /keybinding/, how do I do it?
@ 2021-04-28  5:25 Marcin Borkowski
  2021-04-28  7:08 ` Omar Polo
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Marcin Borkowski @ 2021-04-28  5:25 UTC (permalink / raw)
  To: Help Gnu Emacs mailing list

Hello everyone,

what I'd like to do is to "advise a keybinding", IOW, advise whatever
command a given key is bound to.  How do I get the name of the command
given a key, and taking into account the current major mode, minor modes
etc.?

I tried to look at the source code of `describe-key-briefly', but it is
pretty dense, and maybe there's a better way than diving into that
rabbit hole.

The rationale is that I'm thinking about writing a minor mode which
could prevent a "finishing" action until the buffer is ready.
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.

Of course, a more robust way would be to have a list of various major
modes and their "finishing" commands, but I think the idea with just
looking up C-c C-c is cute (even if not very robust), and I was
wondering if it can be done in a simple way, even as a toy.

Any ideas?

-- 
Marcin Borkowski
http://mbork.pl



^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2021-04-29  0:29 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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

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.