changeset 4623:3c1c4e9a4464

(outline-level): New var. Everything funcalls this instead of calling outline-level.
author Richard M. Stallman <rms@gnu.org>
date Sat, 14 Aug 1993 09:13:23 +0000
parents a55b9c08e4af
children 62564c5e2df7
files lisp/textmodes/ooutline.el
diffstat 1 files changed, 21 insertions(+), 17 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/textmodes/ooutline.el	Sat Aug 14 09:08:50 1993 +0000
+++ b/lisp/textmodes/ooutline.el	Sat Aug 14 09:13:23 1993 +0000
@@ -1,6 +1,6 @@
 ;;; outline.el --- outline mode commands for Emacs
 
-;; Copyright (C) 1986 Free Software Foundation, Inc.
+;; Copyright (C) 1986, 1993 Free Software Foundation, Inc.
 
 ;; Maintainer: FSF
 
@@ -196,6 +196,10 @@
 	(run-hooks 'outline-minor-mode-hook))
     (setq selective-display nil)))
 
+(defvar outline-level 'outline-level
+  "Function of no args to compute a header's nesting level in an outline.
+It can assume point is at the beginning of a header line.")
+
 (defun outline-level ()
   "Return the depth to which a statement is nested in the outline.
 Point must be at the beginning of a header line.  This is actually
@@ -337,9 +341,9 @@
   (outline-back-to-heading)
   (let ((opoint (point))
 	(first t)
-	(level (outline-level)))
+	(level (funcall outline-level)))
     (while (and (not (eobp))
-		(or first (> (outline-level) level)))
+		(or first (> (funcall outline-level) level)))
       (setq first nil)
       (outline-next-heading))
     (forward-char -1)
@@ -360,13 +364,13 @@
 	(if level (prefix-numeric-value level)
 	  (save-excursion
 	    (beginning-of-line)
-	    (let ((start-level (outline-level)))
+	    (let ((start-level (funcall outline-level)))
 	      (outline-next-heading)
-	      (max 1 (- (outline-level) start-level))))))
+	      (max 1 (- (funcall outline-level) start-level))))))
   (save-excursion
    (save-restriction
     (beginning-of-line)
-    (setq level (+ level (outline-level)))
+    (setq level (+ level (funcall outline-level)))
     (narrow-to-region (point)
 		      (progn (outline-end-of-subtree) (1+ (point))))
     (goto-char (point-min))
@@ -374,7 +378,7 @@
 		(progn
 		 (outline-next-heading)
 		 (not (eobp))))
-      (if (<= (outline-level) level)
+      (if (<= (funcall outline-level) level)
 	  (save-excursion
 	    (outline-flag-region (save-excursion
 				   (forward-char -1)
@@ -389,13 +393,13 @@
 With argument, move up ARG levels."
   (interactive "p")
   (outline-back-to-heading)
-  (if (eq (outline-level) 1)
+  (if (eq (funcall outline-level) 1)
       (error ""))
-    (while (and (> (outline-level) 1)
+    (while (and (> (funcall outline-level) 1)
 		(> arg 0)
 		(not (bobp)))
-      (let ((present-level (outline-level)))
-	(while (not (< (outline-level) present-level))
+      (let ((present-level (funcall outline-level)))
+	(while (not (< (funcall outline-level) present-level))
 	  (outline-previous-visible-heading 1))
 	(setq arg (- arg 1)))))
 
@@ -418,12 +422,12 @@
 (defun outline-get-next-sibling ()
   "Position the point at the next heading of the same level, 
 and return that position or nil if it cannot be found."
-  (let ((level (outline-level)))
+  (let ((level (funcall outline-level)))
     (outline-next-visible-heading 1)
-    (while (and (> (outline-level) level)
+    (while (and (> (funcall outline-level) level)
 		(not (eobp)))
       (outline-next-visible-heading 1))
-    (if (< (outline-level) level)
+    (if (< (funcall outline-level) level)
 	nil
       (point))))
 	
@@ -446,12 +450,12 @@
 (defun outline-get-last-sibling ()
   "Position the point at the previous heading of the same level, 
 and return that position or nil if it cannot be found."
-  (let ((level (outline-level)))
+  (let ((level (funcall outline-level)))
     (outline-previous-visible-heading 1)
-    (while (and (> (outline-level) level)
+    (while (and (> (funcall outline-level) level)
 		(not (bobp)))
       (outline-previous-visible-heading 1))
-    (if (< (outline-level) level)
+    (if (< (funcall outline-level) level)
 	nil
         (point))))