[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Placement of list within an interactive clause
From: |
Christopher Dimech |
Subject: |
Re: Placement of list within an interactive clause |
Date: |
Fri, 15 Jul 2022 10:19:22 +0200 |
> Sent: Friday, July 15, 2022 at 7:26 PM
> From: "Jean Louis" <bugs@gnu.support>
> To: carlmarcos@tutanota.com
> Cc: "Help Gnu Emacs" <help-gnu-emacs@gnu.org>
> Subject: Re: Placement of list within an interactive clause
>
> Most of time I do not use `interactive' for supply arguments to
> function.
>
> Thus instead of following:
>
> (defun my-fun-1 (&optional name)
> (interactive "MName: ")
> (message "Hello %s" name))
>
> I am using following:
>
> (defun my-fun-2 (&optional name)
> (interactive)
> (let ((name (or name (read-from-minibuffer "Name: "))))
> (message "Hello %s" name)))
>
> as that gives me little more freedom:
>
> - if I call (my-fun-1) ⇒ "Hello nil" that result is not what I
> really want. It makes it difficult to get the wanted result. To
> get the wanted result I need to use:
>
> (call-interactively 'my-fun-1) ⇒ "Hello Bob"
>
> - but if I call (my-fun-2) and NAME is not supplied, I will be
> asked for name: (my-fun-2) ⇒ "Hello Bob" and will not get "NIL"
> as result. In this case I need not complicate the call and use
> `call-interactively`.
>
> Additionall, complex `interactive` clauses I find often too
> difficult to comprehend than reading the body of the function.
Yes, but you are forced for interactive commands. It is not equivalent
to a function that is non-interactive.
> Fo this reason I recommend using this second approach with (or
> ARGUMENT (GET-ARGUMENT)) rather then using `interactive` with
> purpose to supply arguments.
>
>
> --
> Jean
>
> Take action in Free Software Foundation campaigns:
> https://www.fsf.org/campaigns
>
> In support of Richard M. Stallman
> https://stallmansupport.org/
>
>
- Re: Placement of list within an interactive clause, (continued)
- Re: Placement of list within an interactive clause, carlmarcos, 2022/07/14
- Message not available
- Re: Placement of list within an interactive clause, carlmarcos, 2022/07/16
- Re: Placement of list within an interactive clause, Stefan Monnier, 2022/07/16
- Message not available
- Re: Placement of list within an interactive clause, carlmarcos, 2022/07/16
- Re: Placement of list within an interactive clause, Stefan Monnier, 2022/07/17
- RE: [External] : Re: Placement of list within an interactive clause, Drew Adams, 2022/07/14
- Re: Placement of list within an interactive clause, carlmarcos, 2022/07/14
- RE: [External] : Re: Placement of list within an interactive clause, Drew Adams, 2022/07/14
- Message not available
- RE: [External] : Re: Placement of list within an interactive clause, carlmarcos, 2022/07/15
Re: Placement of list within an interactive clause, Jean Louis, 2022/07/15
- Re: Placement of list within an interactive clause,
Christopher Dimech <=
- Re: Placement of list within an interactive clause, Jean Louis, 2022/07/15
- Re: Placement of list within an interactive clause, Christopher Dimech, 2022/07/15
- Re: Placement of list within an interactive clause, Jean Louis, 2022/07/15
- Re: Placement of list within an interactive clause, carlmarcos, 2022/07/15
- Re: Placement of list within an interactive clause, Jean Louis, 2022/07/15
- Re: Placement of list within an interactive clause, Christopher Dimech, 2022/07/15
- Message not available
- Re: Placement of list within an interactive clause, carlmarcos, 2022/07/16
- Re: Placement of list within an interactive clause, Jean Louis, 2022/07/16
- RE: [External] : Re: Placement of list within an interactive clause, Drew Adams, 2022/07/16
- Re: RE: [External] : Placement of list within an interactive clause, Christopher Dimech, 2022/07/16