[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: debugging Emacs LISP functions

From: Stefan Monnier
Subject: Re: debugging Emacs LISP functions
Date: Wed, 01 Mar 2017 09:01:34 -0500
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/26.0.50 (gnu/linux)

> I have a problem with Emacs. Basically it doesn't do what I want it to do :-)

That's only because you haven't yet realized that it's exactly what you
want it to do.

> emacs-devel mailing list. I don't know. With free software you just
> loose the difference between a "user" and a "developer".

As Emacs contributor&maintainer I've always tried hard to blur this
distinction as much as possible, indeed.

> When I try to debug LISP code that is part of Emacs I see with some functions
> I get the source code and with others I just get "byte-code".  In the latter
> case I can't debug it because the debugger just skips the whole function.
> How can I know what functions appear as "byte-code" in the debugger?
> And how can I debug them?

[ By "the debugger" I assume you mean the debugger that pops the
  *Backtrace* buffer, as opposed to the Edebug debugger you get by
  instrumenting code with C-u C-M-x.  ]

Normally, most of the Elisp functions are byte-compiled, so you don't
get to see much of their internals in the backtrace (and when you do see
their internals, you'd rather they had been hidden).  In order to see
details from a function, you'll then need to redefine the function in
its non-byte-compiled form.  Usually the best way to do that is:
- click on the function-name which should hopefully be a link to the
  function's definition.
- hit C-M-x from within the body of that definition, to redefine the function.

Then you can re-trigger the bug, which should get you back to the
backtrace but with more details of where you are within that function,
such that you can now use `e` from the various levels of stack to
investigate the value of the various variables.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]