[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Prefix Argument and optional argument
From: |
Bruno Barbier |
Subject: |
Re: Prefix Argument and optional argument |
Date: |
Tue, 05 Jul 2022 08:52:05 +0200 |
carlmarcos--- via Users list for the GNU Emacs text editor
<help-gnu-emacs@gnu.org> writes:
> I am having difficulty figuring out any problems associated with the
> following two functions.
>
> Can one safely call "M-x name", "C-u M-x name", "C-u 2 M-x name", where name
> is either
> `poke' or `poke-opt'.
>
> (defun poke (prefix)
> "TODO."
> (interactive "P")
> ...)
You should compile your code; Emacs will say:
Warning: misplaced interactive spec: ‘(interactive P)’
>
> (defun poke-opt (&optional prefix)
> "TODO."
> (interactive "P")
> ...)
This version is OK. You can call it "M-x name", "C-u M-x name", "C-u 2
M-x name"; wether it's safe or not depends on its body though ;-)
Bruno
- Prefix Argument and optional argument, carlmarcos, 2022/07/04
- Message not available
- Message not available
- Re: Prefix Argument and optional argument, carlmarcos, 2022/07/06
- Re: Prefix Argument and optional argument, Michael Heerdegen, 2022/07/07
- Re: Prefix Argument and optional argument, Emanuel Berg, 2022/07/07
- Re: Prefix Argument and optional argument, Emanuel Berg, 2022/07/07
- Re: Prefix Argument and optional argument, Michael Heerdegen, 2022/07/07