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: Alan Mackenzie
Subject: Re: How does one use a macro in a special form?
Date: Sat, 28 Jun 2003 18:17:36 +0000
User-agent: tin/1.4.5-20010409 ("One More Nightmare") (UNIX) (Linux/2.0.35 (i686))

Daniel Jensen <daniel-news@bigwalter.net> wrote on Sat, 28 Jun 2003
20:00:48 +0200:
> 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.

Many thanks for the chrystal clear answers.  I think for this thing, I'll
just write out the indent-spaces thing in longhand each time I need it.

> Daniel Jensen

-- 
Alan Mackenzie (Munich, Germany)
Email: aacm@muuc.dee; to decode, wherever there is a repeated letter
(like "aa"), remove half of them (leaving, say, "a").



reply via email to

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