help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: (interactive) and &optional


From: Dr Rainer Woitok
Subject: Re: (interactive) and &optional
Date: Sat, 25 Mar 2023 13:05:14 +0100

Jean,

On Friday, 2023-03-24 12:23:29 +0300, you wrote:

> ...
> I do not like involving `interactive' at all, so I do the handling by
> providing optional argument and telling function to check for it, or
> ask for it.
> 
> (defun search-something (&optional query)
>   "Search something by using QUERY."
>   (interactive)
>   (let* ((query (or query (read-from-minibuffer "Query: "))))
>     (do-the-search query)))

Correct me if I'm wrong,  but doesn't this  unconditionally call  "read-
from-minibuffer"  when non-interactively called  without argument?  Non-
interactively I would like the function to simply use my default value.

Anyway, many thanks to you and the others having taken part in this dis-
cussion -- I've learned a few things :-)

Sincerely,
  Rainer



reply via email to

[Prev in Thread] Current Thread [Next in Thread]