Moving to Doom Emacs!

This commit is contained in:
Derek Taylor
2019-12-16 20:21:19 -06:00
parent d9f2f456f1
commit d4b4c33550
683 changed files with 51877 additions and 100 deletions

View File

@@ -0,0 +1,122 @@
;;; ui/pretty-code/+fira.el -*- lexical-binding: t; -*-
(defvar +pretty-code-fira-code-font-name "Fira Code Symbol"
"Name of the fira code ligature font.")
(defvar +pretty-code-fira-code-font-ligatures
'(("www" . #Xe100)
("**" . #Xe101)
("***" . #Xe102)
("**/" . #Xe103)
("*>" . #Xe104)
("*/" . #Xe105)
("\\\\" . #Xe106)
("\\\\\\" . #Xe107)
("{-" . #Xe108)
("[]" . #Xe109)
("::" . #Xe10a)
(":::" . #Xe10b)
(":=" . #Xe10c)
("!!" . #Xe10d)
("!=" . #Xe10e)
("!==" . #Xe10f)
("-}" . #Xe110)
("--" . #Xe111)
("---" . #Xe112)
("-->" . #Xe113)
("->" . #Xe114)
("->>" . #Xe115)
("-<" . #Xe116)
("-<<" . #Xe117)
("-~" . #Xe118)
("#{" . #Xe119)
("#[" . #Xe11a)
("##" . #Xe11b)
("###" . #Xe11c)
("####" . #Xe11d)
("#(" . #Xe11e)
("#?" . #Xe11f)
("#_" . #Xe120)
("#_(" . #Xe121)
(".-" . #Xe122)
(".=" . #Xe123)
(".." . #Xe124)
("..<" . #Xe125)
("..." . #Xe126)
("?=" . #Xe127)
("??" . #Xe128)
(";;" . #Xe129)
("/*" . #Xe12a)
("/**" . #Xe12b)
("/=" . #Xe12c)
("/==" . #Xe12d)
("/>" . #Xe12e)
("//" . #Xe12f)
("///" . #Xe130)
("&&" . #Xe131)
("||" . #Xe132)
("||=" . #Xe133)
("|=" . #Xe134)
("|>" . #Xe135)
("^=" . #Xe136)
("$>" . #Xe137)
("++" . #Xe138)
("+++" . #Xe139)
("+>" . #Xe13a)
("=:=" . #Xe13b)
("==" . #Xe13c)
("===" . #Xe13d)
("==>" . #Xe13e)
("=>" . #Xe13f)
("=>>" . #Xe140)
("=<" . #Xe141)
("=<<" . #Xe142)
("=/=" . #Xe143)
(">-" . #Xe144)
(">=" . #Xe145)
(">=>" . #Xe146)
(">>" . #Xe147)
(">>-" . #Xe148)
(">>=" . #Xe149)
(">>>" . #Xe14a)
("<*" . #Xe14b)
("<*>" . #Xe14c)
("<|" . #Xe14d)
("<|>" . #Xe14e)
("<$" . #Xe14f)
("<$>" . #Xe150)
("<!--" . #Xe151)
("<-" . #Xe152)
("<--" . #Xe153)
("<->" . #Xe154)
("<+" . #Xe155)
("<+>" . #Xe156)
("<=" . #Xe157)
("<==" . #Xe158)
("<=>" . #Xe159)
("<=<" . #Xe15a)
("<>" . #Xe15b)
("<<" . #Xe15c)
("<<-" . #Xe15d)
("<<=" . #Xe15e)
("<<<" . #Xe15f)
("<~" . #Xe160)
("<~~" . #Xe161)
("</" . #Xe162)
("</>" . #Xe163)
("~@" . #Xe164)
("~-" . #Xe165)
("~=" . #Xe166)
("~>" . #Xe167)
("~~" . #Xe168)
("~~>" . #Xe169)
("%%" . #Xe16a)))
(defun +pretty-code-setup-fira-ligatures-h ()
(set-fontset-font t '(#Xe100 . #Xe16f) +pretty-code-fira-code-font-name)
(setq-default prettify-symbols-alist
(append prettify-symbols-alist
(mapcar #'+pretty-code--correct-symbol-bounds
+pretty-code-fira-code-font-ligatures))))
(add-hook 'doom-init-ui-hook #'+pretty-code-setup-fira-ligatures-h)

View File

@@ -0,0 +1,58 @@
;;; ui/pretty-code/+hasklig.el -*- lexical-binding: t; -*-
(defvar +pretty-code-hasklig-font-name "Hasklig"
"Name of the hasklig ligature font.")
(defvar +pretty-code-hasklig-font-ligatures
'(("&&" . #Xe100)
("***" . #Xe101)
("*>" . #Xe102)
("\\\\" . #Xe103)
("||" . #Xe104)
("|>" . #Xe105)
("::" . #Xe106)
("==" . #Xe107)
("===" . #Xe108)
("==>" . #Xe109)
("=>" . #Xe10a)
("=<<" . #Xe10b)
("!!" . #Xe10c)
(">>" . #Xe10d)
(">>=" . #Xe10e)
(">>>" . #Xe10f)
(">>-" . #Xe110)
(">-" . #Xe111)
("->" . #Xe112)
("-<" . #Xe113)
("-<<" . #Xe114)
("<*" . #Xe115)
("<*>" . #Xe116)
("<|" . #Xe117)
("<|>" . #Xe118)
("<$>" . #Xe119)
("<>" . #Xe11a)
("<-" . #Xe11b)
("<<" . #Xe11c)
("<<<" . #Xe11d)
("<+>" . #Xe11e)
(".." . #Xe11f)
("..." . #Xe120)
("++" . #Xe121)
("+++" . #Xe122)
("/=" . #Xe123)
(":::" . #Xe124)
(">=>" . #Xe125)
("->>" . #Xe126)
("<=>" . #Xe127)
("<=<" . #Xe128)
("<->" . #Xe129)))
(defun +pretty-code-setup-hasklig-ligatures-h ()
(set-fontset-font t '(#Xe100 . #Xe129) +pretty-code-hasklig-font-name)
(setq-default prettify-symbols-alist
(append prettify-symbols-alist
(mapcar #'+pretty-code--correct-symbol-bounds
+pretty-code-hasklig-font-ligatures))))
(add-hook 'doom-init-ui-hook #'+pretty-code-setup-hasklig-ligatures-h)

View File

@@ -0,0 +1,232 @@
;;; ui/pretty-code/+iosevka.el -*- lexical-binding: t; -*-
(defvar +pretty-code-iosevka-font-name "Iosevka"
"Name of the iosevka ligature font.")
(defvar +pretty-code-iosevka-font-ligatures
'(;; Double-ended hyphen arrows
("<->" . #Xe100)
("<-->" . #Xe101)
("<--->" . #Xe102)
("<---->" . #Xe103)
("<----->" . #Xe104)
;; Double-ended equals arrows
("<=>" . #Xe105)
("<==>" . #Xe106)
("<===>" . #Xe107)
("<====>" . #Xe108)
("<=====>" . #Xe109)
;; Double-ended asterisk operators
("<**>" . #Xe10a)
("<***>" . #Xe10b)
("<****>" . #Xe10c)
("<*****>" . #Xe10d)
;; HTML comments
("<!--" . #Xe10e)
("<!---" . #Xe10f)
;; Three-char ops with discards
("<$" . #Xe110)
("<$>" . #Xe111)
("$>" . #Xe112)
("<." . #Xe113)
("<.>" . #Xe114)
(".>" . #Xe115)
("<*" . #Xe116)
("<*>" . #Xe117)
("*>" . #Xe118)
("<\\" . #Xe119)
("<\\>" . #Xe11a)
("\\>" . #Xe11b)
("</" . #Xe11c)
("</>" . #Xe11d)
("/>" . #Xe11e)
("<\"" . #Xe11f)
("<\">" . #Xe120)
("\">" . #Xe121)
("<'" . #Xe122)
("<'>" . #Xe123)
("'>" . #Xe124)
("<^" . #Xe125)
("<^>" . #Xe126)
("^>" . #Xe127)
("<&" . #Xe128)
("<&>" . #Xe129)
("&>" . #Xe12a)
("<%" . #Xe12b)
("<%>" . #Xe12c)
("%>" . #Xe12d)
("<@" . #Xe12e)
("<@>" . #Xe12f)
("@>" . #Xe130)
("<#" . #Xe131)
("<#>" . #Xe132)
("#>" . #Xe133)
("<+" . #Xe134)
("<+>" . #Xe135)
("+>" . #Xe136)
("<-" . #Xe137)
("<->" . #Xe138)
("->" . #Xe139)
("<!" . #Xe13a)
("<!>" . #Xe13b)
("!>" . #Xe13c)
("<?" . #Xe13d)
("<?>" . #Xe13e)
("?>" . #Xe13f)
("<|" . #Xe140)
("<|>" . #Xe141)
("|>" . #Xe142)
("<:" . #Xe143)
("<:>" . #Xe144)
(":>" . #Xe145)
;; Colons
("::" . #Xe146)
(":::" . #Xe147)
("::::" . #Xe148)
;; Arrow-like operators
("->" . #Xe149)
("->-" . #Xe14a)
("->--" . #Xe14b)
("->>" . #Xe14c)
("->>-" . #Xe14d)
("->>--" . #Xe14e)
("->>>" . #Xe14f)
("->>>-" . #Xe150)
("->>>--" . #Xe151)
("-->" . #Xe152)
("-->-" . #Xe153)
("-->--" . #Xe154)
("-->>" . #Xe155)
("-->>-" . #Xe156)
("-->>--" . #Xe157)
("-->>>" . #Xe158)
("-->>>-" . #Xe159)
("-->>>--" . #Xe15a)
(">-" . #Xe15b)
(">--" . #Xe15c)
(">>-" . #Xe15d)
(">>--" . #Xe15e)
(">>>-" . #Xe15f)
(">>>--" . #Xe160)
("=>" . #Xe161)
("=>=" . #Xe162)
("=>==" . #Xe163)
("=>>" . #Xe164)
("=>>=" . #Xe165)
("=>>==" . #Xe166)
("=>>>" . #Xe167)
("=>>>=" . #Xe168)
("=>>>==" . #Xe169)
("==>" . #Xe16a)
("==>=" . #Xe16b)
("==>==" . #Xe16c)
("==>>" . #Xe16d)
("==>>=" . #Xe16e)
("==>>==" . #Xe16f)
("==>>>" . #Xe170)
("==>>>=" . #Xe171)
("==>>>==" . #Xe172)
(">=" . #Xe173)
(">==" . #Xe174)
(">>=" . #Xe175)
(">>==" . #Xe176)
(">>>=" . #Xe177)
(">>>==" . #Xe178)
("<-" . #Xe179)
("-<-" . #Xe17a)
("--<-" . #Xe17b)
("<<-" . #Xe17c)
("-<<-" . #Xe17d)
("--<<-" . #Xe17e)
("<<<-" . #Xe17f)
("-<<<-" . #Xe180)
("--<<<-" . #Xe181)
("<--" . #Xe182)
("-<--" . #Xe183)
("--<--" . #Xe184)
("<<--" . #Xe185)
("-<<--" . #Xe186)
("--<<--" . #Xe187)
("<<<--" . #Xe188)
("-<<<--" . #Xe189)
("--<<<--" . #Xe18a)
("-<" . #Xe18b)
("--<" . #Xe18c)
("-<<" . #Xe18d)
("--<<" . #Xe18e)
("-<<<" . #Xe18f)
("--<<<" . #Xe190)
("<=" . #Xe191)
("=<=" . #Xe192)
("==<=" . #Xe193)
("<<=" . #Xe194)
("=<<=" . #Xe195)
("==<<=" . #Xe196)
("<<<=" . #Xe197)
("=<<<=" . #Xe198)
("==<<<=" . #Xe199)
("<==" . #Xe19a)
("=<==" . #Xe19b)
("==<==" . #Xe19c)
("<<==" . #Xe19d)
("=<<==" . #Xe19e)
("==<<==" . #Xe19f)
("<<<==" . #Xe1a0)
("=<<<==" . #Xe1a1)
("==<<<==" . #Xe1a2)
("=<" . #Xe1a3)
("==<" . #Xe1a4)
("=<<" . #Xe1a5)
("==<<" . #Xe1a6)
("=<<<" . #Xe1a7)
("==<<<" . #Xe1a8)
;; Monadic operators
(">=>" . #Xe1a9)
(">->" . #Xe1aa)
(">-->" . #Xe1ab)
(">==>" . #Xe1ac)
("<=<" . #Xe1ad)
("<-<" . #Xe1ae)
("<--<" . #Xe1af)
("<==<" . #Xe1b0)
;; Composition operators
(">>" . #Xe1b1)
(">>>" . #Xe1b2)
("<<" . #Xe1b3)
("<<<" . #Xe1b4)
;; Lens operators
(":+" . #Xe1b5)
(":-" . #Xe1b6)
(":=" . #Xe1b7)
("+:" . #Xe1b8)
("-:" . #Xe1b9)
("=:" . #Xe1ba)
("=^" . #Xe1bb)
("=+" . #Xe1bc)
("=-" . #Xe1bd)
("=*" . #Xe1be)
("=/" . #Xe1bf)
("=%" . #Xe1c0)
("^=" . #Xe1c1)
("+=" . #Xe1c2)
("-=" . #Xe1c3)
("*=" . #Xe1c4)
("/=" . #Xe1c5)
("%=" . #Xe1c6)
;; Logical
("/\\" . #Xe1c7)
("\\/" . #Xe1c8)
;; Semigroup/monoid operators
("<>" . #Xe1c9)
("<+" . #Xe1ca)
("<+>" . #Xe1cb)
("+>" . #Xe1cc))
"Defines the character mappings for ligatures for Iosevka.")
(defun +pretty-code-setup-iosevka-ligatures-h ()
(set-fontset-font t '(#Xe100 . #Xe1cc) +pretty-code-iosevka-font-name)
(setq-default prettify-symbols-alist
(append prettify-symbols-alist
+pretty-code-iosevka-font-ligatures)))
(add-hook 'doom-init-ui-hook #'+pretty-code-setup-iosevka-ligatures-h)

View File

@@ -0,0 +1,259 @@
;;; ui/pretty-code/+pragmata-pro.el -*- lexical-binding: t; -*-
(defvar +pretty-code-pragmata-pro-font-name "PragmataPro"
"Name of the Pragmata Pro ligature font.")
(defvar +pretty-code-pragmata-pro-font-ligatures
'(("[ERROR]" . #XE2C0)
("[DEBUG]" . #XE2C1)
("[INFO]" . #XE2C2)
("[WARN]" . #XE2C3)
("[WARNING]" . #XE2C4)
("[ERR]" . #XE2C5)
("[FATAL]" . #XE2C6)
("[TRACE]" . #XE2C7)
("[FIXME]" . #XE2C8)
("[TODO]" . #XE2C9)
("[BUG]" . #XE2CA)
("[NOTE]" . #XE2CB)
("[HACK]" . #XE2CC)
("[MARK]" . #XE2CD)
("# ERROR" . #XE2F0)
("# DEBUG" . #XE2F1)
("# INFO" . #XE2F2)
("# WARN" . #XE2F3)
("# WARNING" . #XE2F4)
("# ERR" . #XE2F5)
("# FATAL" . #XE2F6)
("# TRACE" . #XE2F7)
("# FIXME" . #XE2F8)
("# TODO" . #XE2F9)
("# BUG" . #XE2FA)
("# NOTE" . #XE2FB)
("# HACK" . #XE2FC)
("# MARK" . #XE2FD)
("// ERROR" . #XE2E0)
("// DEBUG" . #XE2E1)
("// INFO" . #XE2E2)
("// WARN" . #XE2E3)
("// WARNING". #XE2E4)
("// ERR" . #XE2E5)
("// FATAL" . #XE2E6)
("// TRACE" . #XE2E7)
("// FIXME" . #XE2E8)
("// TODO" . #XE2E9)
("// BUG" . #XE2EA)
("// NOTE" . #XE2EB)
("// HACK" . #XE2EC)
("// MARK" . #XE2ED)
("!!" . #XE900)
("!=" . #XE901)
("!==" . #XE902)
("!!!" . #XE903)
("!≡" . #XE904)
("!≡≡" . #XE905)
("!>" . #XE906)
("!=<" . #XE907)
("#(" . #XE920)
("#_" . #XE921)
("#{" . #XE922)
("#?" . #XE923)
("#>" . #XE924)
("##" . #XE925)
("#_(" . #XE926)
("%=" . #XE930)
("%>" . #XE931)
("%>%" . #XE932)
("%<%" . #XE933)
("&%" . #XE940)
("&&" . #XE941)
("&*" . #XE942)
("&+" . #XE943)
("&-" . #XE944)
("&/" . #XE945)
("&=" . #XE946)
("&&&" . #XE947)
("&>" . #XE948)
("$>" . #XE955)
("***" . #XE960)
("*=" . #XE961)
("*/" . #XE962)
("*>" . #XE963)
("++" . #XE970)
("+++" . #XE971)
("+=" . #XE972)
("+>" . #XE973)
("++=" . #XE974)
("--" . #XE980)
("-<" . #XE981)
("-<<" . #XE982)
("-=" . #XE983)
("->" . #XE984)
("->>" . #XE985)
("---" . #XE986)
("-->" . #XE987)
("-+-" . #XE988)
("-\\/" . #XE989)
("-|>" . #XE98A)
("-<|" . #XE98B)
(".." . #XE990)
("..." . #XE991)
("..<" . #XE992)
(".>" . #XE993)
(".~" . #XE994)
(".=" . #XE995)
("/*" . #XE9A0)
("//" . #XE9A1)
("/>" . #XE9A2)
("/=" . #XE9A3)
("/==" . #XE9A4)
("///" . #XE9A5)
("/**" . #XE9A6)
(":::" . #XE9AF)
("::" . #XE9B0)
(":=" . #XE9B1)
(":≡" . #XE9B2)
(":>" . #XE9B3)
(":=>" . #XE9B4)
(":(" . #XE9B5)
(":-(" . #XE9B6)
(":)" . #XE9B7)
(":-)" . #XE9B8)
(":/" . #XE9B9)
(":\\" . #XE9BA)
(":3" . #XE9BB)
(":D" . #XE9BC)
(":P" . #XE9BD)
(":>:" . #XE9BE)
(":<:" . #XE9BF)
("<$>" . #XE9C0)
("<*" . #XE9C1)
("<*>" . #XE9C2)
("<+>" . #XE9C3)
("<-" . #XE9C4)
("<<" . #XE9C5)
("<<<" . #XE9C6)
("<<=" . #XE9C7)
("<=" . #XE9C8)
("<=>" . #XE9C9)
("<>" . #XE9CA)
("<|>" . #XE9CB)
("<<-" . #XE9CC)
("<|" . #XE9CD)
("<=<" . #XE9CE)
("<~" . #XE9CF)
("<~~" . #XE9D0)
("<<~" . #XE9D1)
("<$" . #XE9D2)
("<+" . #XE9D3)
("<!>" . #XE9D4)
("<@>" . #XE9D5)
("<#>" . #XE9D6)
("<%>" . #XE9D7)
("<^>" . #XE9D8)
("<&>" . #XE9D9)
("<?>" . #XE9DA)
("<.>" . #XE9DB)
("</>" . #XE9DC)
("<\\>" . #XE9DD)
("<\">" . #XE9DE)
("<:>" . #XE9DF)
("<~>" . #XE9E0)
("<**>" . #XE9E1)
("<<^" . #XE9E2)
("<!" . #XE9E3)
("<@" . #XE9E4)
("<#" . #XE9E5)
("<%" . #XE9E6)
("<^" . #XE9E7)
("<&" . #XE9E8)
("<?" . #XE9E9)
("<." . #XE9EA)
("</" . #XE9EB)
("<\\" . #XE9EC)
("<\"" . #XE9ED)
("<:" . #XE9EE)
("<->" . #XE9EF)
("<!--" . #XE9F0)
("<--" . #XE9F1)
("<~<" . #XE9F2)
("<==>" . #XE9F3)
("<|-" . #XE9F4)
("<<|" . #XE9F5)
("<-<" . #XE9F7)
("<-->" . #XE9F8)
("<<==" . #XE9F9)
("<==" . #XE9FA)
("=<<" . #XEA00)
("==" . #XEA01)
("===" . #XEA02)
("==>" . #XEA03)
("=>" . #XEA04)
("=~" . #XEA05)
("=>>" . #XEA06)
("=/=" . #XEA07)
("=~=" . #XEA08)
("==>>" . #XEA09)
("≡≡" . #XEA10)
("≡≡≡" . #XEA11)
("≡:≡" . #XEA12)
(">-" . #XEA20)
(">=" . #XEA21)
(">>" . #XEA22)
(">>-" . #XEA23)
(">>=" . #XEA24)
(">>>" . #XEA25)
(">=>" . #XEA26)
(">>^" . #XEA27)
(">>|" . #XEA28)
(">!=" . #XEA29)
(">->" . #XEA2A)
("??" . #XEA40)
("?~" . #XEA41)
("?=" . #XEA42)
("?>" . #XEA43)
("???" . #XEA44)
("?." . #XEA45)
("^=" . #XEA48)
("^." . #XEA49)
("^?" . #XEA4A)
("^.." . #XEA4B)
("^<<" . #XEA4C)
("^>>" . #XEA4D)
("^>" . #XEA4E)
("\\\\" . #XEA50)
("\\>" . #XEA51)
("\\/-" . #XEA52)
("@>" . #XEA57)
("|=" . #XEA60)
("||" . #XEA61)
("|>" . #XEA62)
("|||" . #XEA63)
("|+|" . #XEA64)
("|->" . #XEA65)
("|-->" . #XEA66)
("|=>" . #XEA67)
("|==>" . #XEA68)
("|>-" . #XEA69)
("|<<" . #XEA6A)
("||>" . #XEA6B)
("|>>" . #XEA6C)
("|-" . #XEA6D)
("||-" . #XEA6E)
("~=" . #XEA70)
("~>" . #XEA71)
("~~>" . #XEA72)
("~>>" . #XEA73)
("[[" . #XEA80)
("]]" . #XEA81)
("\">" . #XEA90)
("_|_" . #XEA97))
"Defines the character mappings for ligatures for Pragmata Pro.")
(defun +pretty-code-setup-pragmata-pro-ligatures-h ()
(setq-default prettify-symbols-alist
(append prettify-symbols-alist
(mapcar #'+pretty-code--correct-symbol-bounds
+pretty-code-pragmata-pro-font-ligatures))))
(add-hook 'doom-init-ui-hook #'+pretty-code-setup-pragmata-pro-ligatures-h)

View File

@@ -0,0 +1,55 @@
;;; ui/pretty-code/settings.el -*- lexical-binding: t; -*-
;;;###autoload
(defvar +pretty-code-symbols-alist '((t))
"An alist containing a mapping of major modes to its value for
`prettify-symbols-alist'.")
;;;###autodef
(defun set-pretty-symbols! (modes &rest plist)
"Associates string patterns with icons in certain major-modes.
MODES is a major mode symbol or a list of them.
PLIST is a property list whose keys must match keys in `+pretty-code-symbols',
and whose values are strings representing the text to be replaced with that
symbol. If the car of PLIST is nil, then unset any pretty symbols previously
defined for MODES.
The following properties are special:
:alist ALIST
Appends ALIST to `prettify-symbols-alist' literally, without mapping text to
`+pretty-code-symbols'.
:merge BOOL
If non-nil, merge with previously defined `prettify-symbols-alist',
otherwise overwrite it.
For example, the rule for emacs-lisp-mode is very simple:
(set-pretty-symbols! 'emacs-lisp-mode
:lambda \"lambda\")
This will replace any instances of \"lambda\" in emacs-lisp-mode with the symbol
assicated with :lambda in `+pretty-code-symbols'.
Pretty symbols can be unset for emacs-lisp-mode with:
(set-pretty-symbols! 'emacs-lisp-mode nil)"
(declare (indent defun))
(if (null (car-safe plist))
(dolist (mode (doom-enlist modes))
(delq (assq mode +pretty-code-symbols-alist)
+pretty-code-symbols-alist))
(let (results merge key)
(while plist
(pcase (setq key (pop plist))
(:merge (setq merge (pop plist)))
(:alist (setq results (append (pop plist) results)))
(_
(when-let (char (plist-get +pretty-code-symbols key))
(push (cons (pop plist) char) results)))))
(dolist (mode (doom-enlist modes))
(unless merge
(delq (assq mode +pretty-code-symbols-alist)
+pretty-code-symbols-alist))
(push (cons mode results) +pretty-code-symbols-alist)))))

View File

@@ -0,0 +1,93 @@
;;; ui/pretty-code/config.el -*- lexical-binding: t; -*-
(defvar +pretty-code-symbols
'(;; org
:name "»"
:src_block "»"
:src_block_end "«"
;; Functional
:lambda "λ"
:def "ƒ"
:composition ""
:map ""
;; Types
:null ""
:true "𝕋"
:false "𝔽"
:int ""
:float ""
:str "𝕊"
:bool "𝔹"
;; Flow
:not ""
:in ""
:not-in ""
:and ""
:or ""
:for ""
:some ""
:return ""
:yield ""
;; Other
:tuple ""
:pipe "" ;; FIXME: find a non-private char
:dot "")
"Options plist for `set-pretty-symbols!'.
This should not contain any symbols from the Unicode Private Area! There is no
universal way of getting the correct symbol as that area varies from font to
font.")
(defun +pretty-code--correct-symbol-bounds (ligature-alist)
"Prepend non-breaking spaces to a ligature.
This way `compose-region' (called by `prettify-symbols-mode') will use the
correct width of the symbols instead of the width measured by `char-width'."
(let ((len (length (car ligature-alist)))
(acc (list (cdr ligature-alist))))
(while (> len 1)
(setq acc (cons #X00a0 (cons '(Br . Bl) acc))
len (1- len)))
(cons (car ligature-alist) acc)))
(defvar +pretty-code-enabled-modes t
"List of major modes in which `prettify-symbols-mode' should be enabled.
If t, enable it everywhere. If the first element is 'not, enable it in any mode
besides what is listed.")
;; When you get to the right edge, it goes back to how it normally prints
(setq prettify-symbols-unprettify-at-point 'right-edge)
(defun +pretty-code-init-pretty-symbols-h ()
"Enable `prettify-symbols-mode'.
If in fundamental-mode, or a mode derived from special, comint, eshell or term
modes, this function does nothing.
Otherwise it builds `prettify-code-symbols-alist' according to
`+pretty-code-symbols-alist' for the current major-mode."
(unless (or (eq major-mode 'fundamental-mode)
(eq (get major-mode 'mode-class) 'special)
(derived-mode-p 'comint-mode 'eshell-mode 'term-mode))
(when (or (eq +pretty-code-enabled-modes t)
(if (eq (car +pretty-code-enabled-modes) 'not)
(not (memq major-mode (cdr +pretty-code-enabled-modes)))
(memq major-mode +pretty-code-enabled-modes)))
(setq prettify-symbols-alist
(append (cdr (assq major-mode +pretty-code-symbols-alist))
(default-value 'prettify-symbols-alist)))
(when prettify-symbols-mode
(prettify-symbols-mode -1))
(prettify-symbols-mode +1))))
(add-hook 'after-change-major-mode-hook #'+pretty-code-init-pretty-symbols-h)
;; Font-specific ligature support
(cond ((featurep! +fira)
(load! "+fira"))
((featurep! +iosevka)
(load! "+iosevka"))
((featurep! +hasklig)
(load! "+hasklig"))
((featurep! +pragmata-pro)
(load! "+pragmata-pro")))