help-gnu-emacs
[Top][All Lists]
Advanced

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

Re: How does one use a macro in a special form?


From: Daniel Jensen
Subject: Re: How does one use a macro in a special form?
Date: Sat, 28 Jun 2003 20:00:48 +0200
User-agent: Gnus/5.1003 (Gnus v5.10.3) Emacs/21.3.50 (gnu/linux)

Alan Mackenzie<none@example.invalid> writes:

> In particular, I want to use a macro acm-indent++ within a let (or let*),

You can't. Let is a special form and does not follow conventional
evaluation rules.

> The macro acm-indent++ looks like this:
>
> (defmacro acm-indent++ ()
>   "Increase the level of indentation in an acm-printf output by binding 
> indent-spaces.
> This form must appear \"comma\"d in a let/let* variable list."
>   `(indent-spaces (concat indent-spaces "    ")))

Use something like this instead:

(defmacro with-extra-indent-spaces (&rest body)
  `(let ((indent-spaces (concat indent-spaces "    ")))
    ,@body))

(let (...)
  (with-extra-indent-spaces
    ...))

> Question:  does the "," operator have meaning when not within a backquote
> expression?

No. Then it's just a character. It is only an "operator" inside
backquoted forms.

-- 
Daniel Jensen
Editing is a rewording activity.


reply via email to

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