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

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

bug#44864: 27.1; advice.el: ad-with-originals deprecated, but no advice


From: Stefan Monnier
Subject: bug#44864: 27.1; advice.el: ad-with-originals deprecated, but no advice on replacement
Date: Thu, 26 Nov 2020 10:39:10 -0500
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux)

>             ;; Use file's local variables section to set variables in
>             ;; this buffer.  (Don't just copy local variables from the
>             ;; base buffer because it may have set things locally that
>             ;; we don't want in the other modes.)  We need to prevent
>             ;; `mode' being processed and re-setting the major mode.
>             ;; It all goes badly wrong if `hack-one-local-variable' is
>             ;; advised.  The appropriate mechanism to get round this
>             ;; appears to be `ad-with-originals', but we don't want to
>             ;; pull in the advice package unnecessarily.  `flet'-like
>             ;; mechanisms lose with advice because `fset' acts on the
>             ;; advice anyway.
>             (if (featurep 'advice)
>                 (ad-with-originals (hack-one-local-variable)
>                   (multi-hack-local-variables))
>               (multi-hack-local-variables))

The comment doesn't explain why Dave thought that "It all goes badly
wrong if `hack-one-local-variable' is advised", so there's not much we
can do.  AFAIK it will only go wrong with some advice, so he must have
had some particular pieces of advice in mind.

`advice.el` is deprecated anyway, so my recommendation is to remove this
test and just call `multi-hack-local-variables` without paying attention
to any potential advice there.  If/when you bump into a problem with
that, then we'll be able to see what should be done (the best option
might be to change the advice itself).

> But there is no advice on what to do instead.

I think that's because `ad-with-originals` was used on it ;-)


        Stefan






reply via email to

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