unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* Passing a list of symbols to function argument
@ 2024-11-29 17:34 Heime via Users list for the GNU Emacs text editor
  2024-11-29 19:54 ` Stephen Berman
  0 siblings, 1 reply; 9+ messages in thread
From: Heime via Users list for the GNU Emacs text editor @ 2024-11-29 17:34 UTC (permalink / raw)
  To: Heime via Users list for the GNU Emacs text editor

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.
          (scope (intern (nth 2 actm-seqr))) )  ;; Extract scope.

    (require 'whitespace)

    (if (eq scope 'global)
          (global-whitespace-mode 0)
      (whitespace-mode 0))

    (pcase rsel

      ('tabtrail
         (setq whitespace-line-column (or colw 72))
         (setq whitespace-style
                '(face tabs tab-mark trailing lines-char))
         (if (eq scope 'global)
               (global-whitespace-mode 1)
           (whitespace-mode 1)))

      ('extended
         (setq whitespace-line-column (or colw 72))
         (setq whitespace-style
                '(face tabs tab-mark indentation trailing lines-char
                  space-before-tab space-after-tab))
         (if (eq scope 'global)
               (global-whitespace-mode 1)
           (whitespace-mode 1)) )

      ('disable
         (if (eq scope 'global)
               (global-whitespace-mode 0)
           (whitespace-mode 0)) )) ))

I want to pass alist as an argument to the function such as
   
   (poalatuk '(72 tabtrail global))

And expecting that actm-seqr would be alist.



^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2024-11-29 22:45 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-11-29 17:34 Passing a list of symbols to function argument Heime via Users list for the GNU Emacs text editor
2024-11-29 19:54 ` Stephen Berman
2024-11-29 20:15   ` Heime via Users list for the GNU Emacs text editor
2024-11-29 20:41     ` Stephen Berman
2024-11-29 21:16       ` Heime via Users list for the GNU Emacs text editor
2024-11-29 21:29         ` Stephen Berman
2024-11-29 21:41           ` Heime via Users list for the GNU Emacs text editor
2024-11-29 21:52             ` Stephen Berman
2024-11-29 22:45               ` Heime via Users list for the GNU Emacs text editor

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).