4.4BSD/usr/src/contrib/emacs-18.57/lisp/outline.elc


(defvar outline-regexp "[*]+" "\
*Regular expression to match the beginning of a heading line.
Any line whose beginning matches this regexp is considered a heading.
The recommended way to set this is with a Local Variables: list
in the file it applies to.")

(defvar outline-mode-map nil "\
")

(if outline-mode-map nil (setq outline-mode-map (copy-keymap text-mode-map)) (define-key outline-mode-map "" (quote outline-next-visible-heading)) (define-key outline-mode-map "" (quote outline-previous-visible-heading)) (define-key outline-mode-map "	" (quote show-children)) (define-key outline-mode-map "" (quote show-subtree)) (define-key outline-mode-map "" (quote hide-subtree)) (define-key outline-mode-map "" (quote outline-up-heading)) (define-key outline-mode-map "" (quote outline-forward-same-level)) (define-key outline-mode-map "" (quote outline-backward-same-level)))

(defun outline-mode nil "\
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. 

Body text or subheadings under a heading can be made temporarily
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 (...).

Commands:
C-c C-n   outline-next-visible-heading      move by visible headings
C-c C-p   outline-previous-visible-heading
C-c C-f   outline-forward-same-level        similar but skip subheadings
C-c C-b   outline-backward-same-level
C-c C-u   outline-up-heading		    move from subheading to heading

Meta-x hide-body	make all text invisible (not headings).
Meta-x show-all		make everything in buffer visible.

The remaining commands are used when point is on a heading line.
They apply to some of the body or subheadings of that heading.
C-c C-h   hide-subtree	make body and subheadings invisible.
C-c C-s   show-subtree	make body and subheadings visible.
C-c C-i   show-children	make direct subheadings visible.
		 No effect on body, or subheadings 2 or more levels down.
		 With arg N, affects subheadings N levels down.
M-x hide-entry	   make immediately following body invisible.
M-x show-entry	   make it visible.
M-x hide-leaves	   make body under heading and under its subheadings invisible.
		     The subheadings remain visible.
M-x show-branches  make all subheadings at all levels visible.

The variable outline-regexp can be changed to control what is a heading.
A line is a heading if outline-regexp matches something at the
beginning of the line.  The longer the match, the deeper the level.

Turning on outline mode calls the value of text-mode-hook and then of
outline-mode-hook, if they are non-nil." (interactive) (byte-code "ň 
!Ήω\"!!	
R	!
R\"" [selective-display t outline-mode-map mode-name major-mode nil local-abbrev-table text-mode-abbrev-table text-mode-syntax-table paragraph-start outline-regexp paragraph-separate kill-all-local-variables use-local-map "Outline" outline-mode define-abbrev-table set-syntax-table make-local-variable "\\|^\\(" "\\)" run-hooks text-mode-hook outline-mode-hook] 10))

(defun outline-level nil "\
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 the length of whatever outline-regexp matches." (byte-code "!!!Z)" [outline-regexp looking-at match-end 0 match-beginning] 5))

