Skip to content
Browse files

Merge branch 'fix/#247-indent-region-first-line' into develop

  • Loading branch information...
2 parents 75b72ae + f3992fb commit 1937adad91baae2ef2ecf146b2e4df7650639c65 @x022235 x022235 committed May 26, 2012
Showing with 28 additions and 2 deletions.
  1. +5 −2 lisp/lispmode.l
  2. +23 −0 unittest/editor-tests.l
View
7 lisp/lispmode.l
@@ -326,11 +326,14 @@
(goto-char from)
(goto-eol)
(delete-trailing-spaces)
- (while (forward-line 1)
+ (loop
(goto-eol)
(delete-trailing-spaces)
(unless (bolp)
- (funcall mode-specific-indent-command)))))
+ (funcall mode-specific-indent-command))
+ (unless (forward-line 1)
+ (return))
+ )))
t)
(defun indent-sexp ()
View
23 unittest/editor-tests.l
@@ -1047,3 +1047,26 @@
:options (format nil "-ini \"~A\" -q" ini-path1)
:environ `(("XYZZYINIFILE" . ,ini-path2)))))
=> t)
+
+
+(deftest lisp-mode-indent-region-first-line ()
+ (with-temp-buffer
+ (insert " (defvar foo 1)" #\LFD)
+ (insert " (defvar bar 2)" #\LFD)
+ (lisp-mode)
+ (indent-region (point-min) (point-max))
+ (buffer-substring (point-min) (point-max)))
+ => "(defvar foo 1)
+(defvar bar 2)
+")
+
+(deftest c-mode-indent-region-first-line ()
+ (with-temp-buffer
+ (insert " #define FOO 1" #\LFD)
+ (insert " #define BAR 2" #\LFD)
+ (c-mode)
+ (indent-region (point-min) (point-max))
+ (buffer-substring (point-min) (point-max)))
+ => "#define FOO 1
+#define BAR 2
+")

0 comments on commit 1937ada

Please sign in to comment.
Something went wrong with that request. Please try again.