changeset 12604:140e46e751a0

(outline-next-visible-heading): Rewritten to handle backwards motion and handle beg/end of buffer properly.
author Richard M. Stallman <rms@gnu.org>
date Wed, 19 Jul 1995 03:19:03 +0000
parents 6d033c8501d4
children c5798bb57fdd
files lisp/textmodes/outline.el
diffstat 1 files changed, 12 insertions(+), 10 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/textmodes/outline.el	Tue Jul 18 23:59:23 1995 +0000
+++ b/lisp/textmodes/outline.el	Wed Jul 19 03:19:03 1995 +0000
@@ -331,16 +331,18 @@
   (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)