emacs-devel
[Top][All Lists]
Advanced

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

Re: debug declaration.


From: Stefan Monnier
Subject: Re: debug declaration.
Date: Wed, 23 Mar 2005 13:18:32 -0500
User-agent: Gnus/5.11 (Gnus v5.11) Emacs/22.0.50 (gnu/linux)

> (declare (debug (sexp form form form form form &optional stringp)))

> X(define-generic-mode my-mode
>   (list ?# ?% (+ 50 9))
>   (list "abba" "ebbe" (concat "ob" "bo"))
>   nil
>   X(list "\\.mm\\'")X
>   nil
>   "This is My mode.")X

That's because when you execute the call to define-generic-mode, only the
fourth argument is actually evaluated.  All the others will only be
evaluated when the defined function is actually called.  I.e. it's normal.

OTOH, with your definition you'll get bugs when you actually call my-mode
because the instrumented code that's then executed is executed in an
environment where edebugging is not expected.  To fix this problem, you need
to use `def-form' instead of `form' for them.

Try (debug (sexp def-form def-form def-form form def-form [&optional stringp]))

Another option is to evaluate those arguments before you plug them in the
body of your major mode function, so they're only evaluated once, when
the major mode is defined, thus reproducing the "pre-macro" behavior.


        Stefan




reply via email to

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