]> git.eshelyaron.com Git - sweep.git/commitdiff
ADDED: (sweep-indent-line-ends-with-prefix-operator): New function
authorEshel Yaron <me@eshelyaron.com>
Mon, 12 Sep 2022 07:58:15 +0000 (10:58 +0300)
committerEshel Yaron <me@eshelyaron.com>
Mon, 12 Sep 2022 08:07:04 +0000 (11:07 +0300)
(sweep-indent-line-indentation): use it

sweep.el

index 914155704f7bf49fdfd7f00733ada7ae616f14a3..f3b192942cef9ee9926f75d2591cf6a8783ac352 100644 (file)
--- a/sweep.el
+++ b/sweep.el
@@ -1110,7 +1110,7 @@ Interactively, a prefix arg means to prompt for BUFFER."
        ((sweep-indent-line-ends-with-else point))
        ((sweep-indent-line-ends-with-arg point))
        ((sweep-indent-line-ends-with-neck-p)              4)
-       ;; ((sweep-indent-line-ends-with-prefix-operator))
+       ((sweep-indent-line-ends-with-prefix-operator))
        (t (sweep-indent-line-fallback))))))
 
 (defun sweep-indent-line-fallback ()
@@ -1120,6 +1120,15 @@ Interactively, a prefix arg means to prompt for BUFFER."
     (back-to-indentation)
     (current-column)))
 
+(defun sweep-indent-line-ends-with-prefix-operator ()
+  (save-excursion
+    (end-of-line)
+    (skip-syntax-backward " ")
+    (when-let ((symbol (symbol-at-point)))
+      (when (member (symbol-name symbol) (sweep-prefix-operators))
+        (skip-syntax-backward "w_")
+        (+ (current-column) 4)))))
+
 (defun sweep-indent-line-ends-with-if ()
   (save-excursion
     (end-of-line)