Re: Advicing the `interactive' form of a command

Roland Winkler <[email protected]>
Newsgroups gmane.emacs.help
Message-ID <[email protected]>
On Sun, May 03 2026, Stefan Monnier via Users list for the GNU Emacs text editor wrote:
> So if you want to apply the let binding to the interactive spec, you
> can do:
>
>     (advice-add 'switch-to-buffer :before
>       (lambda (&rest _)
>         (interactive
>           (lambda (ispec)
>             (let ((confirm-nonexistent-file-or-buffer t))
>               (advice-eval-interactive-spec ispec))))
>         nil))

Thank you, this answers my questions!  Reading the brief discussion of
advice-eval-interactive-spec (that I had missed previously), I would
not have guessed that the above two nested lambdas can modify the interactive
spec of a command.  Maybe one such example can be added to the elisp manual.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.