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

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

[nongnu] elpa/scala-mode c20d6e6 164/217: Merge pull request #101 from f


From: ELPA Syncer
Subject: [nongnu] elpa/scala-mode c20d6e6 164/217: Merge pull request #101 from fommil/remove-post-insert-hook
Date: Sun, 29 Aug 2021 11:31:05 -0400 (EDT)

branch: elpa/scala-mode
commit c20d6e6df028f055e69066aa75d571e520ff0670
Merge: 360b5ba 618f0fb
Author: Heikki Vesalainen <heikki.vesalainen@iki.fi>
Commit: Heikki Vesalainen <heikki.vesalainen@iki.fi>

    Merge pull request #101 from fommil/remove-post-insert-hook
    
    remove 'scala-indent:indent-on-parentheses in preference of smartparens
---
 README.md             | 10 ++++++++++
 scala-mode2-indent.el |  5 -----
 scala-mode2-map.el    |  2 --
 3 files changed, 10 insertions(+), 7 deletions(-)

diff --git a/README.md b/README.md
index a86bd4a..08f2a4c 100644
--- a/README.md
+++ b/README.md
@@ -469,6 +469,16 @@ in most files:
 (scala-mode:goto-start-of-code)
 ```
 
+## Auto parentheses formatting
+
+We recommend using [smartparens](https://github.com/Fuco1/smartparens) to
+automatically format parentheses on insertion, e.g. with
+
+```elisp
+  (sp-local-pair 'scala-mode "(" nil :post-handlers '(("||\n[i]" "RET")))
+  (sp-local-pair 'scala-mode "{" nil :post-handlers '(("||\n[i]" "RET") ("| " 
"SPC")))
+```
+
 ## Other features
 - highlights only properly formatted string and character constants
 - indenting a code line removes trailing whitespace
diff --git a/scala-mode2-indent.el b/scala-mode2-indent.el
index bb059f7..720a028 100644
--- a/scala-mode2-indent.el
+++ b/scala-mode2-indent.el
@@ -841,11 +841,6 @@ comment is outside the comment region. "
          (+ (match-beginning 0) 1)))
       (current-column))))
 
-(defun scala-indent:indent-on-parentheses ()
-  (when (and (= (char-syntax (char-before)) ?\))
-             (= (save-excursion (back-to-indentation) (point)) (1- (point))))
-    (scala-indent:indent-line)))
-
 (defconst scala-indent:indent-on-words-re
   (concat "^\\s *"
           (regexp-opt '("catch" "case" "else" "finally" "yield") 'words)))
diff --git a/scala-mode2-map.el b/scala-mode2-map.el
index 70e3ae4..e6cfc5c 100644
--- a/scala-mode2-map.el
+++ b/scala-mode2-map.el
@@ -13,8 +13,6 @@
 
 (defun scala-mode-map:add-self-insert-hooks ()
   (add-hook 'post-self-insert-hook
-            'scala-indent:indent-on-parentheses)
-  (add-hook 'post-self-insert-hook
             'scala-indent:indent-on-special-words)
   (add-hook 'post-self-insert-hook
             'scala-indent:indent-on-scaladoc-asterisk)



reply via email to

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