[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Prefix Argument and optional argument
From: |
carlmarcos |
Subject: |
Re: Prefix Argument and optional argument |
Date: |
Wed, 6 Jul 2022 23:18:49 +0200 (CEST) |
Jul 5, 2022, 20:26 by help-gnu-emacs@gnu.org:
> Jul 5, 2022, 06:52 by brubar.cs@gmail.com:
>
>> 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)’
>>
Why is it that a warning is shown, what is the problem with it. Why should it
only be optional?
> I did call `M-x byte-compile-file file' but did not get the warning you
> desrcibe.
>
>
>>>
>>> (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
>>
Why using &optional is ok, but not ok without it?
- Prefix Argument and optional argument, carlmarcos, 2022/07/04
- Message not available
- Message not available
- Re: Prefix Argument and optional argument,
carlmarcos <=
- 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
- Re: Prefix Argument and optional argument, Christopher Dimech, 2022/07/07
- Re: Prefix Argument and optional argument, Michael Heerdegen, 2022/07/07
- Re: Prefix Argument and optional argument, Christopher Dimech, 2022/07/07
- Re: Prefix Argument and optional argument, Michael Heerdegen, 2022/07/07
- Re: Prefix Argument and optional argument, Christopher Dimech, 2022/07/07
- Re: Prefix Argument and optional argument, Michael Heerdegen, 2022/07/07