emacs-devel
[Top][All Lists]
Advanced

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

Re: Last use of defadvice in Emacs


From: Stefan Monnier
Subject: Re: Last use of defadvice in Emacs
Date: Fri, 08 Apr 2022 13:39:58 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux)

>>     (defmacro url-http-ntlm--if-when-compile (cond &rest body)
>>       (declare (debug t) (indent 1))
>>       (when (eval cond)
>>         `(progn ,@body)))
>
>>     ;; Remove authorization after redirect.
>>     (url-http-ntlm--if-when-compile
>>         (and (boundp 'emacs-major-version)
>>       (< emacs-major-version 25))
>>       ...
>>       ... Various code, including, incidentally, a `defadvice` ...
>>       ...)
>
> Here, a piece of `byte-code' gets compiled for the
> url-http-ntlm--if-when-compile call.  This is useless code without any
> useful function.  (I've just tried it.)

That bytecode implements your #if feature.  So if we care about that
feature, we'd remove the `url-http-ntlm--` prefix and move it to
lisp/subr.el, indeed.

I agree that Emacs does not come with the equivalent of #if but the
above macro shows that it can be implemented quite easily if we care to
provide it.

> I haven't been able to find AUCTeX's source code yet, but I'm not sure
> this macro would meet the "no code at all" criterion, either.

Again it depends if you count the code of the macro itself (which
currently lives in AUCTeX but is fundamentally generic so could be
moved to `subr.el`) rather than
only the code resulting from the macroexpansion.


        Stefan




reply via email to

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