emacs-devel
[Top][All Lists]
Advanced

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

Re: cl-macs: default indentation for all arglists with top-level &body


From: Stefan Monnier
Subject: Re: cl-macs: default indentation for all arglists with top-level &body
Date: Sun, 11 Apr 2021 12:23:45 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux)

>   ;; Placing the declaration in the end
>   ;; allows overriding the indentation setting
>   ;; with an explicit (declare (indent ..)) statement
>   ;; manually written in the form being expanded.
>   (setq header
>         (nconc header
>                (list
>                 `(declare (indent ,according-to-&body))))))

I see one "problem" with this: it provides the `indent` but not the
`debug` spec.  Maybe another way to go about it is to try and infer the
`indent` spec from the `debug` spec (since I think it's hopeless to try
and guess the debug spec from the arglist).

> The feature was
> - suggested to be applied to usual ~defmacro~ as well
> - not implemented as there is no ~&body~ in ~defmacro~
> - apparently shelved and then forgotten about
>
> I only suggest to alter ~cl-defmacro~.

It would clearly be a lot more useful to make it work for `defmacro` as
well since the very vast majority of macros are defined with `defmacro`.

> As to whether the macro better inject ~(put ..)~ or ~(declare ..)~ form,
> my preference is for the latter because

FWIW, I think injecting `declare` is cleaner, indeed (but of course it
needs to be careful not to override a pre-existing `declare`).


        Stefan




reply via email to

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