annotate lisp/textmodes/ooutline.el @ 17674:c4bf2875d072 libc-970506 libc-970507

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