aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard M. Stallman1999-08-01 16:26:59 +0000
committerRichard M. Stallman1999-08-01 16:26:59 +0000
commit39db9c5c69a5e7d10e583d64743c00045f0d1467 (patch)
treee0a7b97911dcb41481fe603dc4ad09f024975288
parenta92da273b4f0c923dd118fb801d5af17417d8f2e (diff)
downloademacs-39db9c5c69a5e7d10e583d64743c00045f0d1467.tar.gz
emacs-39db9c5c69a5e7d10e583d64743c00045f0d1467.zip
(outline-next-heading): New function.
(outline-up-heading-all): New function. (outline-font-lock-level): Using outline-up-heading-all. Tell outline-back-to-heading to accept invisible headings.
-rw-r--r--lisp/textmodes/outline.el42
1 files changed, 39 insertions, 3 deletions
diff --git a/lisp/textmodes/outline.el b/lisp/textmodes/outline.el
index e1f1a79b160..b68d34f8d7b 100644
--- a/lisp/textmodes/outline.el
+++ b/lisp/textmodes/outline.el
@@ -166,10 +166,10 @@ in the file it applies to."
166(defun outline-font-lock-level () 166(defun outline-font-lock-level ()
167 (let ((count 1)) 167 (let ((count 1))
168 (save-excursion 168 (save-excursion
169 (outline-back-to-heading) 169 (outline-back-to-heading t)
170 (condition-case nil 170 (condition-case nil
171 (while (not (bobp)) 171 (while (not (bobp))
172 (outline-up-heading 1) 172 (outline-up-heading-all 1)
173 (setq count (1+ count))) 173 (setq count (1+ count)))
174 (error))) 174 (error)))
175 count)) 175 count))
@@ -644,8 +644,44 @@ Default is enough to cause the following heading to appear."
644 nil))))))) 644 nil)))))))
645 (run-hooks 'outline-view-change-hook)) 645 (run-hooks 'outline-view-change-hook))
646 646
647(defun outline-up-heading-all (arg)
648 "Move to the heading line of which the present line is a subheading.
649This function considers both visible and invisible heading lines.
650With argument, move up ARG levels."
651 (outline-back-to-heading t)
652 (if (eq (funcall outline-level) 1)
653 (error "Already at top level of the outline"))
654 (while (and (> (funcall outline-level) 1)
655 (> arg 0)
656 (not (bobp)))
657 (let ((present-level (funcall outline-level)))
658 (while (and (not (< (funcall outline-level) present-level))
659 (not (bobp)))
660 (outline-next-heading -1))
661 (setq arg (- arg 1)))))
662
663(defun outline-next-heading (arg)
664 "Move to the next heading line (visible or invisible).
665With argument, repeats or can move backward if negative.
666A heading line is one that starts with a `*' (or that
667`outline-regexp' matches)."
668 (if (< arg 0)
669 (beginning-of-line)
670 (end-of-line))
671 (while (and (not (bobp)) (< arg 0))
672 (while (and (not (bobp))
673 (re-search-backward (concat "^\\(" outline-regexp "\\)")
674 nil 'move)))
675 (setq arg (1+ arg)))
676 (while (and (not (eobp)) (> arg 0))
677 (while (and (not (eobp))
678 (re-search-forward (concat "^\\(" outline-regexp "\\)")
679 nil 'move)))
680 (setq arg (1- arg)))
681 (beginning-of-line))
682
647(defun outline-up-heading (arg) 683(defun outline-up-heading (arg)
648 "Move to the heading line of which the present line is a subheading. 684 "Move to the visible heading line of which the present line is a subheading.
649With argument, move up ARG levels." 685With argument, move up ARG levels."
650 (interactive "p") 686 (interactive "p")
651 (outline-back-to-heading) 687 (outline-back-to-heading)