[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#59820: [PATCH] * nadvice/nadvice.el: support non-symbol (closure/lam
From: |
daanturo |
Subject: |
bug#59820: [PATCH] * nadvice/nadvice.el: support non-symbol (closure/lambda) advices (old Emacs) |
Date: |
Mon, 5 Dec 2022 00:14:49 +0700 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.5.1 |
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)]
```
In GNU Emacs 24.3.1 (x86_64-redhat-linux-gnu, GTK+ Version 3.22.30)
of 2020-04-04 on x86-01.bsys.centos.org
Windowing system distributor `The X.Org Foundation', version
11.0.12201005
Configured using:
`configure '--build=x86_64-redhat-linux-gnu'
'--host=x86_64-redhat-linux-gnu' '--program-prefix='
'--disable-dependency-tracking' '--prefix=/usr' '--exec-prefix=/usr'
'--bindir=/usr/bin' '--sbindir=/usr/sbin' '--sysconfdir=/etc'
'--datadir=/usr/share' '--includedir=/usr/include'
'--libdir=/usr/lib64' '--libexecdir=/usr/libexec'
'--localstatedir=/var' '--sharedstatedir=/var/lib'
'--mandir=/usr/share/man' '--infodir=/usr/share/info' '--with-dbus'
'--with-gif' '--with-jpeg' '--with-png' '--with-rsvg' '--with-tiff'
'--with-xft' '--with-xpm' '--with-x-toolkit=gtk3' '--with-gpm=no'
'build_alias=x86_64-redhat-linux-gnu'
'host_alias=x86_64-redhat-linux-gnu' 'CFLAGS=-DMAIL_USE_LOCKF -O2 -g
-pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions
-fstack-protector-strong --param=ssp-buffer-size=4
-grecord-gcc-switches -m64 -mtune=generic' 'LDFLAGS=-Wl,-z,relro ''
--
Daanturo.
0001-nadvice-nadvice.el-support-non-symbol-advices.patch
Description: Text Data
- bug#59820: [PATCH] * nadvice/nadvice.el: support non-symbol (closure/lambda) advices (old Emacs),
daanturo <=