unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#13948: no key-binding-locus
@ 2013-03-13 20:34 Brian Malehorn
  2013-04-23 19:41 ` Josh
  2014-06-02 10:15 ` Nicolas Richard
  0 siblings, 2 replies; 18+ messages in thread
From: Brian Malehorn @ 2013-03-13 20:34 UTC (permalink / raw)
  To: 13948

[-- Attachment #1: Type: text/plain, Size: 1281 bytes --]

Why isn't there a key equivalent to variable-binding-locus? As
in, a way to figure out where a particular keybinding is coming
from. For example,

    M-x key-binding-locus C-j

would evaluate to 'lisp-interaction-mode-map, which is the first
map in which C-j was found.


In terms of implementation, the process for finding a binding is
described in (info "(elisp) Searching Keymaps"):

    ...Here is a pseudo-Lisp description of the order and
    conditions for searching them:

     (or (cond
          (overriding-terminal-local-map
           (FIND-IN overriding-terminal-local-map))
          (overriding-local-map
           (FIND-IN overriding-local-map))
          ((or (FIND-IN (get-char-property (point) 'keymap))
       (FIND-IN-ANY emulation-mode-map-alists)
       (FIND-IN-ANY minor-mode-overriding-map-alist)
       (FIND-IN-ANY minor-mode-map-alist)
       (if (get-text-property (point) 'local-map)
           (FIND-IN (get-char-property (point) 'local-map))
         (FIND-IN (current-local-map))))))
         (FIND-IN (current-global-map)))

So implementing key-binding-locus would only be a small tweak of
the key lookup code: the first time you find the key, just return
the map you found it in, rather than the command it's supposed to
call.

Thanks,
Brian

[-- Attachment #2: Type: text/html, Size: 2069 bytes --]

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

end of thread, other threads:[~2014-06-12 16:09 UTC | newest]

Thread overview: 18+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-03-13 20:34 bug#13948: no key-binding-locus Brian Malehorn
2013-04-23 19:41 ` Josh
2014-06-02 10:15 ` Nicolas Richard
2014-06-02 13:55   ` Stefan Monnier
2014-06-04 10:51     ` Nicolas Richard
2014-06-04 13:50       ` Stefan Monnier
2014-06-04 14:00         ` Nicolas Richard
2014-06-04 14:20           ` Stefan Monnier
2014-06-06 17:57             ` Nicolas Richard
2014-06-06 18:27               ` Stefan Monnier
2014-06-10 19:46                 ` Nicolas Richard
2014-06-10 22:24                   ` Stefan Monnier
2014-06-11 11:23                     ` Nicolas Richard
2014-06-11 18:06                       ` Stefan Monnier
2014-06-11 20:20                         ` Nicolas Richard
2014-06-11 22:00                           ` Stefan Monnier
2014-06-12  8:16                           ` Nicolas Richard
2014-06-12 16:09                     ` Nicolas Richard

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).