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: Jean Louis
Subject: Re: Example use of macro to minimize and generalize the code
Date: Tue, 1 Jun 2021 04:25:33 +0300
User-agent: Mutt/2.0.7+183 (3d24855) (2021-05-28)

* Michael Heerdegen <michael_heerdegen@web.de> [2021-06-01 04:00]:
> Jean Louis <bugs@gnu.support> writes:
> 
> > - ID is necessary;
> 
> Your macro calls always ignore what you specify at that argument's
> position.  Instead, the macros refer to a (free) variable `id'.  AFAICT,
> with your current implementation nothing would change if you would
> remove the macro argument (and the `ignore' call) and simply don't use
> it.
> 
> Typically, the backquote expression in the macro body would have ",id"
> instead of "id" to include the value specified by the ID argument.  The
> compiler warning is not just noise.

I do believe you see it what you say, but I didn't see what you
say... (✿╹◡╹) -- so yes, now it works, thanks.

I have removed `id' and `ignore' and there are no compiler warnings
and there is for now no impact how I see that. That comes due to
various testing, I have actually started it that way, there was no ID,
then I messed something up and addedd ID and now you see more, and I
removed it from bunch of functions. For now it works.

(defmacro when-tabulated-id (table &rest body)
  (declare (indent 2) (debug t))
  ;;(ignore id)
  `(if id
       (progn
         ,@body)
     (if (or (eq ,table 'any)
             (string-equal ,table rcd-current-table))
         (let ((id (tabulated-list-get-id)))
           (if id
               (progn ,@body)
             (message "Did not get ID")))
       (message "This function is for table `%s' only" ,table))))

-- 
Jean

Take action in Free Software Foundation campaigns:
https://www.fsf.org/campaigns

Sign an open letter in support of Richard M. Stallman
https://stallmansupport.org/



reply via email to

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