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

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

Calling a function within a pcase


From: Heime
Subject: Calling a function within a pcase
Date: Thu, 17 Aug 2023 04:19:34 +0000

Have written the following function to insert either
the command \bigoplus or the symbol ⨁︁.

But calling (imprint seltr "\\bigoplus" "⨁︁")

is not getting executed.  Cannot see my mistake right now.

(defun imprint (selector kmstr &optional grapheme)
  (message "Selector: %s" selector)
  (if (equal selector "Command")
      (insert kmstr)
    ;; Insert GRAPHEME if present, insert KMSTR otherwise.
    (insert (if grapheme grapheme kmstr))))

;;-------------

(defun bigops (grafm seltr)
  "Binary Operations."

  (interactive
    (let ( (csel '("Symbol" "Command"))
           (cseq '("bigoplus ⨁︁"  "bigotimes ⨂︁")) )

      (list
        (completing-read "Grapheme: " cseq nil t nil)
        (completing-read "Selector: " csel nil t nil)) ))

  (pcase (car (split-string grafm))
    ("bigoplus︁" (imprint seltr "\\bigoplus" "⨁︁"))
    ("bigotimes︁" (imprint seltr "\\bigotimes" "⨂︁")) ))





reply via email to

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