aboutsummaryrefslogtreecommitdiffstats
path: root/lisp/textmodes
diff options
context:
space:
mode:
authorKarl Heuer1998-04-15 06:28:28 +0000
committerKarl Heuer1998-04-15 06:28:28 +0000
commitf06552d4636fc7f4d262fce4a27bc93b54375dca (patch)
treed0f5908fad79fa15765177465003f0621a79668a /lisp/textmodes
parent154a307db33a39cca1aa7dd3718c2eb713660aa7 (diff)
downloademacs-f06552d4636fc7f4d262fce4a27bc93b54375dca.tar.gz
emacs-f06552d4636fc7f4d262fce4a27bc93b54375dca.zip
(outline-font-lock-level): New function.
Diffstat (limited to 'lisp/textmodes')
-rw-r--r--lisp/textmodes/outline.el23
1 files changed, 17 insertions, 6 deletions
diff --git a/lisp/textmodes/outline.el b/lisp/textmodes/outline.el
index 80e4f5c5d76..8e596a0efe2 100644
--- a/lisp/textmodes/outline.el
+++ b/lisp/textmodes/outline.el
@@ -47,7 +47,7 @@ in the file it applies to. See also outline-heading-end-regexp."
47;; already assigned a local value to it. 47;; already assigned a local value to it.
48(or (default-value 'outline-regexp) 48(or (default-value 'outline-regexp)
49 (setq-default outline-regexp "[*\^L]+")) 49 (setq-default outline-regexp "[*\^L]+"))
50 50
51(defcustom outline-heading-end-regexp "\n" 51(defcustom outline-heading-end-regexp "\n"
52 "*Regular expression to match the end of a heading line. 52 "*Regular expression to match the end of a heading line.
53You can assume that point is at the beginning of a heading when this 53You can assume that point is at the beginning of a heading when this
@@ -163,6 +163,17 @@ in the file it applies to."
163 nil t))) 163 nil t)))
164 "Additional expressions to highlight in Outline mode.") 164 "Additional expressions to highlight in Outline mode.")
165 165
166(defun outline-font-lock-level ()
167 (let ((count 1))
168 (save-excursion
169 (outline-back-to-heading)
170 (condition-case nil
171 (while (not (bobp))
172 (outline-up-heading 1)
173 (setq count (1+ count)))
174 (error)))
175 count))
176
166(defvar outline-view-change-hook nil 177(defvar outline-view-change-hook nil
167 "Normal hook to be run after outline visibility changes.") 178 "Normal hook to be run after outline visibility changes.")
168 179
@@ -170,10 +181,10 @@ in the file it applies to."
170(defun outline-mode () 181(defun outline-mode ()
171 "Set major mode for editing outlines with selective display. 182 "Set major mode for editing outlines with selective display.
172Headings are lines which start with asterisks: one for major headings, 183Headings are lines which start with asterisks: one for major headings,
173two for subheadings, etc. Lines not starting with asterisks are body lines. 184two for subheadings, etc. Lines not starting with asterisks are body lines.
174 185
175Body text or subheadings under a heading can be made temporarily 186Body text or subheadings under a heading can be made temporarily
176invisible, or visible again. Invisible lines are attached to the end 187invisible, or visible again. Invisible lines are attached to the end
177of the heading, so they move with it, if the line is killed and yanked 188of the heading, so they move with it, if the line is killed and yanked
178back. A heading with text hidden under it is marked with an ellipsis (...). 189back. A heading with text hidden under it is marked with an ellipsis (...).
179 190
@@ -441,7 +452,7 @@ If FLAG is nil then text is shown, while if FLAG is t the text is hidden."
441 ;; or delete it entirely (if it is contained in beg...end). 452 ;; or delete it entirely (if it is contained in beg...end).
442 (if (< (overlay-start o) beg) 453 (if (< (overlay-start o) beg)
443 (if (> (overlay-end o) end) 454 (if (> (overlay-end o) end)
444 (progn 455 (progn
445 (setq o1 (outline-copy-overlay o)) 456 (setq o1 (outline-copy-overlay o))
446 (move-overlay o1 (overlay-start o1) beg) 457 (move-overlay o1 (overlay-start o1) beg)
447 (move-overlay o end (overlay-end o))) 458 (move-overlay o end (overlay-end o)))
@@ -644,7 +655,7 @@ Stop at the first and last subheadings of a superior heading."
644 (outline-back-to-heading) 655 (outline-back-to-heading)
645 (while (> arg 0) 656 (while (> arg 0)
646 (let ((point-to-move-to (save-excursion 657 (let ((point-to-move-to (save-excursion
647 (outline-get-next-sibling)))) 658 (outline-get-next-sibling))))
648 (if point-to-move-to 659 (if point-to-move-to
649 (progn 660 (progn
650 (goto-char point-to-move-to) 661 (goto-char point-to-move-to)
@@ -663,7 +674,7 @@ Stop at the first and last subheadings of a superior heading."
663 (if (< (funcall outline-level) level) 674 (if (< (funcall outline-level) level)
664 nil 675 nil
665 (point)))) 676 (point))))
666 677
667(defun outline-backward-same-level (arg) 678(defun outline-backward-same-level (arg)
668 "Move backward to the ARG'th subheading at same level as this one. 679 "Move backward to the ARG'th subheading at same level as this one.
669Stop at the first and last subheadings of a superior heading." 680Stop at the first and last subheadings of a superior heading."