(defvar outline-mode-map nil "") (if outline-mode-map nil (setq outline-mode-map (copy-alist text-mode-map)) (define-key outline-mode-map "}" (quote next-visible-heading)) (define-key outline-mode-map "{" (quote 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))) (defun outline-mode nil "\ Set major mode for editing outlines with selective display. Headings should be lines starting with one or more asterisks. Major headings have one asterisk, subheadings two, etc. Lines not starting with asterisks are body lines. You can make the body text under a heading, or the subheadings under a heading, temporarily invisible, or visible again. Invisible lines are attached to the end of the previous line so they go with it if you kill it and yank it back. Commands: Meta-} next-visible-heading move by visible headings Meta-{ previous-visible-heading move by visible headings 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. hide-entry make immediately following body invisible. show-entry make it visible. hide-leaves make body under heading and under its subheadings invisible. The subheadings remain visible. show-branches make all subheadings at all levels visible." (interactive) (byte-code "ÅˆË ˆ ‰ˆÌ !ˆÍ‰ˆÎ‰ˆÏÇ \"ˆ‰ˆÐ!ˆÑÉ!ˆ ÒP‰ ˆÑÊ!ˆ ÒP‰ ˆÓÔÕ\"‡" [selective-display t outline-mode-map mode-name major-mode nil local-abbrev-table text-mode-abbrev-table text-mode-syntax-table paragraph-start 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] 15)) (defun outline-level nil (byte-code "Š`ÀÁ!ˆ`Z[)‡" [skip-chars-forward "^ "] 5)) (defun next-heading-preface nil (byte-code "ÁÂÃ#ƒ ÄÅ!b‚ ÀˆhÆ>ƒ ÇÈ!‚ À‡" [nil re-search-forward "[ ]\\*" move match-beginning 0 (10 13) forward-char -1] 7)) (defun next-heading nil "\ Move to the next heading line (a line starting with *'s)." (interactive) (byte-code "ÀˆÁÂÃ#ƒ ÄÅ!Tb‚ À‡" [nil re-search-forward "[ ]\\*" move match-beginning 0] 5)) (defun next-visible-heading (arg) "\ Move to the next visible heading line (a line starting with *'s). With argument, repeats or can move backward if negative." (interactive "p") (byte-code "ÁˆÂWƒ à ‚ ÄÅ!ˆÆÇ $ˆÃ ‡" [arg nil 0 beginning-of-line forward-line 1 re-search-forward "^\\*"] 9)) (defun previous-visible-heading (arg) "\ Move to the previous heading line (a line starting with *'s). With argument, repeats or can move forward if negative." (interactive "p") (byte-code "ÁˆÂVƒ à ‚ ÄÅ!ˆÆÇ $ˆÃ ‡" [arg nil 0 beginning-of-line forward-line 1 re-search-backward "^\\*"] 9)) (defun flag-lines-in-region (from to flag) (byte-code "Å ÆŽÇ ÈUƒ É‚ È%))‡" [modp from to flag t buffer-modified-p ((byte-code "Á!‡" [modp set-buffer-modified-p] 3)) subst-char-in-region 10 13] 11)) (defun hide-entry nil "\ Hide the body directly following this heading." (interactive) (byte-code "ÀˆŠÁ` ˆ`Ã#)‡" [nil flag-lines-in-region next-heading-preface 13] 6)) (defun show-entry nil "\ Show the body directly following this heading." (interactive) (byte-code "ÀˆŠÁ` ˆ`Ã#)‡" [nil flag-lines-in-region next-heading-preface 10] 6)) (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 "ŠŒÂ \"ˆebˆm?…) Ã`Ä ˆ`Å#ˆÆÇÈ!ƒ# É‚$ Ê!ˆ‚ ))‡" [start end narrow-to-region flag-lines-in-region next-heading-preface 13 forward-char looking-at "[ ][ ]" 2 1] 12)) (defun show-all nil "\ Show all of the body in the buffer." (interactive) (byte-code "ÀˆÁedÂ#‡" [nil flag-lines-in-region 10] 4)) (defun hide-subtree nil "\ Hide everything after this heading at deeper levels." (interactive) (byte-code "ÀˆÁÂ!‡" [nil flag-subtree 13] 3)) (defun hide-leaves nil "\ Hide all body after this heading at deeper levels." (interactive) (byte-code "ÀˆÁ` ˆ`\"‡" [nil hide-region-body end-of-subtree] 5)) (defun show-subtree nil "\ Show everything after this heading at deeper levels." (interactive) (byte-code "ÀˆÁÂ!‡" [nil flag-subtree 10] 3)) (defun flag-subtree (flag) (byte-code "ŠÁ` ˆ`#)‡" [flag flag-lines-in-region end-of-subtree] 6)) (defun end-of-subtree nil (byte-code "Å ˆ` Æ m?… † Æ V…$ ‰ˆÇ ˆ‚ ˆÈÉ!ˆhÊ>ƒ5 ÈÉ!‚6 Ä+‡" [opoint first t level nil beginning-of-line outline-level next-heading forward-char -1 (10 13)] 16)) (defun show-branches nil "\ Show all subheadings of this heading, but not their bodies." (interactive) (byte-code "ÀˆÁÂ!‡" [nil show-children 1000] 3)) (defun show-children (&optional level) "\ Show all direct subheadings of this heading." (interactive "p") (byte-code "ˆ† ɈŠŒÄ ˆÅ \\‰ˆÆ`Ç ˆ`T\"ˆebˆm?…, È ˆm?…[ Å XƒV Š`TÉÊ!ˆhË>ƒJ ÉÊ!‚K ˆÌ` Í#))‚W ˆ‚\"