[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Making a function than can only be used interactively
From: |
Stefan Monnier |
Subject: |
Re: Making a function than can only be used interactively |
Date: |
Mon, 04 Jul 2022 16:45:21 -0400 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux) |
>> More seriously, what are you trying to gain by "mak[ing] a function
>> interactive only"?
> For instance, writing an interactive wrapper function calling a
> non-interactive
> mother function.
A common enough case, which you can do just fine without having to
prevent non-interactive calls to the interactive wrapper.
> Technically, you can use `completing-read` and `read-from-minibuffer` if
> you'd also
> like to set values interactively, while calling the function
> non-interactively.
You mean you can turn
(defun foo (a b c)
(interactive ...)
...)
into
(defun foo ()
(interactive)
(let ((a ...)
(b ...)
(c ...))
...))
Indeed. It's usually discouraged because it's incompatible with
non-interactive uses of the function, but in the case under discussion
you don't care about that because you already have another function to
use for non-interactive calls.
> I am not sure if in practice that is ever desired.
It's done occasionally, typically in cases where it's difficult to
cleanly separate the part of the code that prompts the user from the
part that actually performs the desired operation.
Stefan
- Re: Making a function than can only be used interactively, (continued)
- Message not available
- Re: Making a function than can only be used interactively, carlmarcos, 2022/07/04
- Re: Making a function than can only be used interactively, Tassilo Horn, 2022/07/04
- Re: Making a function than can only be used interactively, Christopher Dimech, 2022/07/04
- Re: Making a function than can only be used interactively, Stefan Monnier, 2022/07/04
- Re: Making a function than can only be used interactively, Robert Pluim, 2022/07/04
- Re: Making a function than can only be used interactively, Christopher Dimech, 2022/07/04
- Re: Making a function than can only be used interactively, Jean Louis, 2022/07/05
- Re: Making a function than can only be used interactively, carlmarcos, 2022/07/04
- Re: Making a function than can only be used interactively, Stefan Monnier, 2022/07/04
- Re: Making a function than can only be used interactively, carlmarcos, 2022/07/04
- Re: Making a function than can only be used interactively,
Stefan Monnier <=
- Re: Making a function than can only be used interactively, Jean Louis, 2022/07/05
- Re: Making a function than can only be used interactively, Christopher Dimech, 2022/07/06
- Re: Making a function than can only be used interactively, Jean Louis, 2022/07/07
- Re: Making a function than can only be used interactively, Christopher Dimech, 2022/07/07
- Re: Making a function than can only be used interactively, carlmarcos, 2022/07/07
- Re: Making a function than can only be used interactively, Emanuel Berg, 2022/07/07
- Re: Making a function than can only be used interactively, carlmarcos, 2022/07/07
- Re: Making a function than can only be used interactively, Emanuel Berg, 2022/07/07
- Re: Making a function than can only be used interactively, Yuri Khan, 2022/07/08
- Re: Making a function than can only be used interactively, Emanuel Berg, 2022/07/08