[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Making a function than can only be used interactively
From: |
Jean Louis |
Subject: |
Re: Making a function than can only be used interactively |
Date: |
Tue, 5 Jul 2022 20:35:01 +0300 |
User-agent: |
Mutt/+ () (2022-06-11) |
* Christopher Dimech <dimech@gmx.com> [2022-07-05 00:41]:
> (defun foo (a b c)
> (interactive ...)
>
> (if (equal a 1)
> (let* (h (read-from-minibuffer ...))
> ... ))
> ...)
>
> Although discouraged, the above could make sense, but completely wrong to use
> non-interactively.
I think it is OK to use it non-interactively.
`interactive' description says "Specify a way of parsing arguments for
interactive use of a function."
See (info "(elisp) Using Interactive")
Here is sample function that I use:
(defun cf-hyperscope-assign-tasks-for-many (&optional id)
"Assign tasks with information of many contacts"
(interactive)
(when-tabulated-id "people"
(let* ((assignee (cf-people-search-id nil "Assign to which person? "))
(task (rcd-ask "Describe the task to be assigned: "))
(prefix (rcd-ask "Prefix for task: " "Call"))
(set (hyperscope-select-set)))
(rcd-tabulated-iterate-generic
id
(lambda (id)
(let* ((name (concat prefix " " (cf-full-contact-name id)))
(description (concat "⟦
(hyperscope-related-contact-contacts-information hyperscope-current-id) ⟧\n\n"
task))
(hyperscope-id (hyperscope-add-generic name "" nil 31 10 set
nil description nil id assignee)))
(hlink-update-action-status-1 hyperscope-id 2)))
"Assign Tasks"))))
And I may as well invoke function non-interactively, when there is
`interactive`, it means it is a command and accessible through M-x and
may be bound to keys.
--
Jean
Take action in Free Software Foundation campaigns:
https://www.fsf.org/campaigns
In support of Richard M. Stallman
https://stallmansupport.org/
- Re: Making a function than can only be used interactively, (continued)
- Re: Making a function than can only be used interactively, carlmarcos, 2022/07/03
- Re: Making a function than can only be used interactively, Stefan Monnier, 2022/07/03
- Re: Making a function than can only be used interactively, carlmarcos, 2022/07/03
- Re: Making a function than can only be used interactively, Stefan Monnier, 2022/07/03
- 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 <=
- 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, 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, 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