* Re: debugging Emacs LISP functions
2017-03-01 12:14 debugging Emacs LISP functions hector
@ 2017-03-01 12:30 ` chaouche yacine
2017-03-01 14:01 ` Stefan Monnier
2017-03-01 17:33 ` John Valente
2 siblings, 0 replies; 5+ messages in thread
From: chaouche yacine @ 2017-03-01 12:30 UTC (permalink / raw)
To: hector, help-gnu-emacs@gnu.org
Hello Hector,
I'm new to the list and to emacs tweaking in gle. I had the same problem a couple days ago. You can't debug those functions because they're in .elc files (emace lisp compiled), you need to grab the .el file (the human readable source file) somewhere and put it in the same location, that way the developer can take you there.
Hope this help.
-- Yassine.
On Wednesday, March 1, 2017 1:18 PM, hector <hectorlahoz@gmail.com> wrote:
I have a problem with Emacs. Basically it doesn't do what I want it to do :-)
Or put it another way, it doesn't behave as I expect it to behave.
I tried debugging the offending function (dir-locals-find-file)
and then I found another problem.
Perhaps I just don't get acquainted to the LISP typing system.
This function can return a string or a list. Is this good coding style?
But that's another question. Perhaps this mail should go to the
emacs-devel mailing list. I don't know. With free software you just
loose the difference between a "user" and a "developer". Anyway I see
some developers read this list every now and then.
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?
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: debugging Emacs LISP functions
2017-03-01 12:14 debugging Emacs LISP functions hector
2017-03-01 12:30 ` chaouche yacine
@ 2017-03-01 14:01 ` Stefan Monnier
2017-03-01 17:33 ` John Valente
2 siblings, 0 replies; 5+ messages in thread
From: Stefan Monnier @ 2017-03-01 14:01 UTC (permalink / raw)
To: help-gnu-emacs
> 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.
Stefan
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: debugging Emacs LISP functions
2017-03-01 12:14 debugging Emacs LISP functions hector
2017-03-01 12:30 ` chaouche yacine
2017-03-01 14:01 ` Stefan Monnier
@ 2017-03-01 17:33 ` John Valente
2017-03-01 18:31 ` Drew Adams
2 siblings, 1 reply; 5+ messages in thread
From: John Valente @ 2017-03-01 17:33 UTC (permalink / raw)
To: hector, help-gnu-emacs@gnu.org
The blurring between "user" and "developer", in this case, has nothing to do with free software. Emacs is many things, including an elisp complier and interpreter. So the problem you're having is absolutely appropriate for a user-level mailing list.
As far as Lisp goes, it's very common and canonical to have a function that can return either a string or a list of strings.
I see someone else has already responded with some help about using the debugger, and about evaluating source-code functions. One other thing you might try is quit emacs, and move or delete all the .elc files, and start it up again. I don't know how much that will work, because there might be code around that notices the lack of .elc files and recompiles the source. But I don't think the core files do that. As far as I recall, emacs is more than happy to work with interpreted code. It's just a little bit slower.
- John
From: hector <hectorlahoz@gmail.com>
To: help-gnu-emacs@gnu.org
Sent: Wednesday, March 1, 2017 4:14 AM
Subject: debugging Emacs LISP functions
I have a problem with Emacs. Basically it doesn't do what I want it to do :-)
Or put it another way, it doesn't behave as I expect it to behave.
I tried debugging the offending function (dir-locals-find-file)
and then I found another problem.
Perhaps I just don't get acquainted to the LISP typing system.
This function can return a string or a list. Is this good coding style?
But that's another question. Perhaps this mail should go to the
emacs-devel mailing list. I don't know. With free software you just
loose the difference between a "user" and a "developer". Anyway I see
some developers read this list every now and then.
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?
^ permalink raw reply [flat|nested] 5+ messages in thread
* RE: debugging Emacs LISP functions
2017-03-01 17:33 ` John Valente
@ 2017-03-01 18:31 ` Drew Adams
0 siblings, 0 replies; 5+ messages in thread
From: Drew Adams @ 2017-03-01 18:31 UTC (permalink / raw)
To: John Valente, hector, help-gnu-emacs
> The blurring between "user" and "developer", in this case, has nothing
> to do with free software.
Not sure just what you meant by "in this case". But the distinction
between user and developer _does_, in general, have something to do
with _free software_. It has at least these two, essentially
independent, things to do with free software:
1. Users can be developers of the Emacs product that is distributed
("core" Emacs). A "developer" role here is pretty much open to
any user (and even non-users).
2. Free software means freely available source code. And with the
GPL, anyone is permitted to use, copy, and modify copies of the
source code, within the rights of the license.
Non-free software typically does not allow for either of these.
It can sometimes allow for #1 (development by users) to some extent.
But ource code (at least some of it) is typically not made available
to everyone who uses non-free software.
There is another sense in which _Emacs_ is a bit special wrt the
user/developer distinction: its _ease_ of
customization/modification/development by users. Emacs has
always had user modification and ease of that as one of its
primary features. It is a poster child for this.
^ permalink raw reply [flat|nested] 5+ messages in thread