* Debugging byte compiled files
@ 2006-03-04 16:54 Phillip Lord
0 siblings, 0 replies; 6+ messages in thread
From: Phillip Lord @ 2006-03-04 16:54 UTC (permalink / raw)
I've recently found a bug in my own pabbrev.el package. It's taken
me so long because it only occurs when the file is byte compiled
and I don't routinely byte compile my own packages.
I think that the problem is coming from this macro...
(defmacro pabbrev-save-buffer-modified-p (&rest body)
"Eval BODY without affected buffer modification status"
`(let ((buffer-modified (buffer-modified-p)))
,@body
(set-buffer-modified-p buffer-modified)))
the backtrace looks something like this...
(macro . #[(&rest body) "\301\302\303\b\304\"BB\207" [body let
((buffer-modified (buffer-modified-p))) append ((set-buffer-modified-p
buffer-modified))] 5 ("/home/oub/emacs/site-lisp/versch/pabbrev.elc" .
17814)])
Backtrace is:
backtrace()
pabbrev-command-hook-fail((invalid-function (macro . #[...
"\301\302\303\b\304\"BB\207" [body let ... append ...] 5 ...])) "pre")
pabbrev-pre-command-hook()
run-hooks(pre-command-hook)
I have no real clear idea how to debug this. The error happens
frequently
but not repeatedly, and it all happens in the pre-command-hook. It has
never occurred to me without byte compilation.
Has anyone got any idea how I go about finding out what the problem is?
Cheers
Phil
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Debugging byte compiled files
[not found] <mailman.602.1141491264.5838.help-gnu-emacs@gnu.org>
@ 2006-03-04 23:33 ` John Paul Wallington
2006-03-06 8:51 ` Stefan Monnier
1 sibling, 0 replies; 6+ messages in thread
From: John Paul Wallington @ 2006-03-04 23:33 UTC (permalink / raw)
"Phillip Lord" <Phillip.Lord@newcastle.ac.uk> writes:
> I've recently found a bug in my own pabbrev.el package. It's taken
> me so long because it only occurs when the file is byte compiled
> and I don't routinely byte compile my own packages.
>
> I think that the problem is coming from this macro...
>
> (defmacro pabbrev-save-buffer-modified-p (&rest body)
[...]
Does the `defmacro' form occur before its use within your library ?
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Debugging byte compiled files
[not found] <mailman.602.1141491264.5838.help-gnu-emacs@gnu.org>
2006-03-04 23:33 ` John Paul Wallington
@ 2006-03-06 8:51 ` Stefan Monnier
1 sibling, 0 replies; 6+ messages in thread
From: Stefan Monnier @ 2006-03-06 8:51 UTC (permalink / raw)
> pabbrev-command-hook-fail((invalid-function (macro . #[...
This class of errors means invariably that a call to macro F was
byte-compiled while Emacs didn't know that F was going to be defined as
a macro rather than a function.
I.e. the macro didn't exist yet.
Either because it's defined later in the file, or because of a missing
`require'.
Stefan
^ permalink raw reply [flat|nested] 6+ messages in thread
* RE: Debugging byte compiled files
@ 2006-03-07 18:48 Phillip Lord
2006-03-07 19:16 ` John Paul Wallington
0 siblings, 1 reply; 6+ messages in thread
From: Phillip Lord @ 2006-03-07 18:48 UTC (permalink / raw)
John Paul Wallington wrote:
> "Phillip Lord" <Phillip.Lord@newcastle.ac.uk> writes:
>
>> I've recently found a bug in my own pabbrev.el package. It's taken me
>> so long because it only occurs when the file is byte compiled and I
>> don't routinely byte compile my own packages.
>>
>> I think that the problem is coming from this macro...
>>
>> (defmacro pabbrev-save-buffer-modified-p (&rest body) [...]
>
> Does the `defmacro' form occur before its use within your library ?
There is a single use of the macro before its use. You question
suggests to me that this is a bad thing?
Phil
^ permalink raw reply [flat|nested] 6+ messages in thread
* RE: Debugging byte compiled files
@ 2006-03-07 18:51 Phillip Lord
0 siblings, 0 replies; 6+ messages in thread
From: Phillip Lord @ 2006-03-07 18:51 UTC (permalink / raw)
Stefan Monnier wrote:
>> pabbrev-command-hook-fail((invalid-function (macro . #[...
>
> This class of errors means invariably that a call to macro F was
> byte-compiled while Emacs didn't know that F was going to be defined
> as a macro rather than a function. I.e. the macro didn't exist yet.
> Either because it's defined later in the file, or because of a
> missing `require'.
>
There you go. Learn something every day. I didn't think that the
order made any difference.
I'd put you in the acknowledgements of pabbrev for helping me out,
but you're already there!
Cheers
Phil
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Debugging byte compiled files
2006-03-07 18:48 Debugging byte compiled files Phillip Lord
@ 2006-03-07 19:16 ` John Paul Wallington
0 siblings, 0 replies; 6+ messages in thread
From: John Paul Wallington @ 2006-03-07 19:16 UTC (permalink / raw)
Cc: help-gnu-emacs
> >> I think that the problem is coming from this macro...
> >>
> >> (defmacro pabbrev-save-buffer-modified-p (&rest body) [...]
> >
> > Does the `defmacro' form occur before its use within your library ?
>
>
> There is a single use of the macro before its use. You question
> suggests to me that this is a bad thing?
Yup. Sorry for not being clear. Stefan has already explained the
problem really well. See also (elisp) Compiling Macros:
"In order for compilation of macro calls to work, the macros must
already be defined in Lisp when the calls to them are compiled. The
compiler has a special feature to help you do this: if a file being
compiled contains a `defmacro' form, the macro is defined temporarily
for the rest of the compilation of that file. To make this feature
work, you must put the `defmacro' in the same file where it is used,
and before its first use."
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2006-03-07 19:16 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-03-07 18:48 Debugging byte compiled files Phillip Lord
2006-03-07 19:16 ` John Paul Wallington
-- strict thread matches above, loose matches on Subject: below --
2006-03-07 18:51 Phillip Lord
[not found] <mailman.602.1141491264.5838.help-gnu-emacs@gnu.org>
2006-03-04 23:33 ` John Paul Wallington
2006-03-06 8:51 ` Stefan Monnier
2006-03-04 16:54 Phillip Lord
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).