summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lisp/progmodes/sh-script.el11
1 files 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