mirror of
https://git.savannah.gnu.org/git/emacs.git
synced 2024-11-23 07:19:15 +00:00
(sh-indent-line): Avoid infinite loop
on indented line at start of buffer, when calculating PREVIOUS.
This commit is contained in:
parent
d343b6f10a
commit
54c87e2714
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user