Last active
July 12, 2021 07:10
-
-
Save tkurtbond/3dad54a2141422f39033533e72f53110 to your computer and use it in GitHub Desktop.
A small minor mode for easily entering Unicode double and single quotes, em and en dashes, and horizontal ellipses.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;; look at https://github.com/ndw/xmlunicode for xmlunicode.el | |
;; xmlunicode-character-list.el. xmlunicode.el provides the | |
;; "smart-unicode-*" functions. | |
(load-library "unichars") | |
(load-library "xmlunicode") | |
(defun tkb-describe-character (before) | |
"Describe the character after point (before if a prefix was specified) | |
if it is a unicode character." | |
(interactive "P") | |
(let* ((char (if before (char-before) (char-after))) | |
(info (assoc (encode-char char 'ucs) unicode-character-list)) | |
(info (cons (format "#x%X" (car info)) info))) | |
(message "%S" info))) | |
(tkb-keys ((kbd "C-c k d") #'tkb-describe-character)) | |
(define-minor-mode tkb-smart-unicode-mode | |
"Toggle smart unicode punctuation" nil " ♻⚔☣☥☸◉⅙✽☮" ; "✘▧▧⚅☑☢☹☺♠♥♦♣♨" | |
'(("\"" . unicode-smart-double-quote) | |
("'" . unicode-smart-single-quote) | |
("-" . unicode-smart-hyphen) | |
("." . unicode-smart-period))) | |
(defadvice unicode-smart-hyphen (after tkb-after-unicode-smart-hyphen last | |
activate compile) | |
(tkb-describe-character t)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment