unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#14317: 24.3.50; nadvice.el: named advices not upgradable
@ 2013-04-29 23:42 Michael Heerdegen
  2013-05-03  1:20 ` Michael Heerdegen
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Michael Heerdegen @ 2013-04-29 23:42 UTC (permalink / raw)
  To: 14317


Hi Stefan,

if you have some code adding advices that can be identified (i.e.,
adding named advices or fbound symbols, not anonymous functions),
and you change this code defining the advice and re-evaluate, the change
doesn't take effect (in contrast to the behavior of advice.el).

We currently use this:

--8<---------------cut here---------------start------------->8---
(defun advice--add-function (where ref function props)
  (unless (advice--member-p function (cdr (assq 'name props))
                            (gv-deref ref))
    (setf (gv-deref ref)
          (advice--make where function (gv-deref ref) props))))
--8<---------------cut here---------------end--------------->8---

but as a user, I would suspect something like

--8<---------------cut here---------------start------------->8---
(defun advice--add-function (where ref function props)
  (when (advice--member-p function (cdr (assq 'name props))
                          (gv-deref ref))
    (advice--remove-function .........))
  (setf (gv-deref ref)
        (advice--make where function (gv-deref ref) props)))
--8<---------------cut here---------------end--------------->8---

i.e., replacing the old code, instead of doing nothing.

Is the current behavior intended?  If not, can we change it?


Regards,

Michael.









^ permalink raw reply	[flat|nested] 4+ messages in thread

* bug#14317: 24.3.50; nadvice.el: named advices not upgradable
  2013-04-29 23:42 bug#14317: 24.3.50; nadvice.el: named advices not upgradable Michael Heerdegen
@ 2013-05-03  1:20 ` Michael Heerdegen
  2013-05-05  5:49 ` Stefan Monnier
  2013-05-06 15:27 ` Stefan Monnier
  2 siblings, 0 replies; 4+ messages in thread
From: Michael Heerdegen @ 2013-05-03  1:20 UTC (permalink / raw)
  To: 14317

Michael Heerdegen <michael_heerdegen@web.de> writes:

> but as a user, I would suspect something like
>
> (defun advice--add-function (where ref function props)
>   (when (advice--member-p function (cdr (assq 'name props))
>                           (gv-deref ref))
>     (advice--remove-function .........))
>   (setf (gv-deref ref)
>         (advice--make where function (gv-deref ref) props)))
>
> i.e., replacing the old code, instead of doing nothing.

We should probably distinguish between named functions and
named advice.  I mean, it's probably stupid to remove and add
back an fboundp symbol - but you get the idea...


Regards,

Michael.





^ permalink raw reply	[flat|nested] 4+ messages in thread

* bug#14317: 24.3.50; nadvice.el: named advices not upgradable
  2013-04-29 23:42 bug#14317: 24.3.50; nadvice.el: named advices not upgradable Michael Heerdegen
  2013-05-03  1:20 ` Michael Heerdegen
@ 2013-05-05  5:49 ` Stefan Monnier
  2013-05-06 15:27 ` Stefan Monnier
  2 siblings, 0 replies; 4+ messages in thread
From: Stefan Monnier @ 2013-05-05  5:49 UTC (permalink / raw)
  To: Michael Heerdegen; +Cc: 14317

> if you have some code adding advices that can be identified (i.e.,
> adding named advices or fbound symbols, not anonymous functions),
> and you change this code defining the advice and re-evaluate, the change
> doesn't take effect (in contrast to the behavior of advice.el).

I think what you ask makes sense, yes.


        Stefan "no time to do it now, tho"





^ permalink raw reply	[flat|nested] 4+ messages in thread

* bug#14317: 24.3.50; nadvice.el: named advices not upgradable
  2013-04-29 23:42 bug#14317: 24.3.50; nadvice.el: named advices not upgradable Michael Heerdegen
  2013-05-03  1:20 ` Michael Heerdegen
  2013-05-05  5:49 ` Stefan Monnier
@ 2013-05-06 15:27 ` Stefan Monnier
  2 siblings, 0 replies; 4+ messages in thread
From: Stefan Monnier @ 2013-05-06 15:27 UTC (permalink / raw)
  To: Michael Heerdegen; +Cc: 14317-done

> Is the current behavior intended?  If not, can we change it?

Changed, thanks,


        Stefan





^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2013-05-06 15:27 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-04-29 23:42 bug#14317: 24.3.50; nadvice.el: named advices not upgradable Michael Heerdegen
2013-05-03  1:20 ` Michael Heerdegen
2013-05-05  5:49 ` Stefan Monnier
2013-05-06 15:27 ` Stefan Monnier

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).