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

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

[nongnu] elpa/jade-mode 40efeb499a 064/128: Indent using the number of l


From: ELPA Syncer
Subject: [nongnu] elpa/jade-mode 40efeb499a 064/128: Indent using the number of lines in a region instead of the location of point within the original region.
Date: Sat, 29 Jan 2022 08:24:47 -0500 (EST)

branch: elpa/jade-mode
commit 40efeb499a8a1f0ec03275cd80313121db2da6c5
Author: Sterling Graham <sterling.graham@mediavalet.com>
Commit: Sterling Graham <sterling.graham@mediavalet.com>

    Indent using the number of lines in a region instead of the location of 
point within the original region.
---
 sws-mode.el | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/sws-mode.el b/sws-mode.el
index 094211490b..902d1aac1f 100644
--- a/sws-mode.el
+++ b/sws-mode.el
@@ -82,17 +82,19 @@
 (defun sws-move-region (begin end prog)
   "Moves left is dir is null, otherwise right. prog is '+ or '-"
   (save-excursion
-    (let (first-indent indent-diff)
+    (let ((first-indent indent-diff)
+         (num-lines-indented (count-lines-region begin end))
+         )
       (goto-char begin)
       (setq first-indent (current-indentation))
       (sws-indent-to
        (funcall prog first-indent sws-tab-width))
       (setq indent-diff (- (current-indentation) first-indent))
+      (forward-line 1)
       ;; move other lines based on movement of first line
-      (while (< (point) end)
-        (forward-line 1)
-        (if (< (point) end)
-            (sws-indent-to (+ (current-indentation) indent-diff)))))))
+      (dotimes (i (- num-lines-indented 1))
+       (sws-indent-to (+ (current-indentation) indent-diff))
+       (forward-line 1)))))
 
 (defun sws-indent-region (begin end)
   "Indents the selected region"



reply via email to

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