emacs-devel
[Top][All Lists]
Advanced

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

Re: Adding use-package to ELPA


From: Stefan Monnier
Subject: Re: Adding use-package to ELPA
Date: Mon, 07 Mar 2022 16:03:46 -0500
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux)

> True, because the above examples just expands to
>
>       (setq smtpmail-smtp-service 587)
>
> I'd usually recommend to use a local macro to avoid these issues,
> because something like
>
>       (setup smtpmail
>         (:option smtpmail-smtp-service 587))
>
> would expand to a `customize-set-variable'-like code, where
> `smtpmail-smtp-service' would appear as a quoted symbol.

If it expands to `customize-set-variable`, then presumably you wouldn't
get the warning, indeed (that's good) but you also wouldn't get
a warning if you mistype the var (less good).

I want both: absence of warnings when the var name is right, and
presence of a warning when it isn't (and presence of a warning when the
var is obsolete).

>> So `setup.el` could maybe do something like:
>>
>>     (defmacro setup (pkg &rest args)
>>       (when (we-are-byte-compiling-p)
>>         (require (byte-run-strip-symbol-positions pkg)))
>>       ...)
>
> What is the point of using byte-run-strip-symbol-positions here?

Macros receive source code as input, which can/should come with
source-position information.  Before we can safely run that code we need
to strip the position info.

> I just tried something like this, but it doesn't seem to work.

I'm glad to see that I'm still able to write incorrect code.


        Stefan




reply via email to

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