Re: On keybindings and the slow erosion of help's utility
Stefan Monnier <[email protected]> Sun, 02 Aug 2026 11:43:17 -0400
| Newsgroups | gmane.emacs.devel |
|---|---|
| Message-ID | <[email protected]> |
>> >> Let's consider a simple case. >> >> We want to bind C-k in foo-mode-map but only on specific lines in file. >> >> When the point is elsewhere, we just want Emacs to call whatever is >> >> bound to C-k as if C-k in foo-mode-map were not bound at all. >> >> How would you do it with a command? >> > >> > The command would test if point is on one of those specific lines, and >> > if not, call the binding of C-k in the "next" keymap in effect in the >> > buffer. >> >> This is indeed what some commands try to do nowadays, but it's hard to >> find the "next" binding in a reliable way. It comes with some >> non-trivial problems: > > I supposed that whatever infrastructure we add to make these problems > easier to solve will also be available to commands and to "C-h". So > it is not clear to me why we need to also add some new type of a > keymap entry. Finding the next binding while running a command is hard not just for lack of infrastructure. We can add "generic" code to the infrastructure so that it's easy(ish) to write such commands, but this generic code will still have to solve that hard problem, and may still end up brittle. AFAIK the only simple, clean, and reliable way to do it is to gather all the relevant info while we do the keymap lookup, and for that we need to adjust the keymap lookup code. === Stefan