summaryrefslogtreecommitdiff
path: root/lisp/progmodes
diff options
context:
space:
mode:
authorRichard M. Stallman <rms@gnu.org>1997-08-23 05:19:09 +0000
committerRichard M. Stallman <rms@gnu.org>1997-08-23 05:19:09 +0000
commitf5cdc3b94aad09f65f1b536753e206df39eb4cbe (patch)
treeea816243da1eccb0f3e108bb73347284c9c0138a /lisp/progmodes
parenteb2c3152c7da505eabc7acb529ed34d2929415ed (diff)
downloademacs-f5cdc3b94aad09f65f1b536753e206df39eb4cbe.tar.gz
(sh-indent-line): Avoid infinite loop
on indented line at start of buffer, when calculating PREVIOUS.
Diffstat (limited to 'lisp/progmodes')
-rw-r--r--lisp/progmodes/sh-script.el7
1 files changed, 5 insertions, 2 deletions
diff --git a/lisp/progmodes/sh-script.el b/lisp/progmodes/sh-script.el
index df71e91ad3e..3e2e2d8d849 100644
--- a/lisp/progmodes/sh-script.el
+++ b/lisp/progmodes/sh-script.el
@@ -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