GNU bug report logs - #59820
[PATCH] * nadvice/nadvice.el: support non-symbol (closure/lambda) advices (old Emacs)

Previous Next

Package: emacs;

Reported by: daanturo <daanturo <at> gmail.com>

Date: Sun, 4 Dec 2022 17:16:02 UTC

Severity: wishlist

Tags: moreinfo, patch

Full log


View this message in rfc822 format

From: Daan Ro <daanturo <at> gmail.com>
To: Stefan Monnier <monnier <at> iro.umontreal.ca>
Cc: 59820 <at> debbugs.gnu.org, Stefan Kangas <stefankangas <at> gmail.com>
Subject: bug#59820: [PATCH] * nadvice/nadvice.el: support non-symbol (closure/lambda) advices (old Emacs)
Date: Tue, 13 Dec 2022 22:02:51 +0700
[Message part 1 (text/plain, inline)]
Use `warn` instead of `message`.

On Tue, Dec 13, 2022 at 9:59 PM daanturo <daanturo <at> gmail.com> wrote:

> > I usually recommend to use named
> > functions for advice anyway
>
> How about we still allow but warn against such problematic usage?
>
>
> On 13/12/2022 20:50, Stefan Monnier wrote:
> >> This patch provides the ELPA version (for Emacs < 24.4) of nadvice.el's
> >> advice-add the ability to handle anonymous advices.
> > [...]
> >> +(defun advice--ensure-symbol (func)
> >> +  (if (symbolp func)
> >> +      func
> >> +    (let* ((sym (intern (format "%S" func))))
> >> +      (unless (fboundp sym)
> >> +        (defalias sym func))
> >> +      sym)))
> > I'm not a big fan of this approach, and I usually recommend to use named
> > functions for advice anyway (avoids all kinds of problems like the
> > `advice-remove` failing to remove, or the equality test taking too much
> > time, ...).
> >
> > IOW I'd rather align the "real nadvice.el" with the one in GNU ELPA than
> > the other way around in this respect.
> >
> >
> >         Stefan
> >
> --
> Daanturo.
>


-- 
Daanturo.
[Message part 2 (text/html, inline)]
[0002-nadvice-nadvice.el-warn-against-non-symbol-FUNCTIONs.patch (text/x-patch, attachment)]

This bug report was last modified 1 year and 251 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.