summaryrefslogtreecommitdiff
path: root/lisp/emacs-lisp/lisp-mode.el
diff options
context:
space:
mode:
Diffstat (limited to 'lisp/emacs-lisp/lisp-mode.el')
-rw-r--r--lisp/emacs-lisp/lisp-mode.el7
1 files changed, 5 insertions, 2 deletions
diff --git a/lisp/emacs-lisp/lisp-mode.el b/lisp/emacs-lisp/lisp-mode.el
index ceea24168ef..38d607d3b25 100644
--- a/lisp/emacs-lisp/lisp-mode.el
+++ b/lisp/emacs-lisp/lisp-mode.el
@@ -1082,8 +1082,11 @@ and initial semicolons."
(narrow-to-region
;; Find the first line we should include in the region to fill.
(save-excursion
- (while (and (looking-at "[ \t]*;")
- (zerop (forward-line -1))))
+ (while (and (zerop (forward-line -1))
+ (looking-at "[ \t]*;")))
+ ;; We may have gone too far. Go forward again.
+ (or (looking-at ".*;")
+ (forward-line 1))
(point))
;; Find the beginning of the first line past the region to fill.
(save-excursion