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 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94
|
;;; scala-mode-prettify-symbols.el --- Prettifying scala symbols -*- coding: utf-8; -*-
;; Copyright (c) 2016 Merlin Göttlinger
;; License: http://www.gnu.org/licenses/gpl.html
;;; Commentary:
;;
;; Suggested `prettify-symbols' for Scala editing, enable
;; `prettify-symbols-mode' and `setq' an alist of your choice
;; for `prettify-symbols-alist'.
;;; Code:
(defconst
scala-mode-pretty-bool-alist
'(("<=" . ?≤)
(">=" . ?≥)
("==" . ?≡)
("===" . ?≣)
("!" . ?¬)
("!=" . ?≢)
("&&" . ?∧)
("||" . ?∨)
("true" . ?⊤)
("false" . ?⊥)
("Boolean" . ?𝔹))
"Prettify rules for boolean related operations.")
(defconst
scala-mode-pretty-collection-alist
'(("empty" . ?∅)
("sum" . ?∑)
("product" . ?∏)
("contains" . ?∍)
("forall" . ?∀)
("any" . ?∃)
("intersect" . ?∩)
("union" . ?∪)
("diff" . ?≏)
("subsetOf" . ?⊆)
("++" . ?⧺)
("::" . ?⸬)
("--" . ?╌))
"Prettify rules for collections related operations.")
(defconst
scala-mode-pretty-arrows-alist
'(("->" . ?→)
("<-" . ?←)
("=>" . ?⇒)
("<=>" . ?⇔)
("-->" . ?⟶)
("<->" . ?↔)
("<--" . ?⟵)
("<-->" . ?⟷)
("==>" . ?⟹)
("<==" . ?⟸)
("<==>" . ?⟺)
("~>" . ?⇝)
("<~" . ?⇜))
"Prettify rules for arrow related code pieces.")
(defconst
scala-mode-pretty-misc-alist
'(("Unit" . ?∅)
("Int" . ?ℤ)
("assert" . ?⊦)
(":=" . ?≔))
"Prettify rules for other mixed code pieces.")
(defconst
scala-mode-pretty-categories-alist
'(("flatMap" . ?⤜)
(">>=" . ?⤜)
("bind" . ?⤜)
(">>" . ?≫)
("followedBy" . ?≫)
("<+>" . ?⊕))
"Prettify rules for category theory related operators (for use with cats/scalaz/...).")
(defcustom
scala-prettify-symbols-alist
(append
scala-mode-pretty-bool-alist
scala-mode-pretty-collection-alist
scala-mode-pretty-arrows-alist
scala-mode-pretty-misc-alist
scala-mode-pretty-categories-alist)
"All prettify rules to be applied in scala code."
:type 'alist
:group 'scala)
(provide 'scala-mode-prettify-symbols)
;;; scala-mode-prettify-symbols.el ends here
|