Reputation: 7729
There is one thing that I don't like on table function in Org-mode for emacs. I would like to see all the functions that get executed by function that I run as Emacs command.
What is the best way to do that? Any tips how to get started with debuging elisp code, especially single command of interest?
Upvotes: 20
Views: 6207
Reputation: 30708
I prefer the traditional Emacs debugger to edebug. To use it:
M-x debug-on-entry the-function RET
Then, whenever the-function
is invoked, the debugger is entered. Use d to step through the evaluation, and c if you want to skip through a step (not dive into its details.
It helps to view the definition of the-function
in another window/frame while you step through it.
You can cancel debug-on-entry
using M-x cancel-debug-on-entry
.
Upvotes: 17
Reputation: 1
If you want a programmatic way to see the source of a function (akin to Clojure's source
macro) you can use the symbol-function
subroutine.
For instance, there is a defun do-math
in my .emacs
file. To see its source, I can do the following
(symbol-function 'do-math)
and it gives me
ELISP> (symbol-function 'do-math)
(lambda
(expression)
(interactive "sexpression:")
(insert
(number-to-string
(eval
(read expression)))))
See also : https://www.gnu.org/software/emacs/manual/html_node/elisp/Function-Indirection.html
See also also : http://ergoemacs.org/emacs/elisp_symbol.html
Upvotes: 0
Reputation: 34354
Whenever the function is called, Emacs will drop into Edebug which makes it easy to execute the function step by step, inspect variables, and do other typical debugging tasks. See (info "(Elisp)Edebug")
for more information.
Upvotes: 26
Reputation: 8637
C-h f
to go to function help mode, then type the name of the function. If it is an elisp function, you can then view the source and look for yourself what functions it calls.
Upvotes: 0