branch: elpa/jade-mode
commit 40efeb499a8a1f0ec03275cd80313121db2da6c5
Author: Sterling Graham <[email protected]>
Commit: Sterling Graham <[email protected]>
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"