summaryrefslogtreecommitdiff
path: root/lisp/textmodes
diff options
context:
space:
mode:
authorRichard M. Stallman <rms@gnu.org>1995-07-19 03:19:03 +0000
committerRichard M. Stallman <rms@gnu.org>1995-07-19 03:19:03 +0000
commit01946cf4a4e12bbc3d401947254208b52ac811b2 (patch)
tree76bc1388c8d9c75f3e3d06cd91d46e6f966fdf9b /lisp/textmodes
parent44a32030a1742edaedde46d04a66136a9beaa4ec (diff)
downloademacs-01946cf4a4e12bbc3d401947254208b52ac811b2.tar.gz
(outline-next-visible-heading): Rewritten to handle
backwards motion and handle beg/end of buffer properly.
Diffstat (limited to 'lisp/textmodes')
-rw-r--r--lisp/textmodes/outline.el22
1 files changed, 12 insertions, 10 deletions
diff --git a/lisp/textmodes/outline.el b/lisp/textmodes/outline.el
index b169396ef20..84d95ef36e7 100644
--- a/lisp/textmodes/outline.el
+++ b/lisp/textmodes/outline.el
@@ -331,16 +331,18 @@ A heading line is one that starts with a `*' (or that
(if (< arg 0)
(beginning-of-line)
(end-of-line))
- (let (found)
- (or (while (and found (> arg 0))
- (setq found nil)
- (while (not found)
- (setq found
- (and (re-search-backward (concat "^\\(" outline-regexp "\\)")
- nil t)
- (outline-visible))))
- (setq arg (1- arg)))
- (error "")))
+ (while (and (not (bobp)) (< arg 0))
+ (while (and (not (bobp))
+ (re-search-backward (concat "^\\(" outline-regexp "\\)")
+ nil 'move)
+ (not (outline-visible))))
+ (setq arg (1+ arg)))
+ (while (and (not (eobp)) (> arg 0))
+ (while (and (not (eobp))
+ (re-search-forward (concat "^\\(" outline-regexp "\\)")
+ nil 'move)
+ (not (outline-visible))))
+ (setq arg (1- arg)))
(beginning-of-line))
(defun outline-previous-visible-heading (arg)