Enable font ligatures for Emacs 27!
Now that Emacs is capable a rendering font ligatures, I defined a function to enable them in fonts.el. Everything works, and it's beautiful.
This commit is contained in:
parent
97c2706821
commit
aae5b4c88c
2 changed files with 32 additions and 0 deletions
|
@ -137,5 +137,36 @@ The size of the font is determined by `fonts-size'."
|
||||||
(interactive)
|
(interactive)
|
||||||
(fonts-whitelist-set (fonts-current)))
|
(fonts-whitelist-set (fonts-current)))
|
||||||
|
|
||||||
|
(defun fonts-enable-ligatures ()
|
||||||
|
"Call this function to enable ligatures."
|
||||||
|
(interactive)
|
||||||
|
(let ((alist '((33 . ".\\(?:\\(?:==\\|!!\\)\\|[!=]\\)")
|
||||||
|
(35 . ".\\(?:###\\|##\\|_(\\|[#(?[_{]\\)") ;;
|
||||||
|
(36 . ".\\(?:>\\)")
|
||||||
|
(37 . ".\\(?:\\(?:%%\\)\\|%\\)")
|
||||||
|
(38 . ".\\(?:\\(?:&&\\)\\|&\\)")
|
||||||
|
(42 . ".\\(?:\\(?:\\*\\*/\\)\\|\\(?:\\*[*/]\\)\\|[*/>]\\)") ;;
|
||||||
|
(43 . ".\\(?:\\(?:\\+\\+\\)\\|[+>]\\)")
|
||||||
|
(45 . ".\\(?:\\(?:-[>-]\\|<<\\|>>\\)\\|[<>}~-]\\)")
|
||||||
|
(46 . ".\\(?:\\(?:\\.[.<]\\)\\|[.=-]\\)") ;;
|
||||||
|
(47 . ".\\(?:\\(?:\\*\\*\\|//\\|==\\)\\|[*/=>]\\)")
|
||||||
|
(48 . ".\\(?:x[a-zA-Z]\\)")
|
||||||
|
(58 . ".\\(?:::\\|[:=]\\)")
|
||||||
|
(59 . ".\\(?:;;\\|;\\)")
|
||||||
|
(60 . ".\\(?:\\(?:!--\\)\\|\\(?:~~\\|->\\|\\$>\\|\\*>\\|\\+>\\|--\\|<[<=-]\\|=[<=>]\\||>\\)\\|[*$+~/<=>|-]\\)")
|
||||||
|
(61 . ".\\(?:\\(?:/=\\|:=\\|<<\\|=[=>]\\|>>\\)\\|[<=>~]\\)")
|
||||||
|
(62 . ".\\(?:\\(?:=>\\|>[=>-]\\)\\|[=>-]\\)")
|
||||||
|
(63 . ".\\(?:\\(\\?\\?\\)\\|[:=?]\\)")
|
||||||
|
(91 . ".\\(?:]\\)")
|
||||||
|
(92 . ".\\(?:\\(?:\\\\\\\\\\)\\|\\\\\\)")
|
||||||
|
(94 . ".\\(?:=\\)")
|
||||||
|
(119 . ".\\(?:ww\\)")
|
||||||
|
(123 . ".\\(?:-\\)")
|
||||||
|
(124 . ".\\(?:\\(?:|[=|]\\)\\|[=>|]\\)")
|
||||||
|
(126 . ".\\(?:~>\\|~~\\|[>=@~-]\\)"))))
|
||||||
|
(dolist (char-regexp alist)
|
||||||
|
(set-char-table-range composition-function-table (car char-regexp)
|
||||||
|
`([,(cdr char-regexp) 0 font-shape-gstring])))))
|
||||||
|
|
||||||
(provide 'fonts)
|
(provide 'fonts)
|
||||||
;;; fonts.el ends here
|
;;; fonts.el ends here
|
||||||
|
|
|
@ -164,6 +164,7 @@
|
||||||
(laptop-battery-display))
|
(laptop-battery-display))
|
||||||
|
|
||||||
(fonts-whitelist-set "JetBrainsMono")
|
(fonts-whitelist-set "JetBrainsMono")
|
||||||
|
(fonts-enable-ligatures)
|
||||||
(colorscheme-whitelist-set 'doom-solarized-light)
|
(colorscheme-whitelist-set 'doom-solarized-light)
|
||||||
|
|
||||||
(modeline-setup)
|
(modeline-setup)
|
||||||
|
|
Loading…
Reference in a new issue