Emacs: xah-insert-unicode ๐Ÿš€

By Xah Lee. Date: . Last updated: .

here's a command that lets you insert your own set of unicode characters via a completion.

put this in your Emacs Init File:

(defvar xah-unicode-list nil
 "A alist.
Each item is (prompStr . xString). Used by `xah-insert-unicode'.
prompStr is used for prompt.
xString is used for insert a unicode.
xString can be any string, needs not be a char or emoji.
")

(setq
 xah-unicode-list
 '(
   ;;
   ("smile beaming ๐Ÿ˜Š" . "๐Ÿ˜Š")
   ("tears of joy" . "๐Ÿ˜‚")
   ("hug ๐Ÿค—" . "๐Ÿค—")
   ("heart eyes ๐Ÿ˜" . "๐Ÿ˜")
   ("heart face ๐Ÿฅฐ" . "๐Ÿฅฐ")
   ("angry ๐Ÿ˜ " . "๐Ÿ˜ ")
   ("vomit ๐Ÿคฎ" . "๐Ÿคฎ")
   ("thumb up ๐Ÿ‘" . "๐Ÿ‘")
   ("thumb down ๐Ÿ‘Ž" . "๐Ÿ‘Ž")
   ("checkmark โœ…" . "โœ…")
   ("new ๐Ÿ†•" . "๐Ÿ†•")
   ("glowing star ๐ŸŒŸ" . "๐ŸŒŸ")
   ("star โญ" . "โญ")
   ("sparkles โœจ" . "โœจ")
   ("rocket ๐Ÿš€" . "๐Ÿš€")
   ("sun ๐ŸŒž" . "๐ŸŒž")
   ("heart ๐Ÿงก" . "๐Ÿงก")
   ("clown ๐Ÿคก" . "๐Ÿคก")
   ("large circle" . "โญ•")
   ("cross โŒ" . "โŒ")
   ("red triangle ๐Ÿ”บ" . "๐Ÿ”บ")
   ("diamond ๐Ÿ’ " . "๐Ÿ’ ")
   ("square" . "โฌ›")
   ("cursor โ–ฎ" . "โ–ฎ")
   ("dagger โ€ " . "โ€ ")
   ("double dagger โ€ก" . "โ€ก")

   ("double angle bracket" . "ใ€Šใ€‹")
   ("black lenticular bracket" . "ใ€ใ€‘")
   ("corner-bracket" . "ใ€Œใ€")
   ("tortoise shell bracket" . "ใ€”ใ€•")
   ("angle bracket" . "ใ€ˆใ€‰")
   ("double angle quote" . "ยซยป")

   ("bullet โ€ข" . "โ€ข")
   ("diamond โ—†" . "โ—†")
   ("...ellipsis โ€ฆ" . "โ€ฆ")
   ("nbsp non breaking space" . "ย ")
   ("chinese comma ใ€" . "ใ€")
   ("emdash โ€”" . "โ€”")
   ("fullwidth ampersand ๏ผ†" . "๏ผ†")
   ("left arrow โ†" . "โ†")
   ("right arrow โ†’" . "โ†’")
   ("up arrow โ†‘" . "โ†‘")
   ("down arrow โ†“" . "โ†“")
   ("f hook ฦ’" . "ฦ’")
   ;;
   ))

(defun xah-insert-unicode ()
  "Insert a unicode from a custom list `xah-unicode-list'.
URL `http://xahlee.info/emacs/emacs/emacs_insert_unicode.html'
Created: 2021-01-05
Version: 2023-09-19"
  (interactive)
  (let ((xkey
         (let ((completion-ignore-case t))
           (completing-read "Insert:" xah-unicode-list nil t))))
    (insert (cdr (assoc xkey xah-unicode-list)))))