Commits

Joe Bogner  committed 807cc40

refactor org-next-sibling

  • Participants
  • Parent commits 5b1572c

Comments (0)

Files changed (1)

 
 
 (de collectUntil (Lst Func)
-	(let (Z NIL) (find '((X) (if (Func X) T (push 'Z X) NIL)) Lst) (reverse Z)))
+	(let (Ret NIL) (find '((X) (if (Func X) T (push 'Ret X) NIL)) Lst) (reverse Ret)))
 
 (de org-parse-level (Line)
  (- (length (split (chop Line) "*")) 1))
 
-(de org-parse-body2 (Lines)
-  (let (Ret '())
-       (while Lines
-	 (if (> (org-parse-level (car Lines)) 0)
-	     (setq Lines NIL)
-	   (setq Ret (cons (car Lines) Ret)))
-	 (setq Lines (cdr Lines)))
-			 Ret))
-
 (de org-parse-body (Lines)
 	(collectUntil Lines '((Line) (> (org-parse-level Line) 0))))
 
   (if Lines (org-parse Lines Level)))
 
 (de org-next-sibling (Level Lines)
-  (let (Go Lines)
-    (while (and Lines Go)
-      (let (NextLevel (org-parse-level (car Lines)))
-	(unless (or (= NextLevel 0) (> NextLevel Level))
-	  (setq Go NIL)))
-	(if Go
-	  (setq Lines (cdr Lines)))))
-  Lines)
+	(seek '((Line) (org-parse-level Line) (or (= @ 0) (> @ Level))) Lines))
 
 (de org-parse-heading (Line Level Lines)
   (when (> Level 0)