changeset 21544:95ec24fc6d78

(outline-font-lock-level): New function.
author Karl Heuer <kwzh@gnu.org>
date Wed, 15 Apr 1998 06:28:28 +0000
parents 55865851fd69
children 2c4281059c0a
files lisp/textmodes/outline.el
diffstat 1 files changed, 17 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/textmodes/outline.el	Wed Apr 15 06:12:48 1998 +0000
+++ b/lisp/textmodes/outline.el	Wed Apr 15 06:28:28 1998 +0000
@@ -47,7 +47,7 @@
 ;; already assigned a local value to it.
 (or (default-value 'outline-regexp)
     (setq-default outline-regexp "[*\^L]+"))
-  
+
 (defcustom outline-heading-end-regexp "\n"
   "*Regular expression to match the end of a heading line.
 You can assume that point is at the beginning of a heading when this
@@ -163,6 +163,17 @@
 		  nil t)))
   "Additional expressions to highlight in Outline mode.")
 
+(defun outline-font-lock-level ()
+  (let ((count 1))
+    (save-excursion
+      (outline-back-to-heading)
+      (condition-case nil
+	  (while (not (bobp))
+	    (outline-up-heading 1)
+	    (setq count (1+ count)))
+	(error)))
+    count))
+
 (defvar outline-view-change-hook nil
   "Normal hook to be run after outline visibility changes.")
 
@@ -170,10 +181,10 @@
 (defun outline-mode ()
   "Set major mode for editing outlines with selective display.
 Headings are lines which start with asterisks: one for major headings,
-two for subheadings, etc.  Lines not starting with asterisks are body lines. 
+two for subheadings, etc.  Lines not starting with asterisks are body lines.
 
 Body text or subheadings under a heading can be made temporarily
-invisible, or visible again.  Invisible lines are attached to the end 
+invisible, or visible again.  Invisible lines are attached to the end
 of the heading, so they move with it, if the line is killed and yanked
 back.  A heading with text hidden under it is marked with an ellipsis (...).
 
@@ -441,7 +452,7 @@
 	    ;; or delete it entirely (if it is contained in beg...end).
 	    (if (< (overlay-start o) beg)
 		(if (> (overlay-end o) end)
-		    (progn 
+		    (progn
 		      (setq o1 (outline-copy-overlay o))
 		      (move-overlay o1 (overlay-start o1) beg)
 		      (move-overlay o end (overlay-end o)))
@@ -644,7 +655,7 @@
   (outline-back-to-heading)
   (while (> arg 0)
     (let ((point-to-move-to (save-excursion
-			      (outline-get-next-sibling))))  
+			      (outline-get-next-sibling))))
       (if point-to-move-to
 	  (progn
 	    (goto-char point-to-move-to)
@@ -663,7 +674,7 @@
     (if (< (funcall outline-level) level)
 	nil
       (point))))
-	
+
 (defun outline-backward-same-level (arg)
   "Move backward to the ARG'th subheading at same level as this one.
 Stop at the first and last subheadings of a superior heading."