[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Symbols in interactive user input
From: |
Stephen Berman |
Subject: |
Re: Symbols in interactive user input |
Date: |
Thu, 28 Nov 2024 14:14:54 +0100 |
User-agent: |
Gnus/5.13 (Gnus v5.13) |
On Thu, 28 Nov 2024 12:13:53 +0000 Heime via Users list for the GNU Emacs text
editor <help-gnu-emacs@gnu.org> wrote:
> Do user input commands allow using symbols rather than strings?
> For instance using 'extended, 'disable, 'tabtrail, which are then
> used in a pcase or cond conditionals.
>
> (interactive
> (let* ( (colw (read-number "Line Column: " 72))
> (cseq '("extended" "disable" "tabtrail"))
> (rsel (completing-read "Selector: " cseq nil t "tabtrail"))
> (scope (completing-read "Scope: "
> '("global" "local") nil t "local")) )
>
> ;; Pass a single list as argument
> (list (list colw rsel scope))) )
`completing-read' returns a string, even if the completion collection
consists of symbols. But you can use `intern' to get the symbol from
the string (which is the symbol's name):
(let ((s (completing-read "Enter: " '(bla bli blu) nil t)))
(list (stringp s) (symbolp s) (symbolp (intern s))))
=> (t nil t)
Steve Berman