annotate lisp/obsolete/ooutline.el @ 36419:50998d3dd0bb

(lpr-page-header-switches, print-region-1): Undo 2000-07-06 change.
author Richard M. Stallman <rms@gnu.org>
date Tue, 27 Feb 2001 19:07:09 +0000
parents 6ab25b51ae25
children 253f761ad37b
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
34456
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1 ;;; outline.el --- outline mode commands for Emacs
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
2
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
3 ;; Copyright (C) 1986, 1993, 1994, 1997 Free Software Foundation, Inc.
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
4
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
5 ;; Maintainer: FSF
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
6 ;; Keywords: outlines
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
7
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
8 ;; This file is part of GNU Emacs.
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
9
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
10 ;; GNU Emacs is free software; you can redistribute it and/or modify
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
11 ;; it under the terms of the GNU General Public License as published by
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
12 ;; the Free Software Foundation; either version 2, or (at your option)
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
13 ;; any later version.
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
14
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
15 ;; GNU Emacs is distributed in the hope that it will be useful,
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
16 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
17 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
18 ;; GNU General Public License for more details.
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
19
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
20 ;; You should have received a copy of the GNU General Public License
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
21 ;; along with GNU Emacs; see the file COPYING. If not, write to the
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
22 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
23 ;; Boston, MA 02111-1307, USA.
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
24
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
25 ;;; Commentary:
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
26
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
27 ;; This package is a major mode for editing outline-format documents.
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
28 ;; An outline can be `abstracted' to show headers at any given level,
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
29 ;; with all stuff below hidden. See the Emacs manual for details.
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
30
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
31 ;;; Code:
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
32
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
33 ;; Jan '86, Some new features added by Peter Desnoyers and rewritten by RMS.
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
34
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
35 (defgroup outlines nil
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
36 "Support for hierarchical outlining"
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
37 :prefix "outline-"
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
38 :group 'editing)
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
39
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
40
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
41 (defcustom outline-regexp nil
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
42 "*Regular expression to match the beginning of a heading.
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
43 Any line whose beginning matches this regexp is considered to start a heading.
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
44 The recommended way to set this is with a Local Variables: list
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
45 in the file it applies to. See also outline-heading-end-regexp."
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
46 :type '(choice regexp (const nil))
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
47 :group 'outlines)
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
48
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
49 ;; Can't initialize this in the defvar above -- some major modes have
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
50 ;; already assigned a local value to it.
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
51 (or (default-value 'outline-regexp)
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
52 (setq-default outline-regexp "[*\^L]+"))
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
53
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
54 (defcustom outline-heading-end-regexp "[\n\^M]"
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
55 "*Regular expression to match the end of a heading line.
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
56 You can assume that point is at the beginning of a heading when this
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
57 regexp is searched for. The heading ends at the end of the match.
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
58 The recommended way to set this is with a \"Local Variables:\" list
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
59 in the file it applies to."
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
60 :type 'regexp
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
61 :group 'outlines)
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
62
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
63 (defvar outline-mode-prefix-map nil)
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
64
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
65 (if outline-mode-prefix-map
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
66 nil
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
67 (setq outline-mode-prefix-map (make-sparse-keymap))
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
68 (define-key outline-mode-prefix-map "\C-n" 'outline-next-visible-heading)
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
69 (define-key outline-mode-prefix-map "\C-p" 'outline-previous-visible-heading)
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
70 (define-key outline-mode-prefix-map "\C-i" 'show-children)
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
71 (define-key outline-mode-prefix-map "\C-s" 'show-subtree)
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
72 (define-key outline-mode-prefix-map "\C-d" 'hide-subtree)
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
73 (define-key outline-mode-prefix-map "\C-u" 'outline-up-heading)
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
74 (define-key outline-mode-prefix-map "\C-f" 'outline-forward-same-level)
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
75 (define-key outline-mode-prefix-map "\C-b" 'outline-backward-same-level)
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
76 (define-key outline-mode-prefix-map "\C-t" 'hide-body)
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
77 (define-key outline-mode-prefix-map "\C-a" 'show-all)
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
78 (define-key outline-mode-prefix-map "\C-c" 'hide-entry)
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
79 (define-key outline-mode-prefix-map "\C-e" 'show-entry)
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
80 (define-key outline-mode-prefix-map "\C-l" 'hide-leaves)
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
81 (define-key outline-mode-prefix-map "\C-k" 'show-branches)
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
82 (define-key outline-mode-prefix-map "\C-q" 'hide-sublevels)
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
83 (define-key outline-mode-prefix-map "\C-o" 'hide-other))
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
84
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
85 (defvar outline-mode-menu-bar-map nil)
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
86 (if outline-mode-menu-bar-map
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
87 nil
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
88 (setq outline-mode-menu-bar-map (make-sparse-keymap))
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
89
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
90 (define-key outline-mode-menu-bar-map [hide]
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
91 (cons "Hide" (make-sparse-keymap "Hide")))
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
92
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
93 (define-key outline-mode-menu-bar-map [hide hide-other]
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
94 '("Hide Other" . hide-other))
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
95 (define-key outline-mode-menu-bar-map [hide hide-sublevels]
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
96 '("Hide Sublevels" . hide-sublevels))
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
97 (define-key outline-mode-menu-bar-map [hide hide-subtree]
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
98 '("Hide Subtree" . hide-subtree))
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
99 (define-key outline-mode-menu-bar-map [hide hide-entry]
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
100 '("Hide Entry" . hide-entry))
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
101 (define-key outline-mode-menu-bar-map [hide hide-body]
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
102 '("Hide Body" . hide-body))
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
103 (define-key outline-mode-menu-bar-map [hide hide-leaves]
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
104 '("Hide Leaves" . hide-leaves))
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
105
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
106 (define-key outline-mode-menu-bar-map [show]
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
107 (cons "Show" (make-sparse-keymap "Show")))
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
108
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
109 (define-key outline-mode-menu-bar-map [show show-subtree]
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
110 '("Show Subtree" . show-subtree))
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
111 (define-key outline-mode-menu-bar-map [show show-children]
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
112 '("Show Children" . show-children))
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
113 (define-key outline-mode-menu-bar-map [show show-branches]
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
114 '("Show Branches" . show-branches))
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
115 (define-key outline-mode-menu-bar-map [show show-entry]
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
116 '("Show Entry" . show-entry))
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
117 (define-key outline-mode-menu-bar-map [show show-all]
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
118 '("Show All" . show-all))
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
119
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
120 (define-key outline-mode-menu-bar-map [headings]
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
121 (cons "Headings" (make-sparse-keymap "Headings")))
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
122
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
123 (define-key outline-mode-menu-bar-map [headings outline-backward-same-level]
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
124 '("Previous Same Level" . outline-backward-same-level))
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
125 (define-key outline-mode-menu-bar-map [headings outline-forward-same-level]
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
126 '("Next Same Level" . outline-forward-same-level))
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
127 (define-key outline-mode-menu-bar-map [headings outline-previous-visible-heading]
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
128 '("Previous" . outline-previous-visible-heading))
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
129 (define-key outline-mode-menu-bar-map [headings outline-next-visible-heading]
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
130 '("Next" . outline-next-visible-heading))
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
131 (define-key outline-mode-menu-bar-map [headings outline-up-heading]
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
132 '("Up" . outline-up-heading)))
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
133
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
134 (defvar outline-mode-map nil "")
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
135
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
136 (if outline-mode-map
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
137 nil
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
138 (setq outline-mode-map (nconc (make-sparse-keymap) text-mode-map))
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
139 (define-key outline-mode-map "\C-c" outline-mode-prefix-map)
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
140 (define-key outline-mode-map [menu-bar] outline-mode-menu-bar-map))
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
141
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
142 (defcustom outline-minor-mode nil
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
143 "Non-nil if using Outline mode as a minor mode of some other mode."
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
144 :type 'boolean
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
145 :group 'outlines)
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
146 (make-variable-buffer-local 'outline-minor-mode)
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
147 (put 'outline-minor-mode 'permanent-local t)
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
148 (or (assq 'outline-minor-mode minor-mode-alist)
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
149 (setq minor-mode-alist (append minor-mode-alist
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
150 (list '(outline-minor-mode " Outl")))))
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
151
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
152 (defvar outline-font-lock-keywords
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
153 '(;; Highlight headings according to the level.
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
154 ("^\\([*]+\\)[ \t]*\\([^\n\r]+\\)?[ \t]*[\n\r]"
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
155 (1 font-lock-string-face)
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
156 (2 (let ((len (- (match-end 1) (match-beginning 1))))
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
157 (or (cdr (assq len '((1 . font-lock-function-name-face)
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
158 (2 . font-lock-keyword-face)
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
159 (3 . font-lock-comment-face))))
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
160 font-lock-variable-name-face))
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
161 nil t))
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
162 ;; Highlight citations of the form [1] and [Mar94].
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
163 ("\\[\\([[:upper:]][[:alpha:]]+\\)*[0-9]+\\]" . font-lock-type-face))
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
164 "Additional expressions to highlight in Outline mode.")
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
165
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
166 (defun outline-mode ()
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
167 "Set major mode for editing outlines with selective display.
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
168 Headings are lines which start with asterisks: one for major headings,
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
169 two for subheadings, etc. Lines not starting with asterisks are body lines.
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
170
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
171 Body text or subheadings under a heading can be made temporarily
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
172 invisible, or visible again. Invisible lines are attached to the end
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
173 of the heading, so they move with it, if the line is killed and yanked
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
174 back. A heading with text hidden under it is marked with an ellipsis (...).
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
175
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
176 Commands:\\<outline-mode-map>
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
177 \\[outline-next-visible-heading] outline-next-visible-heading move by visible headings
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
178 \\[outline-previous-visible-heading] outline-previous-visible-heading
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
179 \\[outline-forward-same-level] outline-forward-same-level similar but skip subheadings
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
180 \\[outline-backward-same-level] outline-backward-same-level
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
181 \\[outline-up-heading] outline-up-heading move from subheading to heading
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
182
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
183 \\[hide-body] make all text invisible (not headings).
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
184 \\[show-all] make everything in buffer visible.
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
185
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
186 The remaining commands are used when point is on a heading line.
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
187 They apply to some of the body or subheadings of that heading.
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
188 \\[hide-subtree] hide-subtree make body and subheadings invisible.
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
189 \\[show-subtree] show-subtree make body and subheadings visible.
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
190 \\[show-children] show-children make direct subheadings visible.
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
191 No effect on body, or subheadings 2 or more levels down.
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
192 With arg N, affects subheadings N levels down.
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
193 \\[hide-entry] make immediately following body invisible.
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
194 \\[show-entry] make it visible.
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
195 \\[hide-leaves] make body under heading and under its subheadings invisible.
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
196 The subheadings remain visible.
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
197 \\[show-branches] make all subheadings at all levels visible.
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
198
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
199 The variable `outline-regexp' can be changed to control what is a heading.
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
200 A line is a heading if `outline-regexp' matches something at the
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
201 beginning of the line. The longer the match, the deeper the level.
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
202
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
203 Turning on outline mode calls the value of `text-mode-hook' and then of
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
204 `outline-mode-hook', if they are non-nil."
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
205 (interactive)
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
206 (kill-all-local-variables)
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
207 (setq selective-display t)
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
208 (use-local-map outline-mode-map)
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
209 (setq mode-name "Outline")
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
210 (setq major-mode 'outline-mode)
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
211 (define-abbrev-table 'text-mode-abbrev-table ())
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
212 (setq local-abbrev-table text-mode-abbrev-table)
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
213 (set-syntax-table text-mode-syntax-table)
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
214 (make-local-variable 'paragraph-start)
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
215 (setq paragraph-start (concat paragraph-start "\\|\\("
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
216 outline-regexp "\\)"))
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
217 ;; Inhibit auto-filling of header lines.
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
218 (make-local-variable 'auto-fill-inhibit-regexp)
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
219 (setq auto-fill-inhibit-regexp outline-regexp)
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
220 (make-local-variable 'paragraph-separate)
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
221 (setq paragraph-separate (concat paragraph-separate "\\|\\("
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
222 outline-regexp "\\)"))
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
223 (make-local-variable 'font-lock-defaults)
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
224 (setq font-lock-defaults '(outline-font-lock-keywords t))
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
225 (make-local-variable 'change-major-mode-hook)
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
226 (add-hook 'change-major-mode-hook 'show-all)
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
227 (run-hooks 'text-mode-hook 'outline-mode-hook))
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
228
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
229 (defcustom outline-minor-mode-prefix "\C-c@"
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
230 "*Prefix key to use for Outline commands in Outline minor mode.
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
231 The value of this variable is checked as part of loading Outline mode.
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
232 After that, changing the prefix key requires manipulating keymaps."
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
233 :type 'string
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
234 :group 'outlines)
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
235
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
236 (defvar outline-minor-mode-map nil)
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
237 (if outline-minor-mode-map
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
238 nil
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
239 (setq outline-minor-mode-map (make-sparse-keymap))
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
240 (define-key outline-minor-mode-map [menu-bar]
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
241 outline-mode-menu-bar-map)
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
242 (define-key outline-minor-mode-map outline-minor-mode-prefix
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
243 outline-mode-prefix-map))
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
244
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
245 (or (assq 'outline-minor-mode minor-mode-map-alist)
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
246 (setq minor-mode-map-alist
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
247 (cons (cons 'outline-minor-mode outline-minor-mode-map)
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
248 minor-mode-map-alist)))
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
249
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
250 (defun outline-minor-mode (&optional arg)
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
251 "Toggle Outline minor mode.
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
252 With arg, turn Outline minor mode on if arg is positive, off otherwise.
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
253 See the command `outline-mode' for more information on this mode."
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
254 (interactive "P")
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
255 (setq outline-minor-mode
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
256 (if (null arg) (not outline-minor-mode)
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
257 (> (prefix-numeric-value arg) 0)))
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
258 (if outline-minor-mode
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
259 (progn
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
260 (setq selective-display t)
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
261 (run-hooks 'outline-minor-mode-hook))
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
262 (setq selective-display nil))
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
263 ;; When turning off outline mode, get rid of any ^M's.
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
264 (or outline-minor-mode
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
265 (outline-flag-region (point-min) (point-max) ?\n))
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
266 (force-mode-line-update))
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
267
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
268 (defvar outline-level 'outline-level
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
269 "Function of no args to compute a header's nesting level in an outline.
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
270 It can assume point is at the beginning of a header line.")
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
271
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
272 ;; This used to count columns rather than characters, but that made ^L
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
273 ;; appear to be at level 2 instead of 1. Columns would be better for
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
274 ;; tab handling, but the default regexp doesn't use tabs, and anyone
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
275 ;; who changes the regexp can also redefine the outline-level variable
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
276 ;; as appropriate.
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
277 (defun outline-level ()
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
278 "Return the depth to which a statement is nested in the outline.
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
279 Point must be at the beginning of a header line. This is actually
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
280 the number of characters that `outline-regexp' matches."
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
281 (save-excursion
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
282 (looking-at outline-regexp)
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
283 (- (match-end 0) (match-beginning 0))))
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
284
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
285 (defun outline-next-preface ()
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
286 "Skip forward to just before the next heading line.
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
287 If there's no following heading line, stop before the newline
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
288 at the end of the buffer."
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
289 (if (re-search-forward (concat "[\n\^M]\\(" outline-regexp "\\)")
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
290 nil 'move)
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
291 (goto-char (match-beginning 0)))
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
292 (if (memq (preceding-char) '(?\n ?\^M))
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
293 (forward-char -1)))
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
294
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
295 (defun outline-next-heading ()
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
296 "Move to the next (possibly invisible) heading line."
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
297 (interactive)
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
298 (if (re-search-forward (concat "[\n\^M]\\(" outline-regexp "\\)")
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
299 nil 'move)
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
300 (goto-char (1+ (match-beginning 0)))))
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
301
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
302 (defun outline-back-to-heading ()
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
303 "Move to previous heading line, or beg of this line if it's a heading.
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
304 Only visible heading lines are considered."
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
305 (beginning-of-line)
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
306 (or (outline-on-heading-p)
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
307 (re-search-backward (concat "^\\(" outline-regexp "\\)") nil t)
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
308 (error "before first heading")))
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
309
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
310 (defun outline-on-heading-p ()
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
311 "Return t if point is on a (visible) heading line."
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
312 (save-excursion
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
313 (beginning-of-line)
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
314 (and (bolp)
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
315 (looking-at outline-regexp))))
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
316
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
317 (defun outline-end-of-heading ()
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
318 (if (re-search-forward outline-heading-end-regexp nil 'move)
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
319 (forward-char -1)))
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
320
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
321 (defun outline-next-visible-heading (arg)
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
322 "Move to the next visible heading line.
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
323 With argument, repeats or can move backward if negative.
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
324 A heading line is one that starts with a `*' (or that
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
325 `outline-regexp' matches)."
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
326 (interactive "p")
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
327 (if (< arg 0)
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
328 (beginning-of-line)
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
329 (end-of-line))
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
330 (or (re-search-forward (concat "^\\(" outline-regexp "\\)") nil t arg)
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
331 (error ""))
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
332 (beginning-of-line))
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
333
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
334 (defun outline-previous-visible-heading (arg)
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
335 "Move to the previous heading line.
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
336 With argument, repeats or can move forward if negative.
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
337 A heading line is one that starts with a `*' (or that
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
338 `outline-regexp' matches)."
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
339 (interactive "p")
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
340 (outline-next-visible-heading (- arg)))
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
341
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
342 (defun outline-flag-region (from to flag)
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
343 "Hides or shows lines from FROM to TO, according to FLAG.
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
344 If FLAG is `\\n' (newline character) then text is shown,
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
345 while if FLAG is `\\^M' (control-M) the text is hidden."
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
346 (let (buffer-read-only)
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
347 (subst-char-in-region from to
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
348 (if (= flag ?\n) ?\^M ?\n)
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
349 flag t)))
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
350
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
351 (defun hide-entry ()
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
352 "Hide the body directly following this heading."
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
353 (interactive)
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
354 (outline-back-to-heading)
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
355 (outline-end-of-heading)
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
356 (save-excursion
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
357 (outline-flag-region (point) (progn (outline-next-preface) (point)) ?\^M)))
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
358
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
359 (defun show-entry ()
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
360 "Show the body directly following this heading."
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
361 (interactive)
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
362 (save-excursion
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
363 (outline-flag-region (point) (progn (outline-next-preface) (point)) ?\n)))
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
364
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
365 (defun hide-body ()
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
366 "Hide all of buffer except headings."
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
367 (interactive)
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
368 (hide-region-body (point-min) (point-max)))
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
369
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
370 (defun hide-region-body (start end)
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
371 "Hide all body lines in the region, but not headings."
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
372 (save-excursion
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
373 (save-restriction
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
374 (narrow-to-region start end)
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
375 (goto-char (point-min))
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
376 (if (outline-on-heading-p)
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
377 (outline-end-of-heading))
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
378 (while (not (eobp))
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
379 (outline-flag-region (point)
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
380 (progn (outline-next-preface) (point)) ?\^M)
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
381 (if (not (eobp))
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
382 (progn
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
383 (forward-char
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
384 (if (looking-at "[\n\^M][\n\^M]")
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
385 2 1))
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
386 (outline-end-of-heading)))))))
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
387
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
388 (defun show-all ()
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
389 "Show all of the text in the buffer."
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
390 (interactive)
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
391 (outline-flag-region (point-min) (point-max) ?\n))
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
392
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
393 (defun hide-subtree ()
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
394 "Hide everything after this heading at deeper levels."
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
395 (interactive)
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
396 (outline-flag-subtree ?\^M))
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
397
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
398 (defun hide-leaves ()
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
399 "Hide all body after this heading at deeper levels."
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
400 (interactive)
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
401 (outline-back-to-heading)
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
402 (outline-end-of-heading)
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
403 (hide-region-body (point) (progn (outline-end-of-subtree) (point))))
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
404
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
405 (defun show-subtree ()
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
406 "Show everything after this heading at deeper levels."
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
407 (interactive)
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
408 (outline-flag-subtree ?\n))
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
409
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
410 (defun hide-sublevels (levels)
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
411 "Hide everything but the top LEVELS levels of headers, in whole buffer."
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
412 (interactive "p")
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
413 (if (< levels 1)
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
414 (error "Must keep at least one level of headers"))
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
415 (setq levels (1- levels))
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
416 (save-excursion
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
417 (goto-char (point-min))
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
418 ;; Keep advancing to the next top-level heading.
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
419 (while (or (and (bobp) (outline-on-heading-p))
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
420 (outline-next-heading))
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
421 (let ((end (save-excursion (outline-end-of-subtree) (point))))
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
422 ;; Hide everything under that.
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
423 (outline-flag-region (point) end ?\^M)
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
424 ;; Show the first LEVELS levels under that.
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
425 (if (> levels 0)
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
426 (show-children levels))
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
427 ;; Move to the next, since we already found it.
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
428 (goto-char end)))))
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
429
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
430 (defun hide-other ()
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
431 "Hide everything except for the current body and the parent headings."
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
432 (interactive)
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
433 (hide-sublevels 1)
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
434 (let ((last (point))
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
435 (pos (point)))
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
436 (while (save-excursion
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
437 (and (re-search-backward "[\n\r]" nil t)
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
438 (eq (following-char) ?\r)))
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
439 (save-excursion
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
440 (beginning-of-line)
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
441 (if (eq last (point))
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
442 (progn
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
443 (outline-next-heading)
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
444 (outline-flag-region last (point) ?\n))
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
445 (show-children)
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
446 (setq last (point)))))))
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
447
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
448 (defun outline-flag-subtree (flag)
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
449 (save-excursion
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
450 (outline-back-to-heading)
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
451 (outline-end-of-heading)
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
452 (outline-flag-region (point)
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
453 (progn (outline-end-of-subtree) (point))
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
454 flag)))
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
455
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
456 (defun outline-end-of-subtree ()
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
457 (outline-back-to-heading)
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
458 (let ((opoint (point))
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
459 (first t)
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
460 (level (funcall outline-level)))
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
461 (while (and (not (eobp))
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
462 (or first (> (funcall outline-level) level)))
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
463 (setq first nil)
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
464 (outline-next-heading))
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
465 (if (memq (preceding-char) '(?\n ?\^M))
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
466 (progn
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
467 ;; Go to end of line before heading
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
468 (forward-char -1)
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
469 (if (memq (preceding-char) '(?\n ?\^M))
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
470 ;; leave blank line before heading
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
471 (forward-char -1))))))
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
472
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
473 (defun show-branches ()
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
474 "Show all subheadings of this heading, but not their bodies."
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
475 (interactive)
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
476 (show-children 1000))
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
477
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
478 (defun show-children (&optional level)
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
479 "Show all direct subheadings of this heading.
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
480 Prefix arg LEVEL is how many levels below the current level should be shown.
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
481 Default is enough to cause the following heading to appear."
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
482 (interactive "P")
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
483 (setq level
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
484 (if level (prefix-numeric-value level)
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
485 (save-excursion
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
486 (outline-back-to-heading)
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
487 (let ((start-level (funcall outline-level)))
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
488 (outline-next-heading)
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
489 (if (eobp)
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
490 1
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
491 (max 1 (- (funcall outline-level) start-level)))))))
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
492 (save-excursion
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
493 (save-restriction
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
494 (outline-back-to-heading)
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
495 (setq level (+ level (funcall outline-level)))
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
496 (narrow-to-region (point)
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
497 (progn (outline-end-of-subtree)
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
498 (if (eobp) (point-max) (1+ (point)))))
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
499 (goto-char (point-min))
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
500 (while (and (not (eobp))
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
501 (progn
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
502 (outline-next-heading)
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
503 (not (eobp))))
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
504 (if (<= (funcall outline-level) level)
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
505 (save-excursion
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
506 (outline-flag-region (save-excursion
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
507 (forward-char -1)
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
508 (if (memq (preceding-char) '(?\n ?\^M))
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
509 (forward-char -1))
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
510 (point))
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
511 (progn (outline-end-of-heading) (point))
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
512 ?\n)))))))
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
513
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
514 (defun outline-up-heading (arg)
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
515 "Move to the heading line of which the present line is a subheading.
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
516 With argument, move up ARG levels."
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
517 (interactive "p")
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
518 (outline-back-to-heading)
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
519 (if (eq (funcall outline-level) 1)
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
520 (error ""))
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
521 (while (and (> (funcall outline-level) 1)
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
522 (> arg 0)
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
523 (not (bobp)))
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
524 (let ((present-level (funcall outline-level)))
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
525 (while (not (< (funcall outline-level) present-level))
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
526 (outline-previous-visible-heading 1))
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
527 (setq arg (- arg 1)))))
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
528
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
529 (defun outline-forward-same-level (arg)
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
530 "Move forward to the ARG'th subheading at same level as this one.
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
531 Stop at the first and last subheadings of a superior heading."
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
532 (interactive "p")
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
533 (outline-back-to-heading)
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
534 (while (> arg 0)
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
535 (let ((point-to-move-to (save-excursion
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
536 (outline-get-next-sibling))))
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
537 (if point-to-move-to
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
538 (progn
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
539 (goto-char point-to-move-to)
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
540 (setq arg (1- arg)))
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
541 (progn
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
542 (setq arg 0)
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
543 (error ""))))))
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
544
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
545 (defun outline-get-next-sibling ()
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
546 "Move to next heading of the same level, and return point or nil if none."
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
547 (let ((level (funcall outline-level)))
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
548 (outline-next-visible-heading 1)
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
549 (while (and (> (funcall outline-level) level)
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
550 (not (eobp)))
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
551 (outline-next-visible-heading 1))
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
552 (if (< (funcall outline-level) level)
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
553 nil
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
554 (point))))
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
555
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
556 (defun outline-backward-same-level (arg)
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
557 "Move backward to the ARG'th subheading at same level as this one.
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
558 Stop at the first and last subheadings of a superior heading."
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
559 (interactive "p")
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
560 (outline-back-to-heading)
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
561 (while (> arg 0)
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
562 (let ((point-to-move-to (save-excursion
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
563 (outline-get-last-sibling))))
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
564 (if point-to-move-to
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
565 (progn
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
566 (goto-char point-to-move-to)
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
567 (setq arg (1- arg)))
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
568 (progn
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
569 (setq arg 0)
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
570 (error ""))))))
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
571
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
572 (defun outline-get-last-sibling ()
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
573 "Move to next heading of the same level, and return point or nil if none."
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
574 (let ((level (funcall outline-level)))
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
575 (outline-previous-visible-heading 1)
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
576 (while (and (> (funcall outline-level) level)
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
577 (not (bobp)))
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
578 (outline-previous-visible-heading 1))
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
579 (if (< (funcall outline-level) level)
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
580 nil
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
581 (point))))
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
582
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
583 (provide 'outline)
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
584
6ab25b51ae25 Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
585 ;;; outline.el ends here