Mercurial > emacs
comparison lisp/textmodes/outline.el @ 25148:01b59199fcbc
(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.
author | Richard M. Stallman <rms@gnu.org> |
---|---|
date | Sun, 01 Aug 1999 16:26:59 +0000 |
parents | a08dbf9b97ed |
children | 0ac130f2181a |
comparison
equal
deleted
inserted
replaced
25147:820b95325cb5 | 25148:01b59199fcbc |
---|---|
164 "Additional expressions to highlight in Outline mode.") | 164 "Additional expressions to highlight in Outline mode.") |
165 | 165 |
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)) |
176 | 176 |
177 (defvar outline-view-change-hook nil | 177 (defvar outline-view-change-hook nil |
642 (point)) | 642 (point)) |
643 (progn (outline-end-of-heading) (point)) | 643 (progn (outline-end-of-heading) (point)) |
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. | |
649 This function considers both visible and invisible heading lines. | |
650 With 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). | |
665 With argument, repeats or can move backward if negative. | |
666 A 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. |
649 With argument, move up ARG levels." | 685 With argument, move up ARG levels." |
650 (interactive "p") | 686 (interactive "p") |
651 (outline-back-to-heading) | 687 (outline-back-to-heading) |
652 (if (eq (funcall outline-level) 1) | 688 (if (eq (funcall outline-level) 1) |
653 (error "Already at top level of the outline")) | 689 (error "Already at top level of the outline")) |