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

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

[elpa] externals/smalltalk-mode aaa7cb0 17/34: improve smalltalk.el dete


From: Stefan Monnier
Subject: [elpa] externals/smalltalk-mode aaa7cb0 17/34: improve smalltalk.el detection of a new method's indent
Date: Tue, 9 Apr 2019 22:30:44 -0400 (EDT)

branch: externals/smalltalk-mode
commit aaa7cb00844b56cbc3a2298bd4ebe307aec34480
Author: Mathieu Suen <address@hidden>
Commit: Paolo Bonzini <address@hidden>

    improve smalltalk.el detection of a new method's indent
---
 smalltalk-mode.el | 18 ++++++++++++++++--
 1 file changed, 16 insertions(+), 2 deletions(-)

diff --git a/smalltalk-mode.el b/smalltalk-mode.el
index 78bf95e..1af2f1d 100644
--- a/smalltalk-mode.el
+++ b/smalltalk-mode.el
@@ -569,7 +569,7 @@ expressions."
 
                       ;; we're top level
                       (setq indent-amount (smalltalk-toplevel-indent nil))))
-                   ((= (preceding-char) ?.) ;at end of statement
+                   ((smalltalk-at-end-of-statement) ;end of statement or after 
temps
                     (smalltalk-find-statement-begin)
                     (setq indent-amount (smalltalk-current-column)))
                    ((= (preceding-char) ?:)
@@ -590,6 +590,21 @@ expressions."
              (+ (smalltalk-current-column)
                 smalltalk-indent-amount)))))))
 
+(defun smalltalk-at-end-of-statement ()
+  (save-excursion
+    (or (= (preceding-char) ?.)
+       (and (= (preceding-char) ?|)
+            (progn
+              (backward-char 1)
+              (while (and (not (bobp)) (looking-back "[ \t\na-zA-Z]"))
+                (skip-chars-backward " \t\n")
+                (skip-chars-backward "a-zA-Z"))
+              (if (= (preceding-char) ?|) 
+                  (progn
+                    (backward-char 1)
+                    (skip-chars-backward " \t\n")))
+              (bobp))))))
+
 (defun smalltalk-calculate-indent ()
     (cond
      ((smalltalk-at-begin-of-scope) (smalltalk-toplevel-indent t))
@@ -632,7 +647,6 @@ or non-white space, non-comment character"
                (= (preceding-char) ?\"))
     (search-backward "\"" nil t 2)))
        
-
 (defun smalltalk-current-column ()
   "Returns the current column of the given line, regardless of narrowed 
buffer."
   (save-restriction



reply via email to

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