Commit 54c87e27 authored by Richard M. Stallman's avatar Richard M. Stallman
Browse files

(sh-indent-line): Avoid infinite loop

on indented line at start of buffer, when calculating PREVIOUS.
parent d343b6f1
......@@ -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
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment