From bda44d03927aae9ae0242c716ab6730f5ace36b0 Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Fri, 13 Jul 2018 22:46:24 -0300 Subject: Add Fira Code font to Emacs --- spacemacs.el | 162 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 159 insertions(+), 3 deletions(-) (limited to 'spacemacs.el') diff --git a/spacemacs.el b/spacemacs.el index 35c7dea..240828a 100644 --- a/spacemacs.el +++ b/spacemacs.el @@ -74,6 +74,7 @@ This function should only modify configuration layer settings." swift syntax-checking typescript + unicode-fonts version-control windows-scripts yaml @@ -236,8 +237,9 @@ It should only modify the values of Spacemacs settings." ;; Default font, or prioritized list of fonts. `powerline-scale' allows to ;; quickly tweak the mode-line size to make separators look not too crappy. - dotspacemacs-default-font '("Source Code Pro" - :size 13 + ;; Alternatives: "FreeMono", "Source Code Pro", "Default" + dotspacemacs-default-font '("Fira Code" + :size 16 :weight normal :width normal) @@ -689,6 +691,160 @@ This is the place where most of your configurations should be done. Unless it is ("n" "Next Task" entry (file+headline org-default-notes-file "Tasks") "** NEXT %? \nDEADLINE: %t"))) + + + + + + + + +;;; Fira code +;; This works when using emacs --daemon + emacsclient +(add-hook 'after-make-frame-functions (lambda (frame) (set-fontset-font t '(#Xe100 . #Xe16f) "Fira Code Symbol"))) +;; This works when using emacs without server/client +(set-fontset-font t '(#Xe100 . #Xe16f) "Fira Code Symbol") +;; I haven't found one statement that makes both of the above situations work, so I use both for now + +(defconst fira-code-font-lock-keywords-alist + (mapcar (lambda (regex-char-pair) + `(,(car regex-char-pair) + (0 (prog1 () + (compose-region (match-beginning 1) + (match-end 1) + ;; The first argument to concat is a string containing a literal tab + ,(concat " " (list (decode-char 'ucs (cadr regex-char-pair))))))))) + '(("\\(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) + ("\\(