From b46c06dea5c2dce43fb780a303b800b5f52ccd55 Mon Sep 17 00:00:00 2001 From: "Richard M. Stallman" Date: Wed, 17 Jan 1996 22:41:21 +0000 Subject: [PATCH] (sh-indent-line): Cope if no previous noncomment line. --- lisp/progmodes/sh-script.el | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/lisp/progmodes/sh-script.el b/lisp/progmodes/sh-script.el index 96db28ebf4a..3c744e66ae0 100644 --- a/lisp/progmodes/sh-script.el +++ b/lisp/progmodes/sh-script.el @@ -849,11 +849,12 @@ in ALIST." Lines containing only comments are considered empty." (interactive) (let ((previous (save-excursion - (while (progn - (line-move -1) - (back-to-indentation) - (or (eolp) - (eq (following-char) ?#)))) + (while (and (not (bobp)) + (progn + (forward-line -1) + (back-to-indentation) + (or (eolp) + (eq (following-char) ?#))))) (current-column))) current) (save-excursion -- 2.39.2