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

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

Handling read-multiple-choice for conditional testing with symbols


From: Heime
Subject: Handling read-multiple-choice for conditional testing with symbols
Date: Mon, 09 Dec 2024 17:54:27 +0000

I want to use read-multiple-choice to be able to enter a sequence 
of commands. But I am testing upon symbols not strings.

Does read-multiple-choice always require ?g with a single letter?  
Does it always require

(defun troller (actm-seqr)
  "Handle `icomplete-mode'."

  ;; =============================================================

  (interactive
    (list
      (let ( (cseq '((?g "go" "Activate the feature")
                     (?d "deact" "Deactivate the feature")
                     (?n "nogo" "Do not activate"))) )

          (cadr (read-multiple-choice "ACTM-SEQR: " cseq)))))

  ;; =============================================================

  ;; Make ACTM-SEQR a list, even if a single symbol is passed.
  (let ( (actm-seqr
           (if (listp actm-seqr) actm-seqr (list actm-seqr))) )

    (catch 'exit
      (dolist (actm actm-seqr)
        (pcase actm  ; Cont'd at CASE

  ('go
     (ichorz-launch 'go))

  ('deact
     (when (bound-and-true-p icomplete-mode)
       (icomplete-mode -1)))

  ('nogo
     (throw 'exit "Exit on NOGO"))

  (_
     (message " ACTM Unrecognised: %s" actm)
     (throw 'exit "Exit on ACTM Unrecognised")) )))) )






reply via email to

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