[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#17871: 24.4.50; (elisp) `Core Advising Primitives': interactive spec
From: |
Stefan Monnier |
Subject: |
bug#17871: 24.4.50; (elisp) `Core Advising Primitives': interactive spec as function? |
Date: |
Wed, 21 Aug 2019 03:01:23 -0400 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux) |
> (defvar __testvar nil)
>
> (defun __test-command ()
> (interactive (ignore (message "__test-command (interactive): %s"
> __testvar)))
> (message "__test-command (body): %s" __testvar))
>
> (defun __test-advice (orig &rest args)
> (let ((__testvar t))
> (apply orig args)))
>
> (advice-add '__test-command :around #'__test-advice)
>
> Even with the advice, calling __test-command gives:
>
> __test-command (interactive): nil
> __test-command (body): t
>
> I'd expect the advice to have effect on the whole function, including
> the interactive form.
The interactive form is executed to build the args with which the
function will be called (hence your advice is only executed after the
interactive spec), so in order for your code to do what you want,
we'd have to always wrap the interactive spec identically to the body.
Maybe in this case it'd do what you want, but in many other cases
it wouldn't.
Stefan
- bug#17871: 24.4.50; (elisp) `Core Advising Primitives': interactive spec as function?, (continued)
- bug#17871: 24.4.50; (elisp) `Core Advising Primitives': interactive spec as function?, Michael Heerdegen, 2019/08/05
- bug#17871: 24.4.50; (elisp) `Core Advising Primitives': interactive spec as function?, Štěpán Němec, 2019/08/05
- bug#17871: 24.4.50; (elisp) `Core Advising Primitives': interactive spec as function?, Lars Ingebrigtsen, 2019/08/05
- bug#17871: 24.4.50; (elisp) `Core Advising Primitives': interactive spec as function?, Michael Heerdegen, 2019/08/18
- bug#17871: 24.4.50; (elisp) `Core Advising Primitives': interactive spec as function?, Štěpán Němec, 2019/08/18
- bug#17871: 24.4.50; (elisp) `Core Advising Primitives': interactive spec as function?, Lars Ingebrigtsen, 2019/08/18
- bug#17871: 24.4.50; (elisp) `Core Advising Primitives': interactive spec as function?, Štěpán Němec, 2019/08/18
- bug#17871: 24.4.50; (elisp) `Core Advising Primitives': interactive spec as function?, Drew Adams, 2019/08/18
- bug#17871: 24.4.50; (elisp) `Core Advising Primitives': interactive spec as function?, Juri Linkov, 2019/08/20
- bug#17871: 24.4.50; (elisp) `Core Advising Primitives': interactive spec as function?, Štěpán Němec, 2019/08/20
- bug#17871: 24.4.50; (elisp) `Core Advising Primitives': interactive spec as function?,
Stefan Monnier <=
- bug#17871: 24.4.50; (elisp) `Core Advising Primitives': interactive spec as function?, Štěpán Němec, 2019/08/21
- bug#17871: 24.4.50; (elisp) `Core Advising Primitives': interactive spec as function?, Stefan Monnier, 2019/08/25