Skip to content

Commit

Permalink
Add Hasklig font
Browse files Browse the repository at this point in the history
The logic to construct the prettify-symbols-alist was taken from
i-tu/Hasklig#84 (comment) (modified to
remove the need for dash).
  • Loading branch information
cydparser committed May 14, 2017
1 parent 2e2d12a commit ceb05ba
Showing 1 changed file with 37 additions and 2 deletions.
39 changes: 37 additions & 2 deletions base.el
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,43 @@
auto-save-list-file-prefix (concat ldir "/saves-")
backup-directory-alist `((".*" . ,bdir))))

(when (member "Inconsolata" (font-family-list))
(set-frame-font "Inconsolata 15"))
(let ((fonts (font-family-list)))
(cond ((member "Hasklig" fonts)
(set-frame-font "Hasklig Light 14")

(defconst init-hasklig-prettify-symbols-alist
(let ((codepoint #Xe100))
(mapcar (lambda (lig)
(let ((pair (cons lig (string ?\t codepoint))))
(setq codepoint (1+ codepoint))
pair))
'("&&" "***" "*>" "\\\\" "||" "|>" "::"
"==" "===" "==>" "=>" "=<<" "!!" ">>"
">>=" ">>>" ">>-" ">-" "->" "-<" "-<<"
"<*" "<*>" "<|" "<|>" "<$>" "<>" "<-"
"<<" "<<<" "<+>" ".." "..." "++" "+++"
"/=" ":::" ">=>" "->>" "<=>" "<=<" "<->"))))

(defconst init-hasklig-prettify-symbols-common-alist
(let ((common '("&&" "==" "===" "=>" "->" ".." "..." "++" "<=>")))
(append
'(("lambda" . "λ"))
(seq-filter (lambda (pair)
(member (car pair) common))
init-hasklig-prettify-symbols-alist))))

(setq prettify-symbols-alist init-hasklig-prettify-symbols-common-alist)

(defun init-prettify-symbols ()
(setq prettify-symbols-alist
(cond ((derived-mode-p 'haskell-mode)
init-hasklig-prettify-symbols-alist)
(t init-hasklig-prettify-symbols-common-alist)))
(prettify-symbols-mode))

(add-hook 'prog-mode-hook #'init-prettify-symbols))
((member "Inconsolata" fonts)
(set-frame-font "Inconsolata 15"))))

;; Simplify prompts.
(fset 'yes-or-no-p #'y-or-n-p)
Expand Down

0 comments on commit ceb05ba

Please sign in to comment.