emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[nongnu] elpa/scala-mode d1fbe2d 171/217: Implemented prettify/conceal w


From: ELPA Syncer
Subject: [nongnu] elpa/scala-mode d1fbe2d 171/217: Implemented prettify/conceal with a base set of rules. (#108)
Date: Sun, 29 Aug 2021 11:31:06 -0400 (EDT)

branch: elpa/scala-mode
commit d1fbe2d2155c1d74a3d3cabe4a0d63c8bb283cbf
Author: Merlin Göttlinger <megoettlinger@gmail.com>
Commit: Sam Halliday <sam.halliday@gmail.com>

    Implemented prettify/conceal with a base set of rules. (#108)
    
    * Initial set of prettify rules
    
    * Renamed prettify to prettify-symbols
    
    * Removed automatic hook in favor of manualyy added hook when required
    
    * Added utf-8 annotation and fixed comment
    
    * Defcustom instead of const and added a few rules
---
 scala-mode2-prettify-symbols.el | 74 +++++++++++++++++++++++++++++++++++++++++
 scala-mode2.el                  |  1 +
 2 files changed, 75 insertions(+)

diff --git a/scala-mode2-prettify-symbols.el b/scala-mode2-prettify-symbols.el
new file mode 100644
index 0000000..fe4d8fa
--- /dev/null
+++ b/scala-mode2-prettify-symbols.el
@@ -0,0 +1,74 @@
+;;; 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 -*-
+
+(defcustom scala-mode-pretty-bool-alist '(
+                                         ("<=" . ?≤)
+                                         (">=" . ?≥)
+                                         ("==" . ?≡)
+                                         ("===" . ?≣)
+                                         ("!" . ?¬)
+                                         ("!=" . ?≢)
+                                         ("&&" . ?∧)
+                                         ("||" . ?∨)
+                                         ("true" . ?⊤)
+                                         ("false" . ?⊥)
+                                         ("Boolean" . ?𝔹))
+  "Prettify rules for boolean related operations."
+  :type 'alist)
+
+(defcustom scala-mode-pretty-collection-alist '(
+                                               ("empty" . ?∅)
+                                               ("sum" . ?∑)
+                                               ("product" . ?∏)
+                                               ("contains" . ?∍)
+                                               ("forall" . ?∀)
+                                               ("any" . ?∃)
+                                               ("intersect" . ?∩)
+                                               ("union" . ?∪)
+                                               ("diff" . ?≏)
+                                               ("subsetOf" . ?⊆)
+                                               ("++" . ?⧺)
+                                               ("::" . ?⸬)
+                                               ("--" . ?╌))
+  "Prettify rules for collections related operations."
+  :type 'alist)
+
+(defcustom scala-mode-pretty-arrows-alist'(
+                                          ("->" . ?→)
+                                          ("<-" . ?←)
+                                          ("=>" . ?⇒)
+                                       ;("<=" . ?⇐)
+                                          ("<=>" . ?⇔)
+                                          ("-->" . ?⟶)
+                                          ("<->" . ?↔)
+                                          ("<--" . ?⟵)
+                                          ("<-->" . ?⟷)
+                                          ("==>" . ?⟹)
+                                          ("<==" . ?⟸)
+                                          ("<==>" . ?⟺)
+                                          ("~>" . ?⇝)
+                                          ("<~" . ?⇜))
+  "Prettify rules for arrow related code pieces."
+  :type 'alist)
+
+(defcustom scala-mode-pretty-misc-alist '(
+                                       ;("null" . ?∅)
+                                       ;("Nothing" . ?∅)
+                                         ("Unit" . ?∅)
+                                         ("Int" . ?ℤ)
+                                         ("assert" . ?⊦)
+                                         (":=" . ?≔))
+  "Prettify rules for other mixed code pieces."
+  :type 'alist)
+
+(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)
+
+(provide 'scala-mode2-prettify-symbols)
diff --git a/scala-mode2.el b/scala-mode2.el
index 886dc4a..a0158c0 100644
--- a/scala-mode2.el
+++ b/scala-mode2.el
@@ -21,6 +21,7 @@
 (require 'scala-mode2-map)
 (require 'scala-mode2-sbt)
 (require 'scala-mode2-imenu)
+(require 'scala-mode2-prettify-symbols)
 
 ;; Tested only for emacs 24
 (unless (<= 24 emacs-major-version)



reply via email to

[Prev in Thread] Current Thread [Next in Thread]