[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#17871: 24.4.50; (elisp) `Core Advising Primitives': interactive spec
From: |
Michael Heerdegen |
Subject: |
bug#17871: 24.4.50; (elisp) `Core Advising Primitives': interactive spec as function? |
Date: |
Mon, 05 Aug 2019 08:26:03 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux) |
Lars Ingebrigtsen <larsi@gnus.org> writes:
> Michael Heerdegen <michael_heerdegen@web.de> writes:
>
> > I guess SPEC is never functionp, at least after that change. By
> > skimming over the code, the
> >
> > (interactive (lambda (old-interactive-form) ...))
> >
> > case is transformed by `advice--make-interactive-form' to something else
> > that is not a function, and apart from this, interactive specs are never
> > functionp.
>
> Ah, right. But since `advice--make-interactive-form' does the
> transform, then I guess functionp interactive specs in advice is still
> allowed?
Would surprise me if not.
> And then we should add an example in the manual, I think. Anybody got
> one? :-)
If nobody suggests a nice one (the one by Štěpán is not bad), we could
construct one deriving from the following typical use cases:
(1) Changing how input is read for a single command. Štěpán's example
is such a thing. Make individual commands use helm or ido or icicles,
or single command not use helm or ido or icicles although the according
mode is turned on, is a use case.
(2) Enhance a command to accept an additional argument. The interactive
form of the :around advice will reuse the interactive form of the
original command to read in the arguments the original command accepts,
read in the additional argument, and return the combined list.
(3) Make input reading saver: If certain input for a command is
potentially dangerous or error-prone, one could change it to add tests/
ask for confirmation, or run it in a loop y (confirm) n (abort) r
(retry, give new input).
I think (2) could provide a nice playground example if no one suggests
something nice real-life.
Michael.
- bug#17871: 24.4.50; (elisp) `Core Advising Primitives': interactive spec as function?, Lars Ingebrigtsen, 2019/08/04
- bug#17871: 24.4.50; (elisp) `Core Advising Primitives': interactive spec as function?, Michael Heerdegen, 2019/08/04
- bug#17871: 24.4.50; (elisp) `Core Advising Primitives': interactive spec as function?, Lars Ingebrigtsen, 2019/08/04
- bug#17871: 24.4.50; (elisp) `Core Advising Primitives': interactive spec as function?, Štěpán Němec, 2019/08/04
- bug#17871: 24.4.50; (elisp) `Core Advising Primitives': interactive spec as function?,
Michael Heerdegen <=
- 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, 2019/08/21