[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Passing a list of symbols to function argument
From: |
Stephen Berman |
Subject: |
Re: Passing a list of symbols to function argument |
Date: |
Fri, 29 Nov 2024 20:54:55 +0100 |
User-agent: |
Gnus/5.13 (Gnus v5.13) |
On Fri, 29 Nov 2024 17:34:01 +0000 Heime via Users list for the GNU Emacs text
editor <help-gnu-emacs@gnu.org> wrote:
> Why do I get
>
> Wrong type argument: stringp, tabtrail
>
> When using the call
>
> (poalatuk '(72 tabtrail global))
>
> to the function
>
>
> (defun poalatuk (actm-seqr)
>
> (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))) )
>
> ;; -------------------------------------------------------------
>
> (message "poalatuk: %S" actm-seqr)
>
> (let* ( (colw (nth 0 actm-seqr)) ;; Extract column width.
> (rsel (intern (nth 1 actm-seqr))) ;; Extract mode selector.
^^^^^^^^^^^^^^^^^^^^^^^^^^
The error happens here. You passed '(72 tabtrail global) as the value
of the argument actm-seqr, so (nth 1 actm-seqr) returns the symbol
`tabtrail'. But `intern' takes a string and returns the symbol (in the
obarray) whose name is given by the string.
Steve Berman
- Passing a list of symbols to function argument, Heime, 2024/11/29
- Re: Passing a list of symbols to function argument,
Stephen Berman <=
- Re: Passing a list of symbols to function argument, Heime, 2024/11/29
- Re: Passing a list of symbols to function argument, Stephen Berman, 2024/11/29
- Re: Passing a list of symbols to function argument, Heime, 2024/11/29
- Re: Passing a list of symbols to function argument, Stephen Berman, 2024/11/29
- Re: Passing a list of symbols to function argument, Heime, 2024/11/29
- Re: Passing a list of symbols to function argument, Stephen Berman, 2024/11/29
- Re: Passing a list of symbols to function argument, Heime, 2024/11/29