How to find the location, where an an Emacs Lisp function is bound to a key?

為{幸葍}努か 提交于 2019-12-12 09:01:55

问题


I'm trying to figure out where M-m is bound to back-to-indentation function. When I issue C-h k M-m (describe-key), I get the following output

M-m runs the command back-to-indentation, which is an interactive compiled Lisp function in `simple.el'.

It is bound to M-m.

(back-to-indentation)

Move point to the first non-whitespace character on this line.

When I look at simple.el, I'm seeing only the definition of function back-to-indentation. I searched throughout the file and I didn't see any keybinding done for that function using define-key. I'm assuming that it happens elsewhere.

How can I identify the location where the function is bound to M-m key?

Emacs version: GNU Emacs 24.2.1 (x86_64-apple-darwin12.2.0, NS apple-appkit-1187.34)


回答1:


I don't know if that's possible in general, but my guess would be that Emacs doesn't remember where the code was that defined a given key.

C-hb will show the current bindings, from which you can establish which keymap you're interested in, and work from there. For most major or minor mode maps, it won't be too difficult to find the code.

Your specific example is a global binding which Emacs configures in bindings.el.



来源:https://stackoverflow.com/questions/15354894/how-to-find-the-location-where-an-an-emacs-lisp-function-is-bound-to-a-key

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!