(defun outline-next-preface nil "\
Skip forward to just before the next heading line." (byte-code "Q#!bh>!" [outline-regexp nil re-search-forward "[

]\\(" "\\)" move match-beginning 0 (10 13) forward-char -1] 4))

(defun outline-next-heading nil "\
Move to the next (possibly invisible) heading line." (interactive) (byte-code "Q#!Tb" [outline-regexp nil re-search-forward "[

]\\(" "\\)" move match-beginning 0] 4))

(defun outline-back-to-heading nil "\
Move to previous (possibly invisible) heading line,
or to beginning of this line if it is a heading line." (byte-code "  Q#" [outline-regexp nil beginning-of-line outline-on-heading-p re-search-backward "^\\(" "\\)" move] 6))

(defun outline-on-heading-p nil "\
Return T if point is on a header line." (byte-code " h=
!)" [outline-regexp beginning-of-line 10 looking-at] 3))

(defun outline-next-visible-heading (arg) "\
Move to the next visible heading line.
With argument, repeats or can move backward if negative.
A heading line is one that starts with a `*' (or that outline-regexp matches)." (interactive "p") (byte-code "ˆW
  	Q$ " [arg outline-regexp nil 0 beginning-of-line end-of-line re-search-forward "^\\(" "\\)"] 7))

(defun outline-previous-visible-heading (arg) "\
Move to the previous heading line.
With argument, repeats or can move forward if negative.
A heading line is one that starts with a `*' (or that outline-regexp matches)." (interactive "p") (byte-code "[!" [arg nil outline-next-visible-heading] 2))

(defun outline-flag-region (from to flag) "\
Hides or shows lines from FROM to TO, according to FLAG.
If FLAG is `\\n' (newline character) then text is shown,
while if FLAG is `\\^M' (control-M) the text is hidden." (byte-code " Ǝ	
Uɂ%))" [modp from to flag t buffer-modified-p ((byte-code "!" [modp set-buffer-modified-p] 2)) subst-char-in-region 10 13] 7))

(defun hide-entry nil "\
Hide the body directly following this heading." (interactive) (byte-code " ` `#)" [nil outline-back-to-heading outline-flag-region outline-next-preface 13] 6))

(defun show-entry nil "\
Show the body directly following this heading." (interactive) (byte-code "` `#)" [nil outline-flag-region outline-next-preface 10] 5))

(defun hide-body nil "\
Hide all of buffer except headings." (interactive) (byte-code "ed\"" [nil hide-region-body] 3))

(defun hide-region-body (start end) "\
Hide all body lines in the region, but not headings." (byte-code "	\"ebm?.` `#m?*!(ɂ)!
))" [start end narrow-to-region outline-flag-region outline-next-preface 13 forward-char looking-at "[

][

]" 2 1] 7))

(defun show-all nil "\
Show all of the text in the buffer." (interactive) (byte-code "ed#" [nil outline-flag-region 10] 4))

(defun hide-subtree nil "\
Hide everything after this heading at deeper levels." (interactive) (byte-code "!" [nil outline-flag-subtree 13] 2))

(defun hide-leaves nil "\
Hide all body after this heading at deeper levels." (interactive) (byte-code " ` `\"" [nil outline-back-to-heading hide-region-body outline-end-of-subtree] 5))

(defun show-subtree nil "\
Show everything after this heading at deeper levels." (interactive) (byte-code "!" [nil outline-flag-subtree 10] 2))

(defun outline-flag-subtree (flag) (byte-code " ` `#)" [flag outline-back-to-heading outline-flag-region outline-end-of-subtree] 6))

(defun outline-end-of-subtree nil (byte-code " ` m?	 V$ĉ 
!h>2!+" [opoint first t level nil beginning-of-line outline-level outline-next-heading forward-char -1 (10 13)] 7))

(defun show-branches nil "\
Show all subheadings of this heading, but not their bodies." (interactive) (byte-code "!" [nil show-children 1000] 2))

(defun show-children (&optional level) "\
Show all direct subheadings of this heading.  Optional LEVEL specifies
how many levels below the current level should be shown." (interactive "p") (byte-code "ˆ	É  \\` `T\"ebm?, m?S XO`T!h>G!`	#))\"))" [level end nil 1 beginning-of-line outline-level narrow-to-region outline-end-of-subtree outline-next-heading forward-char -1 (10 13) outline-flag-region 10] 13))

(defun outline-up-heading (arg) "\
Move to the heading line of which the present line is a subheading.
With argument, move up ARG levels." (interactive "p") (byte-code "ˆ  =! VVo??  	W?4!%Z)" [arg present-level nil outline-back-to-heading outline-level 1 error "" 0 outline-previous-visible-heading] 10))

(defun outline-forward-same-level (arg) "\
Move forward to the ARG'th subheading from here of the same level as the
present one. It stops at the first and last subheadings of a superior heading." (interactive "p") (byte-code "ˆ V* )		bS%ĉ!)" [arg point-to-move-to nil outline-back-to-heading 0 outline-get-next-sibling error ""] 5))

(defun outline-get-next-sibling nil "\
Position the point at the next heading of the same level, 
and return that position or nil if it cannot be found." (byte-code " ! Vm?! W&'`)" [level nil outline-level outline-next-visible-heading 1] 7))

(defun outline-backward-same-level (arg) "\
Move backward to the ARG'th subheading from here of the same level as the
present one. It stops at the first and last subheadings of a superior heading." (interactive "p") (byte-code "ˆ V* )		bS%ĉ!)" [arg point-to-move-to nil outline-back-to-heading 0 outline-get-last-sibling error ""] 5))

(defun outline-get-last-sibling nil "\
Position the point at the previous heading of the same level, 
and return that position or nil if it cannot be found." (byte-code " ! Vo?! W&'`)" [level nil outline-level outline-previous-visible-heading 1] 7))