Onlyjob
Onlyjob

Reputation: 5868

how to trace emacs menu?

Is there a way to see what emacs is doing when I choose an action from menu?
For example I'd like to see what lisp commands are executed when I click on

Tools --> Spell Checking --> Automatic spell checking

This could be useful for learning what to include to init file to enable automatic spell check by default. Thanks.

Upvotes: 0

Views: 80

Answers (1)

phils
phils

Reputation: 73274

Menus are implemented as keymaps, and describe-key handles mouse events in general, so you can simply use:

C-hk (select menu item)

In this instance we see:

<menu-bar> <tools> <spell> <flyspell-mode> runs the command
flyspell-mode, which is an interactive autoloaded Lisp function in
`flyspell.el'.

It is bound to <menu-bar> <tools> <spell> <flyspell-mode>.

(flyspell-mode &optional ARG)

Toggle on-the-fly spell checking (Flyspell mode).
[...]

Actually tracing lisp calls is really a different question (trace-function, the built-in elp profiling library, debug-on-entry and the two debuggers in general are all very useful tools), but in this case clicking a menu item simply calls its function interactively, so there's nothing much to trace :)

Upvotes: 1

Related Questions