[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Emacs 25.0.04: Feature Request: Make called-interactively-p's argume
From: |
Noam Postavsky |
Subject: |
Re: Emacs 25.0.04: Feature Request: Make called-interactively-p's argument optional |
Date: |
Tue, 5 Jul 2016 20:24:52 -0400 |
On Tue, Jul 5, 2016 at 8:09 PM, John Wiegley <address@hidden> wrote:
> Simple and common patterns should be simple, because they are common.
The simplest way to do this if you don't care about the
distinction between (called-interactively 'any)
and (called-interactively 'interactive) is to add an argument
that is set to non-nil by the interactive spec, as described in
the manual:
The recommended way to test whether the function was called using
‘call-interactively’ is to give it an optional argument
‘print-message’ and use the ‘interactive’ spec to make it
non-‘nil’ in interactive calls. Here’s an example:
(defun foo (&optional print-message)
(interactive "p")
(when print-message
(message "foo")))
We use ‘"p"’ because the numeric prefix argument is never ‘nil’.
Defined in this way, the function does display the message when
called from a keyboard macro.
The above method with the additional argument is usually best,
because it allows callers to say “treat this call as interactive”.
- Re: Emacs 25.0.04: Feature Request: Make called-interactively-p's argument optional, (continued)
- Re: Emacs 25.0.04: Feature Request: Make called-interactively-p's argument optional, John Wiegley, 2016/07/05
- Re: Emacs 25.0.04: Feature Request: Make called-interactively-p's argument optional, Dmitry Gutov, 2016/07/05
- Re: Emacs 25.0.04: Feature Request: Make called-interactively-p's argument optional, John Wiegley, 2016/07/05
- Re: Emacs 25.0.04: Feature Request: Make called-interactively-p's argument optional, raman, 2016/07/05
- Re: Emacs 25.0.04: Feature Request: Make called-interactively-p's argument optional, Dmitry Gutov, 2016/07/05
- Re: Emacs 25.0.04: Feature Request: Make called-interactively-p's argument optional, Eli Zaretskii, 2016/07/06
- Re: Emacs 25.0.04: Feature Request: Make called-interactively-p's argument optional, raman, 2016/07/06
- Re: Emacs 25.0.04: Feature Request: Make called-interactively-p's argument optional, Eli Zaretskii, 2016/07/06
- Re: Emacs 25.0.04: Feature Request: Make called-interactively-p's argument optional, Robert Weiner, 2016/07/06
Re: Emacs 25.0.04: Feature Request: Make called-interactively-p's argument optional,
Noam Postavsky <=