]> git.eshelyaron.com Git - emacs.git/commitdiff
(sh-indent-line): Avoid infinite loop
authorRichard M. Stallman <rms@gnu.org>
Sat, 23 Aug 1997 05:19:09 +0000 (05:19 +0000)
committerRichard M. Stallman <rms@gnu.org>
Sat, 23 Aug 1997 05:19:09 +0000 (05:19 +0000)
on indented line at start of buffer, when calculating PREVIOUS.

lisp/progmodes/sh-script.el

index df71e91ad3efc80994788486459b1aa23fded6d8..3e2e2d8d849ef426ee2d65c8bf25783251b3eb6d 100644 (file)
@@ -928,11 +928,13 @@ in ALIST."
 
 
 (defun sh-indent-line ()
-  "Indent as far as preceding non-empty line, then by steps of `sh-indentation'.
+  "Indent a line for Sh mode (shell script mode).
+Indent as far as preceding non-empty line, then by steps of `sh-indentation'.
 Lines containing only comments are considered empty."
   (interactive)
   (let ((previous (save-excursion
-                   (while (and (not (bobp))
+                   (while (and (progn (beginning-of-line)
+                                      (not (bobp)))
                                (progn
                                  (forward-line -1)
                                  (back-to-indentation)
@@ -940,6 +942,7 @@ Lines containing only comments are considered empty."
                                      (eq (following-char) ?#)))))
                    (current-column)))
        current)
+    (debug)
     (save-excursion
       (indent-to (if (eq this-command 'newline-and-indent)
                     previous