branch: elpa/scala-mode commit ee375b9357a71d77763e219dac15850ed60530b3 Author: Sam Halliday <sam.halli...@gmail.com> Commit: Sam Halliday <sam.halli...@gmail.com>
idiomatic emacs lisp cleanups --- scala-mode2-prettify-symbols.el | 141 +++++++++++++++++++++------------------- 1 file changed, 75 insertions(+), 66 deletions(-) diff --git a/scala-mode2-prettify-symbols.el b/scala-mode2-prettify-symbols.el index fe4d8fa..ca43431 100644 --- a/scala-mode2-prettify-symbols.el +++ b/scala-mode2-prettify-symbols.el @@ -1,74 +1,83 @@ -;;; scala-mode2-prettify-symbols.el - Extension of scala-mode for prettifying scala symbols/code -;;; Copyright (c) 2016 Merlin Göttlinger -;;; For information on the License, see the LICENSE file -;; -*- coding: UTF-8 -*- +;;; scala-mode2-prettify-symbols.el --- Prettifying scala symbols -*- coding: utf-8; -*- -(defcustom scala-mode-pretty-bool-alist '( - ("<=" . ?≤) - (">=" . ?≥) - ("==" . ?≡) - ("===" . ?≣) - ("!" . ?¬) - ("!=" . ?≢) - ("&&" . ?∧) - ("||" . ?∨) - ("true" . ?⊤) - ("false" . ?⊥) - ("Boolean" . ?𝔹)) - "Prettify rules for boolean related operations." - :type 'alist) +;; Copyright (c) 2016 Merlin Göttlinger +;; License: http://www.gnu.org/licenses/gpl.html -(defcustom scala-mode-pretty-collection-alist '( - ("empty" . ?∅) - ("sum" . ?∑) - ("product" . ?∏) - ("contains" . ?∍) - ("forall" . ?∀) - ("any" . ?∃) - ("intersect" . ?∩) - ("union" . ?∪) - ("diff" . ?≏) - ("subsetOf" . ?⊆) - ("++" . ?⧺) - ("::" . ?⸬) - ("--" . ?╌)) - "Prettify rules for collections related operations." - :type 'alist) +;;; Commentary: +;; +;; Suggested `prettify-symbols' for Scala editing, enable +;; `prettify-symbols-mode' and `setq' an alist of your choice +;; for `prettify-symbols-alist'. -(defcustom scala-mode-pretty-arrows-alist'( - ("->" . ?→) - ("<-" . ?←) - ("=>" . ?⇒) - ;("<=" . ?⇐) - ("<=>" . ?⇔) - ("-->" . ?⟶) - ("<->" . ?↔) - ("<--" . ?⟵) - ("<-->" . ?⟷) - ("==>" . ?⟹) - ("<==" . ?⟸) - ("<==>" . ?⟺) - ("~>" . ?⇝) - ("<~" . ?⇜)) - "Prettify rules for arrow related code pieces." - :type 'alist) +;;; Code: -(defcustom scala-mode-pretty-misc-alist '( - ;("null" . ?∅) - ;("Nothing" . ?∅) - ("Unit" . ?∅) - ("Int" . ?ℤ) - ("assert" . ?⊦) - (":=" . ?≔)) - "Prettify rules for other mixed code pieces." - :type 'alist) +(defconst + scala-mode-pretty-bool-alist + '(("<=" . ?≤) + (">=" . ?≥) + ("==" . ?≡) + ("===" . ?≣) + ("!" . ?¬) + ("!=" . ?≢) + ("&&" . ?∧) + ("||" . ?∨) + ("true" . ?⊤) + ("false" . ?⊥) + ("Boolean" . ?𝔹)) + "Prettify rules for boolean related operations.") -(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) +(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.") + +(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) "All prettify rules to be applied in scala code." - :type 'alist) + :type 'alist + :group 'scala) (provide 'scala-mode2-prettify-symbols) +;;; scala-mode2-prettify-symbols.el ends here