-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path+emoji.el
More file actions
55 lines (47 loc) · 1.99 KB
/
+emoji.el
File metadata and controls
55 lines (47 loc) · 1.99 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
;;; +emoji.el -*- lexical-binding: t; -*-
(use-package! info-colors
:commands (info-colors-fontify-node))
(add-hook 'Info-selection-hook 'info-colors-fontify-node)
(setq emojify-emoji-set "twemoji-v2")
(defvar emojify-disabled-emojis
'(;; Org
"◼" "☑" "☸" "⚙" "⏩" "⏪" "⬆" "⬇" "❓" "↔"
;; Terminal powerline
"✔"
;; Box drawing
"▶" "◀"
;; I just want to see this as text
"©" "™")
"Characters that should never be affected by `emojify-mode'.")
(defadvice! emojify-delete-from-data ()
"Ensure `emojify-disabled-emojis' don't appear in `emojify-emojis'."
:after #'emojify-set-emoji-data
(dolist (emoji emojify-disabled-emojis)
(remhash emoji emojify-emojis)))
(defun emojify--replace-text-with-emoji (orig-fn emoji text buffer start end &optional target)
"Modify `emojify--propertize-text-for-emoji' to replace ascii/github emoticons with unicode emojis, on the fly."
(if (or (not emoticon-to-emoji) (= 1 (length text)))
(funcall orig-fn emoji text buffer start end target)
(delete-region start end)
(insert (ht-get emoji "unicode"))))
(define-minor-mode emoticon-to-emoji
"Write ascii/gh emojis, and have them converted to unicode live."
:global nil
:init-value nil
(if emoticon-to-emoji
(progn
(setq-local emojify-emoji-styles '(ascii github unicode))
(advice-add 'emojify--propertize-text-for-emoji :around #'emojify--replace-text-with-emoji)
(unless emojify-mode
(emojify-turn-on-emojify-mode)))
(setq-local emojify-emoji-styles (default-value 'emojify-emoji-styles))
(advice-remove 'emojify--propertize-text-for-emoji #'emojify--replace-text-with-emoji)))
(use-package! page-break-lines
:commands page-break-lines-mode
:init
(autoload 'turn-on-page-break-lines-mode "page-break-lines")
:config
(setq page-break-lines-max-width fill-column)
(map! :prefix "g"
:desc "Prev page break" :nv "[" #'backward-page
:desc "Next page break" :nv "]" #'forward-page))