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

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

Re: Example use of macro to minimize and generalize the code


From: Yuri Khan
Subject: Re: Example use of macro to minimize and generalize the code
Date: Tue, 1 Jun 2021 23:54:14 +0700

On Tue, 1 Jun 2021 at 23:38, Jean Louis <bugs@gnu.support> wrote:

> > > (defmacro when-tabulated-id (table &rest body)
> > >   (declare (indent 2) (debug t))
> > >   ;;(ignore id)
> > >   `(if id

> > Why don't you consider to make the id a real argument?
>
> I wish I could fully understand but I don't, and I consider your
> advises important.
>
> How would I make the ID a real argument?

I believe Michael is hinting at this:

    (defmacro when-tabulated-id (id table &rest body)
      `(if ,id
           …

which means “at macro expansion time, substitute the value of the
argument to the macro”, rather than your original

    (defmacro when-tabulated-id (id table &rest body)
      `(if id
           …

which means “at evaluation time, substitute the value of the symbol 'id”.



reply via email to

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