unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* Calling a function within a pcase
@ 2023-08-17  4:19 Heime
  0 siblings, 0 replies; only message in thread
From: Heime @ 2023-08-17  4:19 UTC (permalink / raw)
  To: Heime via Users list for the GNU Emacs text editor

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" "⨂︁")) ))





^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2023-08-17  4:19 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-08-17  4:19 Calling a function within a pcase Heime

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).