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

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

terminal command with output in current buffer


From: lisa-asket
Subject: terminal command with output in current buffer
Date: Fri, 16 Jul 2021 21:48:03 +0200 (CEST)

I am getting a small problem when using  `(cmd-cnum (read-number "context: "))`



Wrong type argument: sequencep, 8 



From: Felix Dietrich <felix.dietrich@sperrhaken.name>
To: help-gnu-emacs@gnu.org
Subject: Re: terminal command with output in current buffer
Date: 16/07/2021 21:35:05 Europe/Paris

lisa-asket@perso.be writes:

> Many thanks, I just did not follow what asynchronously meant.

Fair enough.

> Can one assign default values when `read-from-minibuffer` in empty?

“read-from-minibuffer” as well as the functions suggested by Stefan
Monnier (“read-number”, “read-string”, …) have a parameter DEFAULT or
DEFAULT-VALUE (or similar) that you may use for that purpose; read their
documentation.

You may also check the return value of “read-from-minibuffer” or
“read-string” and act accordingly:

(let ((read-result (read-from-minibuffer "Prompt: ")))
(if (seq-empty-p read-result)
(setq read-result "default-value")))

See also:

<https://www.gnu.org/software/emacs/manual/html_node/eintr/if.html>

-- 
Felix Dietrich




reply via email to

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