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


Message #8 received at 59820 <at> debbugs.gnu.org (full text, mbox):

From: Stefan Kangas <stefankangas <at> gmail.com>
To: daanturo <daanturo <at> gmail.com>
Cc: 59820 <at> debbugs.gnu.org, Stefan Monnier <monnier <at> iro.umontreal.ca>
Subject: Re: bug#59820: [PATCH] * nadvice/nadvice.el: support non-symbol
 (closure/lambda) advices (old Emacs)
Date: Mon, 12 Dec 2022 17:04:01 -0800
daanturo <daanturo <at> gmail.com> writes:

> This patch provides the ELPA version (for Emacs < 24.4) of nadvice.el's
> advice-add the ability to handle anonymous advices.
>
> I have tested with a simple example:
>
> ```emacs-lisp
>
> (let* ((sym (make-symbol "nadvice λ")))
>   (defalias sym (lambda (&rest args) '(1)))
>   (advice-add sym :around (lambda (func &rest args)
>                             (append (apply func args) '(2))))
>   (vector
>    ;; advised returned value
>    (funcall sym)
>    (progn
>      (advice-remove sym (lambda (func &rest args)
>                           (append (apply func args) '(2))))
>      ;; unadvised returned value
>      (funcall sym))))
>
> ;; => [(1 2) (1)]
>
> ```

Stefan, any comments here?




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.