unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* Need help with defmacro
@ 2008-01-30 23:58 Lennart Borgman (gmail)
  2008-01-31  4:01 ` Stefan Monnier
  0 siblings, 1 reply; 3+ messages in thread
From: Lennart Borgman (gmail) @ 2008-01-30 23:58 UTC (permalink / raw)
  To: Emacs Devel

When I try to do instrument my-test-err4 below for edebug with

    C-u C-M-x

I get an error saying

     edebug-syntax-error: Invalid read syntax: "Expected", (&rest
         &or (symbolp &optional form) symbolp)

Can someone please explain to me what I have done wrong here?


(defvar mumamo-use-condition-case nil)
(make-variable-buffer-local 'mumamo-use-condition-case)
(put 'mumamo-use-condition-case 'permanent-local t)

(defvar mumamo-debugger 'mumamo-debug-to-backtrace)
(make-variable-buffer-local 'mumamo-debugger)
(put 'mumamo-debugger 'permanent-local t)

(defmacro mumamo-condition-case (var body-form &rest handlers)
   "Like `condition-case', but optional.
If `mumamo-use-condition-case' is nil then just evaluate
BODY. Otherwise do the same thing as

   (condition-case VAR
       BODY
     HANDLERS)."
   (declare (indent 2) (debug let))
   `(if (not mumamo-use-condition-case)
        (let* ((debugger mumamo-debugger)
               (debug-on-error (if debugger t debug-on-error)))
          ,body-form)
     (condition-case ,var
         ,body-form
       ,@handlers)))

(defun my-test-err4 ()
   (interactive)
   (mumamo-condition-case err
       (my-errx)
     (arith-error (message "here"))
     (error (message "%s, %s" err (error-message-string err)))
     ))




^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Need help with defmacro
  2008-01-30 23:58 Need help with defmacro Lennart Borgman (gmail)
@ 2008-01-31  4:01 ` Stefan Monnier
  2008-01-31 22:13   ` Lennart Borgman (gmail)
  0 siblings, 1 reply; 3+ messages in thread
From: Stefan Monnier @ 2008-01-31  4:01 UTC (permalink / raw)
  To: Lennart Borgman (gmail); +Cc: Emacs Devel

> When I try to do instrument my-test-err4 below for edebug with

>    C-u C-M-x

> I get an error saying

>     edebug-syntax-error: Invalid read syntax: "Expected", (&rest
>         &or (symbolp &optional form) symbolp)

> Can someone please explain to me what I have done wrong here?

It's because you've told edebug that mumamo-condition-case has the same
syntax as `let', but then you go on and use it very differently.
You need to fix your `debug' declaration.


        Stefan




^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Need help with defmacro
  2008-01-31  4:01 ` Stefan Monnier
@ 2008-01-31 22:13   ` Lennart Borgman (gmail)
  0 siblings, 0 replies; 3+ messages in thread
From: Lennart Borgman (gmail) @ 2008-01-31 22:13 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: Emacs Devel

Stefan Monnier wrote:
>> When I try to do instrument my-test-err4 below for edebug with
> 
>>    C-u C-M-x
> 
>> I get an error saying
> 
>>     edebug-syntax-error: Invalid read syntax: "Expected", (&rest
>>         &or (symbolp &optional form) symbolp)
> 
>> Can someone please explain to me what I have done wrong here?
> 
> It's because you've told edebug that mumamo-condition-case has the same
> syntax as `let', but then you go on and use it very differently.
> You need to fix your `debug' declaration.


Thanks, I see - at least what to do. But the (debug ...) form is still 
mysterious.




^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2008-01-31 22:13 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-01-30 23:58 Need help with defmacro Lennart Borgman (gmail)
2008-01-31  4:01 ` Stefan Monnier
2008-01-31 22:13   ` Lennart Borgman (gmail)

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

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).