I have an interactive function taking 2 arguments. I can read them with
(defun example-fct (arg1 arg2)
"This function take two arguments"
(interactive
(let ((arg1 (read-string "Arg1: "))
(arg2 (read-string "Arg2: ")))
(list arg1 arg2)))
(message (format "input arg1=%s arg2=%s" arg1 arg2)))
Most of the time arg2
does not need to be entered. The default value is appropriate, and the second read is boring.
So I would prefer ask for arg1
and arg2
at the same time, something like a form.
TAB switch between fields, ENTER (or other key) close the form and run the function.
-UUU:----F1 *scratch* All (4,0) (Lisp Interaction Fly AC WK ElDo
Arg1: Arg2:
or
-UUU:----F1 *scratch* All (4,0) (Lisp Interaction Fly AC WK ElDo
Arg1:
Arg2:
How can I do this ?
I have look at magit transient, cus-edit.el
and wid-edit.el
(Are there any libraries for input fields in Emacs?) but I don't find.
Edit:
When I run isearch-fordward
in the completions buffer during a find-file
command, I have a second field in minibuffer. Does any one know how to do this ?