From: Richard M. Stallman Date: Sat, 23 Aug 1997 05:19:09 +0000 (+0000) Subject: (sh-indent-line): Avoid infinite loop X-Git-Tag: emacs-20.1~468 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=54c87e271407e94a42851cfe1c32c0591e7168f8;p=emacs.git (sh-indent-line): Avoid infinite loop on indented line at start of buffer, when calculating PREVIOUS. --- 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