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

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

Re: terminal command with output in current buffer


From: Felix Dietrich
Subject: Re: terminal command with output in current buffer
Date: Tue, 20 Jul 2021 14:55:24 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/27.1 (gnu/linux)

Emanuel Berg via Users list for the GNU Emacs text editor
<help-gnu-emacs@gnu.org> writes:

> Felix Dietrich wrote:
>
>> (let ((read-result (read-from-minibuffer "Prompt: ")))
>>   (if (seq-empty-p read-result)
>>     (setq read-result "default-value")))
>
> What? :P `setq' again...
>
>   (let*((read-result (read-from-minibuffer "Prompt: "))
>         (value       (if (string= "" read-result)
>                          "default-value"
>                        read-result) ))
>     value)

This is whatʼs bothering you the most? ;)  I have reread the part of the
elisp manual about reading text from the minibuffer, and it suggests one
“do all minibuffer input as part of reading the arguments for a command,
in the ‘interactive’ specification.” [1]  Not directly applicable to a
stand-alone let snippet but relevant in the context of the thread (which
involved reading user input for an interactive command).


Footnotes:
[1]  (info "(elisp) Text from Minibuffer")

-- 
Felix Dietrich



reply via email to

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