summaryrefslogtreecommitdiff
path: root/lisp/outline.el
diff options
context:
space:
mode:
authorEli Zaretskii <eliz@gnu.org>2006-12-22 22:57:15 +0000
committerEli Zaretskii <eliz@gnu.org>2006-12-22 22:57:15 +0000
commitcf27cc8311fea87cb0c4181b47e2cf88929a8de2 (patch)
tree48474d02ce5ff57a6c701649a97d1a709eca15b2 /lisp/outline.el
parentf321348b56a0318ab6062965ec4247c498474c0c (diff)
downloademacs-cf27cc8311fea87cb0c4181b47e2cf88929a8de2.tar.gz
(outline-next-visible-heading): Fix the case with a header at end-of-file
with no final newline.
Diffstat (limited to 'lisp/outline.el')
-rw-r--r--lisp/outline.el31
1 files changed, 18 insertions, 13 deletions
diff --git a/lisp/outline.el b/lisp/outline.el
index b44fd288bfc..95594ebec9f 100644
--- a/lisp/outline.el
+++ b/lisp/outline.el
@@ -652,19 +652,24 @@ A heading line is one that starts with a `*' (or that
(if (< arg 0)
(beginning-of-line)
(end-of-line))
- (while (and (not (bobp)) (< arg 0))
- (while (and (not (bobp))
- (re-search-backward (concat "^\\(?:" outline-regexp "\\)")
- nil 'move)
- (outline-invisible-p)))
- (setq arg (1+ arg)))
- (while (and (not (eobp)) (> arg 0))
- (while (and (not (eobp))
- (re-search-forward (concat "^\\(?:" outline-regexp "\\)")
- nil 'move)
- (outline-invisible-p (match-beginning 0))))
- (setq arg (1- arg)))
- (beginning-of-line))
+ (let (found-heading-p)
+ (while (and (not (bobp)) (< arg 0))
+ (while (and (not (bobp))
+ (setq found-heading-p
+ (re-search-backward
+ (concat "^\\(?:" outline-regexp "\\)")
+ nil 'move))
+ (outline-invisible-p)))
+ (setq arg (1+ arg)))
+ (while (and (not (eobp)) (> arg 0))
+ (while (and (not (eobp))
+ (setq found-heading-p
+ (re-search-forward
+ (concat "^\\(?:" outline-regexp "\\)")
+ nil 'move))
+ (outline-invisible-p (match-beginning 0))))
+ (setq arg (1- arg)))
+ (if found-heading-p (beginning-of-line))))
(defun outline-previous-visible-heading (arg)
"Move to the previous heading line.