Mercurial > emacs
annotate lisp/allout.el @ 38038:f874bc96a6a5
(rot13-other-window): Some more doc fix.
author | Eli Zaretskii <eliz@gnu.org> |
---|---|
date | Thu, 14 Jun 2001 15:42:57 +0000 |
parents | 495ba6e137c7 |
children | 5ba05be0bbfd |
rev | line source |
---|---|
29490 | 1 ;;;_* allout.el --- Extensive outline mode for use alone and with other modes. |
7416
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
2 |
36390
495ba6e137c7
(outline-flag-region): Move macro in front of first
Gerd Moellmann <gerd@gnu.org>
parents:
29490
diff
changeset
|
3 ;; Copyright (C) 1992, 1993, 1994, 2001 Free Software Foundation, Inc. |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4 |
19923
b4ff95522987
Change maintainer email address.
Richard M. Stallman <rms@gnu.org>
parents:
15664
diff
changeset
|
5 ;; Author: Ken Manheimer <klm@python.org> |
b4ff95522987
Change maintainer email address.
Richard M. Stallman <rms@gnu.org>
parents:
15664
diff
changeset
|
6 ;; Maintainer: Ken Manheimer <klm@python.org> |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
7 ;; Created: Dec 1991 - first release to usenet |
36390
495ba6e137c7
(outline-flag-region): Move macro in front of first
Gerd Moellmann <gerd@gnu.org>
parents:
29490
diff
changeset
|
8 ;; Version: $Id: allout.el,v 1.26 2001/02/26 12:01:50 gerd Exp $|| |
29490 | 9 ;; Keywords: outline mode wp languages |
3430 | 10 |
11 ;; This file is part of GNU Emacs. | |
12 | |
6736
3e1323443b1a
Fix copying conditions for current GPL version.
Richard M. Stallman <rms@gnu.org>
parents:
5310
diff
changeset
|
13 ;; GNU Emacs is free software; you can redistribute it and/or modify |
3e1323443b1a
Fix copying conditions for current GPL version.
Richard M. Stallman <rms@gnu.org>
parents:
5310
diff
changeset
|
14 ;; it under the terms of the GNU General Public License as published by |
3e1323443b1a
Fix copying conditions for current GPL version.
Richard M. Stallman <rms@gnu.org>
parents:
5310
diff
changeset
|
15 ;; the Free Software Foundation; either version 2, or (at your option) |
3e1323443b1a
Fix copying conditions for current GPL version.
Richard M. Stallman <rms@gnu.org>
parents:
5310
diff
changeset
|
16 ;; any later version. |
3430 | 17 |
6736
3e1323443b1a
Fix copying conditions for current GPL version.
Richard M. Stallman <rms@gnu.org>
parents:
5310
diff
changeset
|
18 ;; GNU Emacs is distributed in the hope that it will be useful, |
3e1323443b1a
Fix copying conditions for current GPL version.
Richard M. Stallman <rms@gnu.org>
parents:
5310
diff
changeset
|
19 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of |
3e1323443b1a
Fix copying conditions for current GPL version.
Richard M. Stallman <rms@gnu.org>
parents:
5310
diff
changeset
|
20 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
3e1323443b1a
Fix copying conditions for current GPL version.
Richard M. Stallman <rms@gnu.org>
parents:
5310
diff
changeset
|
21 ;; GNU General Public License for more details. |
3e1323443b1a
Fix copying conditions for current GPL version.
Richard M. Stallman <rms@gnu.org>
parents:
5310
diff
changeset
|
22 |
3e1323443b1a
Fix copying conditions for current GPL version.
Richard M. Stallman <rms@gnu.org>
parents:
5310
diff
changeset
|
23 ;; You should have received a copy of the GNU General Public License |
14169 | 24 ;; along with GNU Emacs; see the file COPYING. If not, write to the |
25 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330, | |
26 ;; Boston, MA 02111-1307, USA. | |
3430 | 27 |
7416
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
28 ;;;_* Commentary: |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
29 |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
30 ;; Allout outline mode provides extensive outline formatting and |
29490 | 31 ;; and manipulation beyond standard emacs outline mode. It provides |
32 ;; for structured editing of outlines, as well as navigation and | |
33 ;; exposure. It also provides for syntax-sensitive text like | |
34 ;; programming languages. (For an example, see the allout code | |
35 ;; itself, which is organized in ;; an outline framework.) | |
36 ;; | |
37 ;; In addition to outline navigation and exposure, allout includes: | |
38 ;; | |
39 ;; - topic-oriented repositioning, cut, and paste | |
40 ;; - integral outline exposure-layout | |
41 ;; - incremental search with dynamic exposure and reconcealment of hidden text | |
42 ;; - automatic topic-number maintenance | |
43 ;; - "Hot-spot" operation, for single-keystroke maneuvering and | |
44 ;; exposure control. (See the outline-mode docstring.) | |
45 ;; | |
46 ;; and many other features. | |
47 ;; | |
48 ;; The outline menubar additions provide quick reference to many of | |
49 ;; the features, and see the docstring of the variable `outline-init' | |
50 ;; for instructions on priming your emacs session for automatic | |
51 ;; activation of outline-mode. | |
52 ;; | |
7416
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
53 ;; See the docstring of the variables `outline-layout' and |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
54 ;; `outline-auto-activation' for details on automatic activation of |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
55 ;; allout outline-mode as a minor mode. (It has changed since allout |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
56 ;; 3.x, for those of you that depend on the old method.) |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
57 ;; |
15664
a50ebf4ac764
(outline-auto-activation, outline-layout)
Karl Heuer <kwzh@gnu.org>
parents:
15663
diff
changeset
|
58 ;; Note - the lines beginning with `;;;_' are outline topic headers. |
a50ebf4ac764
(outline-auto-activation, outline-layout)
Karl Heuer <kwzh@gnu.org>
parents:
15663
diff
changeset
|
59 ;; Just `ESC-x eval-current-buffer' to give it a whirl. |
7416
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
60 |
29490 | 61 ;; Ken Manheimer klm@python.org |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
62 |
7416
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
63 ;;;_* Provide |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
64 (provide 'outline) |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
65 (provide 'allout) |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
66 |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
67 ;;;_* USER CUSTOMIZATION VARIABLES: |
21088 | 68 (defgroup allout nil |
69 "Extensive outline mode for use alone and with other modes." | |
70 :prefix "outline-" | |
71 :group 'outlines) | |
7416
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
72 |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
73 ;;;_ + Layout, Mode, and Topic Header Configuration |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
74 |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
75 ;;;_ = outline-auto-activation |
29490 | 76 (defcustom outline-auto-activation nil |
7416
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
77 "*Regulates auto-activation modality of allout outlines - see `outline-init'. |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
78 |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
79 Setq-default by `outline-init' to regulate whether or not allout |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
80 outline mode is automatically activated when the buffer-specific |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
81 variable `outline-layout' is non-nil, and whether or not the layout |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
82 dictated by `outline-layout' should be imposed on mode activation. |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
83 |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
84 With value `t', auto-mode-activation and auto-layout are enabled. |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
85 \(This also depends on `outline-find-file-hooks' being installed in |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
86 `find-file-hooks', which is also done by `outline-init'.) |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
87 |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
88 With value `ask', auto-mode-activation is enabled, and endorsement for |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
89 performing auto-layout is asked of the user each time. |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
90 |
29490 | 91 With value `activate', only auto-mode-activation is enabled, |
15664
a50ebf4ac764
(outline-auto-activation, outline-layout)
Karl Heuer <kwzh@gnu.org>
parents:
15663
diff
changeset
|
92 auto-layout is not. |
7416
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
93 |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
94 With value `nil', neither auto-mode-activation nor auto-layout are |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
95 enabled. |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
96 |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
97 See the docstring for `outline-init' for the proper interface to |
29490 | 98 this variable." |
99 :type '(choice (const :tag "On" t) | |
100 (const :tag "Ask about layout" "ask") | |
101 (const :tag "Mode only" "activate") | |
102 (const :tag "Off" nil)) | |
103 :group 'allout) | |
7416
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
104 ;;;_ = outline-layout |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
105 (defvar outline-layout nil |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
106 "*Layout specification and provisional mode trigger for allout outlines. |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
107 |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
108 Buffer-specific. |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
109 |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
110 A list value specifies a default layout for the current buffer, to be |
15664
a50ebf4ac764
(outline-auto-activation, outline-layout)
Karl Heuer <kwzh@gnu.org>
parents:
15663
diff
changeset
|
111 applied upon activation of allout outline-mode. Any non-nil value will |
a50ebf4ac764
(outline-auto-activation, outline-layout)
Karl Heuer <kwzh@gnu.org>
parents:
15663
diff
changeset
|
112 automatically trigger allout outline-mode, provided `outline-init' |
a50ebf4ac764
(outline-auto-activation, outline-layout)
Karl Heuer <kwzh@gnu.org>
parents:
15663
diff
changeset
|
113 has been called to enable it. |
7416
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
114 |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
115 See the docstring for `outline-init' for details on setting up for |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
116 auto-mode-activation, and for `outline-expose-topic' for the format of |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
117 the layout specification. |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
118 |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
119 You can associate a particular outline layout with a file by setting |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
120 this var via the file's local variables. For example, the following |
11034
27df51bcb4b0
(outline-layout): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents:
10867
diff
changeset
|
121 lines at the bottom of an Emacs Lisp file: |
7416
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
122 |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
123 ;;;Local variables: |
29490 | 124 ;;;outline-layout: \(0 : -1 -1 0) |
7416
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
125 ;;;End: |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
126 |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
127 will, modulo the above-mentioned conditions, cause the mode to be |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
128 activated when the file is visited, followed by the equivalent of |
29490 | 129 `\(outline-expose-topic 0 : -1 -1 0)'. \(This is the layout used for |
7416
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
130 the allout.el, itself.) |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
131 |
15664
a50ebf4ac764
(outline-auto-activation, outline-layout)
Karl Heuer <kwzh@gnu.org>
parents:
15663
diff
changeset
|
132 Also, allout's mode-specific provisions will make topic prefixes default |
a50ebf4ac764
(outline-auto-activation, outline-layout)
Karl Heuer <kwzh@gnu.org>
parents:
15663
diff
changeset
|
133 to the comment-start string, if any, of the language of the file. This |
a50ebf4ac764
(outline-auto-activation, outline-layout)
Karl Heuer <kwzh@gnu.org>
parents:
15663
diff
changeset
|
134 is modulo the setting of `outline-use-mode-specific-leader', which see.") |
7416
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
135 (make-variable-buffer-local 'outline-layout) |
29490 | 136 ;;;_ = outline-show-bodies |
137 (defcustom outline-show-bodies nil | |
138 "*If non-nil, show entire body when exposing a topic, rather than | |
139 just the header." | |
140 :type 'boolean | |
141 :group 'allout) | |
142 (make-variable-buffer-local 'outline-show-bodies) | |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
143 |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
144 ;;;_ = outline-header-prefix |
21088 | 145 (defcustom outline-header-prefix "." |
7416
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
146 "*Leading string which helps distinguish topic headers. |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
147 |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
148 Outline topic header lines are identified by a leading topic |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
149 header prefix, which mostly have the value of this var at their front. |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
150 \(Level 1 topics are exceptions. They consist of only a single |
7416
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
151 character, which is typically set to the outline-primary-bullet. Many |
21088 | 152 outlines start at level 2 to avoid this discrepancy." |
153 :type 'string | |
154 :group 'allout) | |
3430 | 155 (make-variable-buffer-local 'outline-header-prefix) |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
156 ;;;_ = outline-primary-bullet |
21088 | 157 (defcustom outline-primary-bullet "*" |
7416
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
158 "Bullet used for top-level outline topics. |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
159 |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
160 Outline topic header lines are identified by a leading topic header |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
161 prefix, which is concluded by bullets that includes the value of this |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
162 var and the respective outline-*-bullets-string vars. |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
163 |
15664
a50ebf4ac764
(outline-auto-activation, outline-layout)
Karl Heuer <kwzh@gnu.org>
parents:
15663
diff
changeset
|
164 The value of an asterisk (`*') provides for backwards compatibility |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
165 with the original emacs outline mode. See outline-plain-bullets-string |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
166 and outline-distinctive-bullets-string for the range of available |
21088 | 167 bullets." |
168 :type 'string | |
169 :group 'allout) | |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
170 (make-variable-buffer-local 'outline-primary-bullet) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
171 ;;;_ = outline-plain-bullets-string |
29490 | 172 (defcustom outline-plain-bullets-string ".:,;" |
7416
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
173 "*The bullets normally used in outline topic prefixes. |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
174 |
15664
a50ebf4ac764
(outline-auto-activation, outline-layout)
Karl Heuer <kwzh@gnu.org>
parents:
15663
diff
changeset
|
175 See `outline-distinctive-bullets-string' for the other kind of |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
176 bullets. |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
177 |
15664
a50ebf4ac764
(outline-auto-activation, outline-layout)
Karl Heuer <kwzh@gnu.org>
parents:
15663
diff
changeset
|
178 DO NOT include the close-square-bracket, `]', as a bullet. |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
179 |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
180 Outline mode has to be reactivated in order for changes to the value |
21088 | 181 of this var to take effect." |
182 :type 'string | |
183 :group 'allout) | |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
184 (make-variable-buffer-local 'outline-plain-bullets-string) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
185 ;;;_ = outline-distinctive-bullets-string |
29490 | 186 (defcustom outline-distinctive-bullets-string "*+-=>([{}&!?#%\"X@$~_\\" |
7416
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
187 "*Persistent outline header bullets used to distinguish special topics. |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
188 |
29490 | 189 These bullets are used to distinguish topics from the run-of-the-mill |
190 ones. They are not used in the standard topic headers created by | |
191 the topic-opening, shifting, and rebulleting \(eg, on topic shift, | |
192 topic paste, blanket rebulleting) routines, but are offered among the | |
193 choices for rebulleting. They are not altered by the above automatic | |
194 rebulleting, so they can be used to characterize topics, eg: | |
195 | |
196 `?' question topics | |
197 `\(' parenthetic comment \(with a matching close paren inside) | |
198 `[' meta-note \(with a matching close ] inside) | |
199 `\"' a quote | |
200 `=' value settings | |
201 `~' \"more or less\" | |
202 | |
203 ... just for example. (`#' typically has a special meaning to the | |
204 software, according to the value of `outline-numbered-bullet'.) | |
205 | |
206 See `outline-plain-bullets-string' for the selection of | |
207 alternating bullets. | |
208 | |
209 You must run `set-outline-regexp' in order for outline mode to | |
210 reconcile to changes of this value. | |
7416
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
211 |
15664
a50ebf4ac764
(outline-auto-activation, outline-layout)
Karl Heuer <kwzh@gnu.org>
parents:
15663
diff
changeset
|
212 DO NOT include the close-square-bracket, `]', on either of the bullet |
21088 | 213 strings." |
214 :type 'string | |
215 :group 'allout) | |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
216 (make-variable-buffer-local 'outline-distinctive-bullets-string) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
217 |
7416
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
218 ;;;_ = outline-use-mode-specific-leader |
21088 | 219 (defcustom outline-use-mode-specific-leader t |
7416
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
220 "*When non-nil, use mode-specific topic-header prefixes. |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
221 |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
222 Allout outline mode will use the mode-specific `outline-mode-leaders' |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
223 and/or comment-start string, if any, to lead the topic prefix string, |
15664
a50ebf4ac764
(outline-auto-activation, outline-layout)
Karl Heuer <kwzh@gnu.org>
parents:
15663
diff
changeset
|
224 so topic headers look like comments in the programming language. |
7416
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
225 |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
226 String values are used as they stand. |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
227 |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
228 Value `t' means to first check for assoc value in `outline-mode-leaders' |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
229 alist, then use comment-start string, if any, then use default \(`.'). |
29490 | 230 \(See note about use of comment-start strings, below.) |
7416
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
231 |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
232 Set to the symbol for either of `outline-mode-leaders' or |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
233 `comment-start' to use only one of them, respectively. |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
234 |
29490 | 235 Value `nil' means to always use the default \(`.'). |
7416
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
236 |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
237 comment-start strings that do not end in spaces are tripled, and an |
15664
a50ebf4ac764
(outline-auto-activation, outline-layout)
Karl Heuer <kwzh@gnu.org>
parents:
15663
diff
changeset
|
238 `_' underscore is tacked on the end, to distinguish them from regular |
7416
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
239 comment strings. comment-start strings that do end in spaces are not |
29490 | 240 tripled, but an underscore is substituted for the space. [This |
7416
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
241 presumes that the space is for appearance, not comment syntax. You |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
242 can use `outline-mode-leaders' to override this behavior, when |
21088 | 243 incorrect.]" |
244 :type '(choice (const t) (const nil) string | |
245 (const outline-mode-leaders) | |
246 (const comment-start)) | |
247 :group 'allout) | |
7416
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
248 ;;;_ = outline-mode-leaders |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
249 (defvar outline-mode-leaders '() |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
250 "Specific outline-prefix leading strings per major modes. |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
251 |
29490 | 252 Entries will be used instead or in lieu of mode-specific |
7416
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
253 comment-start strings. See also `outline-use-mode-specific-leader'. |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
254 |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
255 If you're constructing a string that will comment-out outline |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
256 structuring so it can be included in program code, append an extra |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
257 character, like an \"_\" underscore, to distinguish the lead string |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
258 from regular comments that start at bol.") |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
259 |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
260 ;;;_ = outline-old-style-prefixes |
21088 | 261 (defcustom outline-old-style-prefixes nil |
15664
a50ebf4ac764
(outline-auto-activation, outline-layout)
Karl Heuer <kwzh@gnu.org>
parents:
15663
diff
changeset
|
262 "*When non-nil, use only old-and-crusty outline-mode `*' topic prefixes. |
7416
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
263 |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
264 Non-nil restricts the topic creation and modification |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
265 functions to asterix-padded prefixes, so they look exactly |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
266 like the original emacs-outline style prefixes. |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
267 |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
268 Whatever the setting of this variable, both old and new style prefixes |
21088 | 269 are always respected by the topic maneuvering functions." |
270 :type 'boolean | |
271 :group 'allout) | |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
272 (make-variable-buffer-local 'outline-old-style-prefixes) |
7416
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
273 ;;;_ = outline-stylish-prefixes - alternating bullets |
21088 | 274 (defcustom outline-stylish-prefixes t |
7416
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
275 "*Do fancy stuff with topic prefix bullets according to level, etc. |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
276 |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
277 Non-nil enables topic creation, modification, and repositioning |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
278 functions to vary the topic bullet char (the char that marks the topic |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
279 depth) just preceding the start of the topic text) according to level. |
15664
a50ebf4ac764
(outline-auto-activation, outline-layout)
Karl Heuer <kwzh@gnu.org>
parents:
15663
diff
changeset
|
280 Otherwise, only asterisks (`*') and distinctive bullets are used. |
7416
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
281 |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
282 This is how an outline can look (but sans indentation) with stylish |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
283 prefixes: |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
284 |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
285 * Top level |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
286 .* A topic |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
287 . + One level 3 subtopic |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
288 . . One level 4 subtopic |
7416
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
289 . . A second 4 subtopic |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
290 . + Another level 3 subtopic |
7416
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
291 . #1 A numbered level 4 subtopic |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
292 . #2 Another |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
293 . ! Another level 4 subtopic with a different distinctive bullet |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
294 . #4 And another numbered level 4 subtopic |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
295 |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
296 This would be an outline with stylish prefixes inhibited (but the |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
297 numbered and other distinctive bullets retained): |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
298 |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
299 * Top level |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
300 .* A topic |
7416
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
301 . * One level 3 subtopic |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
302 . * One level 4 subtopic |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
303 . * A second 4 subtopic |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
304 . * Another level 3 subtopic |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
305 . #1 A numbered level 4 subtopic |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
306 . #2 Another |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
307 . ! Another level 4 subtopic with a different distinctive bullet |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
308 . #4 And another numbered level 4 subtopic |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
309 |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
310 Stylish and constant prefixes (as well as old-style prefixes) are |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
311 always respected by the topic maneuvering functions, regardless of |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
312 this variable setting. |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
313 |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
314 The setting of this var is not relevant when outline-old-style-prefixes |
21088 | 315 is non-nil." |
316 :type 'boolean | |
317 :group 'allout) | |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
318 (make-variable-buffer-local 'outline-stylish-prefixes) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
319 |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
320 ;;;_ = outline-numbered-bullet |
21088 | 321 (defcustom outline-numbered-bullet "#" |
7416
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
322 "*String designating bullet of topics that have auto-numbering; nil for none. |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
323 |
13964
4de229297f1f
(outline-primary-bullet, outline-numbered-bullet,
Karl Heuer <kwzh@gnu.org>
parents:
13337
diff
changeset
|
324 Topics having this bullet have automatic maintenance of a sibling |
7416
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
325 sequence-number tacked on, just after the bullet. Conventionally set |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
326 to \"#\", you can set it to a bullet of your choice. A nil value |
21088 | 327 disables numbering maintenance." |
328 :type '(choice (const nil) string) | |
329 :group 'allout) | |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
330 (make-variable-buffer-local 'outline-numbered-bullet) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
331 ;;;_ = outline-file-xref-bullet |
21088 | 332 (defcustom outline-file-xref-bullet "@" |
7416
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
333 "*Bullet signifying file cross-references, for `outline-resolve-xref'. |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
334 |
29490 | 335 Set this var to the bullet you want to use for file cross-references." |
21088 | 336 :type '(choice (const nil) string) |
337 :group 'allout) | |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
338 |
29490 | 339 ;;;_ = outline-presentation-padding |
340 (defcustom outline-presentation-padding 2 | |
341 "*Presentation-format white-space padding factor, for greater indent." | |
342 :type 'integer | |
343 :group 'allout) | |
344 | |
345 (make-variable-buffer-local 'outline-presentation-padding) | |
346 | |
347 ;;;_ = outline-abbreviate-flattened-numbering | |
348 (defcustom outline-abbreviate-flattened-numbering nil | |
349 "*If non-nil, `outline-flatten-exposed-to-buffer' abbreviates topic | |
350 numbers to minimal amount with some context. Otherwise, entire | |
351 numbers are always used." | |
352 :type 'boolean | |
353 :group 'allout) | |
354 | |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
355 ;;;_ + LaTeX formatting |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
356 ;;;_ - outline-number-pages |
21088 | 357 (defcustom outline-number-pages nil |
358 "*Non-nil turns on page numbering for LaTeX formatting of an outline." | |
359 :type 'boolean | |
360 :group 'allout) | |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
361 ;;;_ - outline-label-style |
21088 | 362 (defcustom outline-label-style "\\large\\bf" |
363 "*Font and size of labels for LaTeX formatting of an outline." | |
364 :type 'string | |
365 :group 'allout) | |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
366 ;;;_ - outline-head-line-style |
21088 | 367 (defcustom outline-head-line-style "\\large\\sl " |
368 "*Font and size of entries for LaTeX formatting of an outline." | |
369 :type 'string | |
370 :group 'allout) | |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
371 ;;;_ - outline-body-line-style |
21088 | 372 (defcustom outline-body-line-style " " |
373 "*Font and size of entries for LaTeX formatting of an outline." | |
374 :type 'string | |
375 :group 'allout) | |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
376 ;;;_ - outline-title-style |
21088 | 377 (defcustom outline-title-style "\\Large\\bf" |
378 "*Font and size of titles for LaTeX formatting of an outline." | |
379 :type 'string | |
380 :group 'allout) | |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
381 ;;;_ - outline-title |
21088 | 382 (defcustom outline-title '(or buffer-file-name (current-buffer-name)) |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
383 "*Expression to be evaluated to determine the title for LaTeX |
21088 | 384 formatted copy." |
385 :type 'sexp | |
386 :group 'allout) | |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
387 ;;;_ - outline-line-skip |
21088 | 388 (defcustom outline-line-skip ".05cm" |
389 "*Space between lines for LaTeX formatting of an outline." | |
390 :type 'string | |
391 :group 'allout) | |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
392 ;;;_ - outline-indent |
21088 | 393 (defcustom outline-indent ".3cm" |
394 "*LaTeX formatted depth-indent spacing." | |
395 :type 'string | |
396 :group 'allout) | |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
397 |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
398 ;;;_ + Miscellaneous customization |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
399 |
29490 | 400 ;;;_ = outline-command-prefix |
401 (defcustom outline-command-prefix "\C-c" | |
402 "*Key sequence to be used as prefix for outline mode command key bindings." | |
403 :type 'string | |
404 :group 'allout) | |
405 | |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
406 ;;;_ = outline-keybindings-list |
15664
a50ebf4ac764
(outline-auto-activation, outline-layout)
Karl Heuer <kwzh@gnu.org>
parents:
15663
diff
changeset
|
407 ;;; You have to reactivate outline-mode - `(outline-mode t)' - to |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
408 ;;; institute changes to this var. |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
409 (defvar outline-keybindings-list () |
29490 | 410 "*List of outline-mode key / function bindings, for outline-mode-map. |
411 | |
412 String or vector key will be prefaced with outline-command-prefix, | |
413 unless optional third, non-nil element is present.") | |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
414 (setq outline-keybindings-list |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
415 '( |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
416 ; Motion commands: |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
417 ("\C-n" outline-next-visible-heading) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
418 ("\C-p" outline-previous-visible-heading) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
419 ("\C-u" outline-up-current-level) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
420 ("\C-f" outline-forward-current-level) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
421 ("\C-b" outline-backward-current-level) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
422 ("\C-a" outline-beginning-of-current-entry) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
423 ("\C-e" outline-end-of-current-entry) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
424 ; Exposure commands: |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
425 ("\C-i" outline-show-children) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
426 ("\C-s" outline-show-current-subtree) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
427 ("\C-h" outline-hide-current-subtree) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
428 ("\C-o" outline-show-current-entry) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
429 ("!" outline-show-all) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
430 ; Alteration commands: |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
431 (" " outline-open-sibtopic) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
432 ("." outline-open-subtopic) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
433 ("," outline-open-supertopic) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
434 ("'" outline-shift-in) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
435 (">" outline-shift-in) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
436 ("<" outline-shift-out) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
437 ("\C-m" outline-rebullet-topic) |
11661
9ac485495712
(outline-rebullet-current-heading): Change to C-c *.
Karl Heuer <kwzh@gnu.org>
parents:
11034
diff
changeset
|
438 ("*" outline-rebullet-current-heading) |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
439 ("#" outline-number-siblings) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
440 ("\C-k" outline-kill-line t) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
441 ("\C-y" outline-yank t) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
442 ("\M-y" outline-yank-pop t) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
443 ("\C-k" outline-kill-topic) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
444 ; Miscellaneous commands: |
29490 | 445 ;([?\C-\ ] outline-mark-topic) |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
446 ("@" outline-resolve-xref) |
29490 | 447 ("=c" outline-copy-exposed-to-buffer) |
448 ("=i" outline-indented-exposed-to-buffer) | |
449 ("=t" outline-latexify-exposed) | |
450 ("=p" outline-flatten-exposed-to-buffer))) | |
451 | |
452 ;;;_ = outline-isearch-dynamic-expose | |
453 (defcustom outline-isearch-dynamic-expose t | |
454 "*Non-nil enable dynamic exposure of hidden incremental-search | |
455 targets as they're encountered." | |
21088 | 456 :type 'boolean |
457 :group 'allout) | |
29490 | 458 (make-variable-buffer-local 'outline-isearch-dynamic-expose) |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
459 |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
460 ;;;_ = outline-use-hanging-indents |
21088 | 461 (defcustom outline-use-hanging-indents t |
7416
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
462 "*If non-nil, topic body text auto-indent defaults to indent of the header. |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
463 Ie, it is indented to be just past the header prefix. This is |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
464 relevant mostly for use with indented-text-mode, or other situations |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
465 where auto-fill occurs. |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
466 |
15664
a50ebf4ac764
(outline-auto-activation, outline-layout)
Karl Heuer <kwzh@gnu.org>
parents:
15663
diff
changeset
|
467 \[This feature no longer depends in any way on the `filladapt.el' |
21088 | 468 lisp-archive package.\]" |
469 :type 'boolean | |
470 :group 'allout) | |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
471 (make-variable-buffer-local 'outline-use-hanging-indents) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
472 |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
473 ;;;_ = outline-reindent-bodies |
21088 | 474 (defcustom outline-reindent-bodies (if outline-use-hanging-indents |
7527
1f09079e18c4
(outline-mode): Use outline-this-or-next-heading.
Richard M. Stallman <rms@gnu.org>
parents:
7476
diff
changeset
|
475 'text) |
7416
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
476 "*Non-nil enables auto-adjust of topic body hanging indent with depth shifts. |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
477 |
7527
1f09079e18c4
(outline-mode): Use outline-this-or-next-heading.
Richard M. Stallman <rms@gnu.org>
parents:
7476
diff
changeset
|
478 When active, topic body lines that are indented even with or beyond |
1f09079e18c4
(outline-mode): Use outline-this-or-next-heading.
Richard M. Stallman <rms@gnu.org>
parents:
7476
diff
changeset
|
479 their topic header are reindented to correspond with depth shifts of |
1f09079e18c4
(outline-mode): Use outline-this-or-next-heading.
Richard M. Stallman <rms@gnu.org>
parents:
7476
diff
changeset
|
480 the header. |
1f09079e18c4
(outline-mode): Use outline-this-or-next-heading.
Richard M. Stallman <rms@gnu.org>
parents:
7476
diff
changeset
|
481 |
1f09079e18c4
(outline-mode): Use outline-this-or-next-heading.
Richard M. Stallman <rms@gnu.org>
parents:
7476
diff
changeset
|
482 A value of `t' enables reindent in non-programming-code buffers, ie |
1f09079e18c4
(outline-mode): Use outline-this-or-next-heading.
Richard M. Stallman <rms@gnu.org>
parents:
7476
diff
changeset
|
483 those that do not have the variable `comment-start' set. A value of |
21088 | 484 `force' enables reindent whether or not `comment-start' is set." |
485 :type '(choice (const nil) (const t) (const text) (const force)) | |
486 :group 'allout) | |
7527
1f09079e18c4
(outline-mode): Use outline-this-or-next-heading.
Richard M. Stallman <rms@gnu.org>
parents:
7476
diff
changeset
|
487 |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
488 (make-variable-buffer-local 'outline-reindent-bodies) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
489 |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
490 ;;;_ = outline-inhibit-protection |
21088 | 491 (defcustom outline-inhibit-protection nil |
7416
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
492 "*Non-nil disables warnings and confirmation-checks for concealed-text edits. |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
493 |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
494 Outline mode uses emacs change-triggered functions to detect unruly |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
495 changes to concealed regions. Set this var non-nil to disable the |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
496 protection, potentially increasing text-entry responsiveness a bit. |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
497 |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
498 This var takes effect at outline-mode activation, so you may have to |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
499 deactivate and then reactivate the mode if you want to toggle the |
21088 | 500 behavior." |
501 :type 'boolean | |
502 :group 'allout) | |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
503 |
7416
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
504 ;;;_* CODE - no user customizations below. |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
505 |
29490 | 506 ;;;_ #1 Internal Outline Formatting and Configuration |
507 ;;;_ : Version | |
7416
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
508 ;;;_ = outline-version |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
509 (defvar outline-version |
36390
495ba6e137c7
(outline-flag-region): Move macro in front of first
Gerd Moellmann <gerd@gnu.org>
parents:
29490
diff
changeset
|
510 (let ((rcs-rev "$Revision: 1.26 $")) |
7416
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
511 (condition-case err |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
512 (save-match-data |
7527
1f09079e18c4
(outline-mode): Use outline-this-or-next-heading.
Richard M. Stallman <rms@gnu.org>
parents:
7476
diff
changeset
|
513 (string-match "Revision: \\([0-9]+\\.[0-9]+\\)" rcs-rev) |
7416
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
514 (substring rcs-rev (match-beginning 1) (match-end 1))) |
29490 | 515 ('error rcs-rev))) |
7527
1f09079e18c4
(outline-mode): Use outline-this-or-next-heading.
Richard M. Stallman <rms@gnu.org>
parents:
7476
diff
changeset
|
516 "Revision number of currently loaded outline package. \(allout.el)") |
7416
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
517 ;;;_ > outline-version |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
518 (defun outline-version (&optional here) |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
519 "Return string describing the loaded outline version." |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
520 (interactive "P") |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
521 (let ((msg (concat "Allout Outline Mode v " outline-version))) |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
522 (if here (insert-string msg)) |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
523 (message "%s" msg) |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
524 msg)) |
29490 | 525 ;;;_ : Topic header format |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
526 ;;;_ = outline-regexp |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
527 (defvar outline-regexp "" |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
528 "*Regular expression to match the beginning of a heading line. |
7416
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
529 |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
530 Any line whose beginning matches this regexp is considered a |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
531 heading. This var is set according to the user configuration vars |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
532 by set-outline-regexp.") |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
533 (make-variable-buffer-local 'outline-regexp) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
534 ;;;_ = outline-bullets-string |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
535 (defvar outline-bullets-string "" |
7416
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
536 "A string dictating the valid set of outline topic bullets. |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
537 |
15664
a50ebf4ac764
(outline-auto-activation, outline-layout)
Karl Heuer <kwzh@gnu.org>
parents:
15663
diff
changeset
|
538 This var should *not* be set by the user - it is set by `set-outline-regexp', |
a50ebf4ac764
(outline-auto-activation, outline-layout)
Karl Heuer <kwzh@gnu.org>
parents:
15663
diff
changeset
|
539 and is produced from the elements of `outline-plain-bullets-string' |
a50ebf4ac764
(outline-auto-activation, outline-layout)
Karl Heuer <kwzh@gnu.org>
parents:
15663
diff
changeset
|
540 and `outline-distinctive-bullets-string'.") |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
541 (make-variable-buffer-local 'outline-bullets-string) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
542 ;;;_ = outline-bullets-string-len |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
543 (defvar outline-bullets-string-len 0 |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
544 "Length of current buffers' outline-plain-bullets-string.") |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
545 (make-variable-buffer-local 'outline-bullets-string-len) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
546 ;;;_ = outline-line-boundary-regexp |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
547 (defvar outline-line-boundary-regexp () |
7416
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
548 "Outline-regexp with outline-style beginning-of-line anchor. |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
549 |
7639 | 550 \(Ie, C-j, *or* C-m, for prefixes of hidden topics). This is properly |
15664
a50ebf4ac764
(outline-auto-activation, outline-layout)
Karl Heuer <kwzh@gnu.org>
parents:
15663
diff
changeset
|
551 set when outline-regexp is produced by `set-outline-regexp', so |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
552 that (match-beginning 2) and (match-end 2) delimit the prefix.") |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
553 (make-variable-buffer-local 'outline-line-boundary-regexp) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
554 ;;;_ = outline-bob-regexp |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
555 (defvar outline-bob-regexp () |
7416
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
556 "Like outline-line-boundary-regexp, for headers at beginning of buffer. |
29490 | 557 \(match-beginning 2) and \(match-end 2) delimit the prefix.") |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
558 (make-variable-buffer-local 'outline-bob-regexp) |
3430 | 559 ;;;_ = outline-header-subtraction |
560 (defvar outline-header-subtraction (1- (length outline-header-prefix)) | |
7416
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
561 "Outline-header prefix length to subtract when computing topic depth.") |
3430 | 562 (make-variable-buffer-local 'outline-header-subtraction) |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
563 ;;;_ = outline-plain-bullets-string-len |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
564 (defvar outline-plain-bullets-string-len (length outline-plain-bullets-string) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
565 "Length of outline-plain-bullets-string, updated by set-outline-regexp.") |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
566 (make-variable-buffer-local 'outline-plain-bullets-string-len) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
567 |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
568 |
7527
1f09079e18c4
(outline-mode): Use outline-this-or-next-heading.
Richard M. Stallman <rms@gnu.org>
parents:
7476
diff
changeset
|
569 ;;;_ X outline-reset-header-lead (header-lead) |
3430 | 570 (defun outline-reset-header-lead (header-lead) |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
571 "*Reset the leading string used to identify topic headers." |
3430 | 572 (interactive "sNew lead string: ") |
573 (setq outline-header-prefix header-lead) | |
574 (setq outline-header-subtraction (1- (length outline-header-prefix))) | |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
575 (set-outline-regexp)) |
7527
1f09079e18c4
(outline-mode): Use outline-this-or-next-heading.
Richard M. Stallman <rms@gnu.org>
parents:
7476
diff
changeset
|
576 ;;;_ X outline-lead-with-comment-string (header-lead) |
3430 | 577 (defun outline-lead-with-comment-string (&optional header-lead) |
7416
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
578 "*Set the topic-header leading string to specified string. |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
579 |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
580 Useful when for encapsulating outline structure in programming |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
581 language comments. Returns the leading string." |
3430 | 582 |
583 (interactive "P") | |
584 (if (not (stringp header-lead)) | |
585 (setq header-lead (read-string | |
586 "String prefix for topic headers: "))) | |
587 (setq outline-reindent-bodies nil) | |
588 (outline-reset-header-lead header-lead) | |
589 header-lead) | |
7527
1f09079e18c4
(outline-mode): Use outline-this-or-next-heading.
Richard M. Stallman <rms@gnu.org>
parents:
7476
diff
changeset
|
590 ;;;_ > outline-infer-header-lead () |
1f09079e18c4
(outline-mode): Use outline-this-or-next-heading.
Richard M. Stallman <rms@gnu.org>
parents:
7476
diff
changeset
|
591 (defun outline-infer-header-lead () |
7416
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
592 "Determine appropriate `outline-header-prefix'. |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
593 |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
594 Works according to settings of: |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
595 |
7527
1f09079e18c4
(outline-mode): Use outline-this-or-next-heading.
Richard M. Stallman <rms@gnu.org>
parents:
7476
diff
changeset
|
596 `comment-start' |
7416
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
597 `outline-header-prefix' (default) |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
598 `outline-use-mode-specific-leader' |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
599 and `outline-mode-leaders'. |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
600 |
29490 | 601 Apply this via \(re)activation of `outline-mode', rather than |
7527
1f09079e18c4
(outline-mode): Use outline-this-or-next-heading.
Richard M. Stallman <rms@gnu.org>
parents:
7476
diff
changeset
|
602 invoking it directly." |
7416
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
603 (let* ((use-leader (and (boundp 'outline-use-mode-specific-leader) |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
604 (if (or (stringp outline-use-mode-specific-leader) |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
605 (memq outline-use-mode-specific-leader |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
606 '(outline-mode-leaders |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
607 comment-start |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
608 t))) |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
609 outline-use-mode-specific-leader |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
610 ;; Oops - garbled value, equate with effect of 't: |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
611 t))) |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
612 (leader |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
613 (cond |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
614 ((not use-leader) nil) |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
615 ;; Use the explicitly designated leader: |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
616 ((stringp use-leader) use-leader) |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
617 (t (or (and (memq use-leader '(t outline-mode-leaders)) |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
618 ;; Get it from outline mode leaders? |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
619 (cdr (assq major-mode outline-mode-leaders))) |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
620 ;; ... didn't get from outline-mode-leaders... |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
621 (and (memq use-leader '(t comment-start)) |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
622 comment-start |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
623 ;; Use comment-start, maybe tripled, and with |
15664
a50ebf4ac764
(outline-auto-activation, outline-layout)
Karl Heuer <kwzh@gnu.org>
parents:
15663
diff
changeset
|
624 ;; underscore: |
7416
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
625 (concat |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
626 (if (string= " " |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
627 (substring comment-start |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
628 (1- (length comment-start)))) |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
629 ;; Use comment-start, sans trailing space: |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
630 (substring comment-start 0 -1) |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
631 (concat comment-start comment-start comment-start)) |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
632 ;; ... and append underscore, whichever: |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
633 "_"))))))) |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
634 (if (not leader) |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
635 nil |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
636 (if (string= leader outline-header-prefix) |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
637 nil ; no change, nothing to do. |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
638 (setq outline-header-prefix leader) |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
639 outline-header-prefix)))) |
7527
1f09079e18c4
(outline-mode): Use outline-this-or-next-heading.
Richard M. Stallman <rms@gnu.org>
parents:
7476
diff
changeset
|
640 ;;;_ > outline-infer-body-reindent () |
1f09079e18c4
(outline-mode): Use outline-this-or-next-heading.
Richard M. Stallman <rms@gnu.org>
parents:
7476
diff
changeset
|
641 (defun outline-infer-body-reindent () |
1f09079e18c4
(outline-mode): Use outline-this-or-next-heading.
Richard M. Stallman <rms@gnu.org>
parents:
7476
diff
changeset
|
642 "Determine proper setting for `outline-reindent-bodies'. |
1f09079e18c4
(outline-mode): Use outline-this-or-next-heading.
Richard M. Stallman <rms@gnu.org>
parents:
7476
diff
changeset
|
643 |
1f09079e18c4
(outline-mode): Use outline-this-or-next-heading.
Richard M. Stallman <rms@gnu.org>
parents:
7476
diff
changeset
|
644 Depends on default setting of `outline-reindent-bodies' \(which see) |
1f09079e18c4
(outline-mode): Use outline-this-or-next-heading.
Richard M. Stallman <rms@gnu.org>
parents:
7476
diff
changeset
|
645 and presence of setting for `comment-start', to tell whether the |
1f09079e18c4
(outline-mode): Use outline-this-or-next-heading.
Richard M. Stallman <rms@gnu.org>
parents:
7476
diff
changeset
|
646 file is programming code." |
1f09079e18c4
(outline-mode): Use outline-this-or-next-heading.
Richard M. Stallman <rms@gnu.org>
parents:
7476
diff
changeset
|
647 (if (and outline-reindent-bodies |
1f09079e18c4
(outline-mode): Use outline-this-or-next-heading.
Richard M. Stallman <rms@gnu.org>
parents:
7476
diff
changeset
|
648 comment-start |
1f09079e18c4
(outline-mode): Use outline-this-or-next-heading.
Richard M. Stallman <rms@gnu.org>
parents:
7476
diff
changeset
|
649 (not (eq 'force outline-reindent-bodies))) |
1f09079e18c4
(outline-mode): Use outline-this-or-next-heading.
Richard M. Stallman <rms@gnu.org>
parents:
7476
diff
changeset
|
650 (setq outline-reindent-bodies nil))) |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
651 ;;;_ > set-outline-regexp () |
3430 | 652 (defun set-outline-regexp () |
7416
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
653 "Generate proper topic-header regexp form for outline functions. |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
654 |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
655 Works with respect to `outline-plain-bullets-string' and |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
656 `outline-distinctive-bullets-string'." |
3430 | 657 |
658 (interactive) | |
659 ;; Derive outline-bullets-string from user configured components: | |
660 (setq outline-bullets-string "") | |
661 (let ((strings (list 'outline-plain-bullets-string | |
29490 | 662 'outline-distinctive-bullets-string |
663 'outline-primary-bullet)) | |
3430 | 664 cur-string |
665 cur-len | |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
666 cur-char |
3430 | 667 cur-char-string |
668 index | |
669 new-string) | |
670 (while strings | |
671 (setq new-string "") (setq index 0) | |
672 (setq cur-len (length (setq cur-string (symbol-value (car strings))))) | |
673 (while (< index cur-len) | |
674 (setq cur-char (aref cur-string index)) | |
675 (setq outline-bullets-string | |
676 (concat outline-bullets-string | |
677 (cond | |
678 ; Single dash would denote a | |
679 ; sequence, repeated denotes | |
680 ; a dash: | |
681 ((eq cur-char ?-) "--") | |
682 ; literal close-square-bracket | |
683 ; doesn't work right in the | |
684 ; expr, exclude it: | |
685 ((eq cur-char ?\]) "") | |
686 (t (regexp-quote (char-to-string cur-char)))))) | |
687 (setq index (1+ index))) | |
688 (setq strings (cdr strings))) | |
689 ) | |
690 ;; Derive next for repeated use in outline-pending-bullet: | |
691 (setq outline-plain-bullets-string-len (length outline-plain-bullets-string)) | |
692 (setq outline-header-subtraction (1- (length outline-header-prefix))) | |
693 ;; Produce the new outline-regexp: | |
694 (setq outline-regexp (concat "\\(\\" | |
695 outline-header-prefix | |
696 "[ \t]*[" | |
697 outline-bullets-string | |
698 "]\\)\\|\\" | |
699 outline-primary-bullet | |
700 "+\\|\^l")) | |
701 (setq outline-line-boundary-regexp | |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
702 (concat "\\([\n\r]\\)\\(" outline-regexp "\\)")) |
3430 | 703 (setq outline-bob-regexp |
704 (concat "\\(\\`\\)\\(" outline-regexp "\\)")) | |
705 ) | |
29490 | 706 ;;;_ : Key bindings |
7416
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
707 ;;;_ = outline-mode-map |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
708 (defvar outline-mode-map nil "Keybindings for (allout) outline minor mode.") |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
709 ;;;_ > produce-outline-mode-map (keymap-alist &optional base-map) |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
710 (defun produce-outline-mode-map (keymap-list &optional base-map) |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
711 "Produce keymap for use as outline-mode-map, from keymap-list. |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
712 |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
713 Built on top of optional BASE-MAP, or empty sparse map if none specified. |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
714 See doc string for outline-keybindings-list for format of binding list." |
29490 | 715 (let ((map (or base-map (make-sparse-keymap))) |
716 (pref (list outline-command-prefix))) | |
717 (mapcar (function | |
718 (lambda (cell) | |
719 (let ((add-pref (null (cdr (cdr cell)))) | |
720 (key-suff (list (car cell)))) | |
721 (apply 'define-key | |
722 (list map | |
723 (apply 'concat (if add-pref | |
724 (append pref key-suff) | |
725 key-suff)) | |
726 (car (cdr cell))))))) | |
7416
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
727 keymap-list) |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
728 map)) |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
729 ;;;_ = outline-prior-bindings - being deprecated. |
15664
a50ebf4ac764
(outline-auto-activation, outline-layout)
Karl Heuer <kwzh@gnu.org>
parents:
15663
diff
changeset
|
730 (defvar outline-prior-bindings nil |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
731 "Variable for use in V18, with outline-added-bindings, for |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
732 resurrecting, on mode deactivation, bindings that existed before |
7416
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
733 activation. Being deprecated.") |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
734 ;;;_ = outline-added-bindings - being deprecated |
15664
a50ebf4ac764
(outline-auto-activation, outline-layout)
Karl Heuer <kwzh@gnu.org>
parents:
15663
diff
changeset
|
735 (defvar outline-added-bindings nil |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
736 "Variable for use in V18, with outline-prior-bindings, for |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
737 resurrecting, on mode deactivation, bindings that existed before |
7416
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
738 activation. Being deprecated.") |
29490 | 739 ;;;_ : Menu bar |
740 (defun produce-outline-mode-menubar-entries () | |
741 (require 'easymenu) | |
742 (easy-menu-define outline-mode-exposure-menu | |
743 outline-mode-map | |
744 "Allout outline exposure menu." | |
745 '("Exposure" | |
746 ["Show Entry" outline-show-current-entry t] | |
747 ["Show Children" outline-show-children t] | |
748 ["Show Subtree" outline-show-current-subtree t] | |
749 ["Hide Subtree" outline-hide-current-subtree t] | |
750 ["Hide Leaves" outline-hide-current-leaves t] | |
751 "----" | |
752 ["Show All" outline-show-all t])) | |
753 (easy-menu-define outline-mode-editing-menu | |
754 outline-mode-map | |
755 "Allout outline editing menu." | |
756 '("Headings" | |
757 ["Open Sibling" outline-open-sibtopic t] | |
758 ["Open Subtopic" outline-open-subtopic t] | |
759 ["Open Supertopic" outline-open-supertopic t] | |
760 "----" | |
761 ["Shift Topic In" outline-shift-in t] | |
762 ["Shift Topic Out" outline-shift-out t] | |
763 ["Rebullet Topic" outline-rebullet-topic t] | |
764 ["Rebullet Heading" outline-rebullet-current-heading t] | |
765 ["Number Siblings" outline-number-siblings t])) | |
766 (easy-menu-define outline-mode-navigation-menu | |
767 outline-mode-map | |
768 "Allout outline navigation menu." | |
769 '("Navigation" | |
770 ["Next Visible Heading" outline-next-visible-heading t] | |
771 ["Previous Visible Heading" | |
772 outline-previous-visible-heading t] | |
773 "----" | |
774 ["Up Level" outline-up-current-level t] | |
775 ["Forward Current Level" outline-forward-current-level t] | |
776 ["Backward Current Level" | |
777 outline-backward-current-level t] | |
778 "----" | |
779 ["Beginning of Entry" | |
780 outline-beginning-of-current-entry t] | |
781 ["End of Entry" outline-end-of-current-entry t] | |
782 ["End of Subtree" outline-end-of-current-subtree t])) | |
783 (easy-menu-define outline-mode-misc-menu | |
784 outline-mode-map | |
785 "Allout outlines miscellaneous bindings." | |
786 '("Misc" | |
787 ["Version" outline-version t] | |
788 "----" | |
789 ["Duplicate Exposed" outline-copy-exposed-to-buffer t] | |
790 ["Duplicate Exposed, numbered" | |
791 outline-flatten-exposed-to-buffer t] | |
792 ["Duplicate Exposed, indented" | |
793 outline-indented-exposed-to-buffer t] | |
794 "----" | |
795 ["Set Header Lead" outline-reset-header-lead t] | |
796 ["Set New Exposure" outline-expose-topic t]))) | |
797 ;;;_ : Mode-Specific Variable Maintenance Utilities | |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
798 ;;;_ = outline-mode-prior-settings |
3430 | 799 (defvar outline-mode-prior-settings nil |
7416
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
800 "Internal outline mode use; settings to be resumed on mode deactivation.") |
3430 | 801 (make-variable-buffer-local 'outline-mode-prior-settings) |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
802 ;;;_ > outline-resumptions (name &optional value) |
3430 | 803 (defun outline-resumptions (name &optional value) |
804 | |
7416
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
805 "Registers or resumes settings over outline-mode activation/deactivation. |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
806 |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
807 First arg is NAME of variable affected. Optional second arg is list |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
808 containing outline-mode-specific VALUE to be imposed on named |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
809 variable, and to be registered. (It's a list so you can specify |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
810 registrations of null values.) If no value is specified, the |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
811 registered value is returned (encapsulated in the list, so the caller |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
812 can distinguish nil vs no value), and the registration is popped |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
813 from the list." |
3430 | 814 |
815 (let ((on-list (assq name outline-mode-prior-settings)) | |
15664
a50ebf4ac764
(outline-auto-activation, outline-layout)
Karl Heuer <kwzh@gnu.org>
parents:
15663
diff
changeset
|
816 prior-capsule ; By `capsule' i mean a list |
3430 | 817 ; containing a value, so we can |
818 ; distinguish nil from no value. | |
819 ) | |
820 | |
821 (if value | |
822 | |
823 ;; Registering: | |
824 (progn | |
825 (if on-list | |
826 nil ; Already preserved prior value - don't mess with it. | |
827 ;; Register the old value, or nil if previously unbound: | |
828 (setq outline-mode-prior-settings | |
829 (cons (list name | |
830 (if (boundp name) (list (symbol-value name)))) | |
831 outline-mode-prior-settings))) | |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
832 ; And impose the new value, locally: |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
833 (progn (make-local-variable name) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
834 (set name (car value)))) |
3430 | 835 |
836 ;; Relinquishing: | |
837 (if (not on-list) | |
838 | |
839 ;; Oops, not registered - leave it be: | |
840 nil | |
841 | |
842 ;; Some registration: | |
843 ; reestablish it: | |
844 (setq prior-capsule (car (cdr on-list))) | |
845 (if prior-capsule | |
846 (set name (car prior-capsule)) ; Some prior value - reestablish it. | |
847 (makunbound name)) ; Previously unbound - demolish var. | |
848 ; Remove registration: | |
849 (let (rebuild) | |
850 (while outline-mode-prior-settings | |
851 (if (not (eq (car outline-mode-prior-settings) | |
852 on-list)) | |
853 (setq rebuild | |
854 (cons (car outline-mode-prior-settings) | |
855 rebuild))) | |
856 (setq outline-mode-prior-settings | |
857 (cdr outline-mode-prior-settings))) | |
858 (setq outline-mode-prior-settings rebuild))))) | |
859 ) | |
29490 | 860 ;;;_ : Mode-specific incidentals |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
861 ;;;_ = outline-during-write-cue nil |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
862 (defvar outline-during-write-cue nil |
7416
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
863 "Used to inhibit outline change-protection during file write. |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
864 |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
865 See also `outline-post-command-business', `outline-write-file-hook', |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
866 `outline-before-change-protect', and `outline-post-command-business' |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
867 functions.") |
29490 | 868 ;;;_ = outline-pre-was-isearching nil |
869 (defvar outline-pre-was-isearching nil | |
870 "Cue for isearch-dynamic-exposure mechanism, implemented in | |
871 outline-pre- and -post-command-hooks.") | |
872 (make-variable-buffer-local 'outline-pre-was-isearching) | |
873 ;;;_ = outline-isearch-prior-pos nil | |
874 (defvar outline-isearch-prior-pos nil | |
875 "Cue for isearch-dynamic-exposure tracking, used by outline-isearch-expose.") | |
876 (make-variable-buffer-local 'outline-isearch-prior-pos) | |
877 ;;;_ = outline-isearch-did-quit | |
878 (defvar outline-isearch-did-quit nil | |
879 "Distinguishes isearch conclusion and cancellation. | |
880 | |
881 Maintained by outline-isearch-abort \(which is wrapped around the real | |
882 isearch-abort), and monitored by outline-isearch-expose for action.") | |
883 (make-variable-buffer-local 'outline-isearch-did-quit) | |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
884 ;;;_ = outline-override-protect nil |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
885 (defvar outline-override-protect nil |
7416
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
886 "Used in outline-mode for regulate of concealed-text protection mechanism. |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
887 |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
888 Allout outline mode regulates alteration of concealed text to protect |
13964
4de229297f1f
(outline-primary-bullet, outline-numbered-bullet,
Karl Heuer <kwzh@gnu.org>
parents:
13337
diff
changeset
|
889 against inadvertent, unnoticed changes. This is for use by specific, |
7416
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
890 native outline functions to temporarily override that protection. |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
891 It's automatically reset to nil after every buffer modification.") |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
892 (make-variable-buffer-local 'outline-override-protect) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
893 ;;;_ > outline-unprotected (expr) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
894 (defmacro outline-unprotected (expr) |
29490 | 895 "Evaluate EXPRESSION with `outline-override-protect' let-bound `t'." |
896 `(let ((outline-override-protect t)) | |
897 ,expr)) | |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
898 ;;;_ = outline-undo-aggregation |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
899 (defvar outline-undo-aggregation 30 |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
900 "Amount of successive self-insert actions to bunch together per undo. |
7416
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
901 |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
902 This is purely a kludge variable, regulating the compensation for a bug in |
29490 | 903 the way that before-change-functions and undo interact.") |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
904 (make-variable-buffer-local 'outline-undo-aggregation) |
7416
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
905 ;;;_ = file-var-bug hack |
29490 | 906 (defvar outline-v18/19-file-var-hack nil |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
907 "Horrible hack used to prevent invalid multiple triggering of outline |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
908 mode from prop-line file-var activation. Used by outline-mode function |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
909 to track repeats.") |
7416
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
910 ;;;_ > outline-write-file-hook () |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
911 (defun outline-write-file-hook () |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
912 "In outline mode, run as a local-write-file-hooks activity. |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
913 |
15664
a50ebf4ac764
(outline-auto-activation, outline-layout)
Karl Heuer <kwzh@gnu.org>
parents:
15663
diff
changeset
|
914 Currently just sets `outline-during-write-cue', so outline-change-protection |
a50ebf4ac764
(outline-auto-activation, outline-layout)
Karl Heuer <kwzh@gnu.org>
parents:
15663
diff
changeset
|
915 knows to keep inactive during file write." |
7416
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
916 (setq outline-during-write-cue t) |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
917 nil) |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
918 |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
919 ;;;_ #2 Mode activation |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
920 ;;;_ = outline-mode |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
921 (defvar outline-mode () "Allout outline mode minor-mode flag.") |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
922 (make-variable-buffer-local 'outline-mode) |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
923 ;;;_ > outline-mode-p () |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
924 (defmacro outline-mode-p () |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
925 "Return t if outline-mode is active in current buffer." |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
926 'outline-mode) |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
927 ;;;_ = outline-explicitly-deactivated |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
928 (defvar outline-explicitly-deactivated nil |
13964
4de229297f1f
(outline-primary-bullet, outline-numbered-bullet,
Karl Heuer <kwzh@gnu.org>
parents:
13337
diff
changeset
|
929 "Outline-mode was last deliberately deactivated. |
7416
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
930 So outline-post-command-business should not reactivate it...") |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
931 (make-variable-buffer-local 'outline-explicitly-deactivated) |
7527
1f09079e18c4
(outline-mode): Use outline-this-or-next-heading.
Richard M. Stallman <rms@gnu.org>
parents:
7476
diff
changeset
|
932 ;;;_ > outline-init (&optional mode) |
1f09079e18c4
(outline-mode): Use outline-this-or-next-heading.
Richard M. Stallman <rms@gnu.org>
parents:
7476
diff
changeset
|
933 (defun outline-init (&optional mode) |
7416
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
934 "Prime outline-mode to enable/disable auto-activation, wrt `outline-layout'. |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
935 |
7527
1f09079e18c4
(outline-mode): Use outline-this-or-next-heading.
Richard M. Stallman <rms@gnu.org>
parents:
7476
diff
changeset
|
936 MODE is one of the following symbols: |
1f09079e18c4
(outline-mode): Use outline-this-or-next-heading.
Richard M. Stallman <rms@gnu.org>
parents:
7476
diff
changeset
|
937 |
15664
a50ebf4ac764
(outline-auto-activation, outline-layout)
Karl Heuer <kwzh@gnu.org>
parents:
15663
diff
changeset
|
938 - nil \(or no argument) deactivate auto-activation/layout; |
a50ebf4ac764
(outline-auto-activation, outline-layout)
Karl Heuer <kwzh@gnu.org>
parents:
15663
diff
changeset
|
939 - `activate', enable auto-activation only; |
a50ebf4ac764
(outline-auto-activation, outline-layout)
Karl Heuer <kwzh@gnu.org>
parents:
15663
diff
changeset
|
940 - `ask', enable auto-activation, and enable auto-layout but with |
13964
4de229297f1f
(outline-primary-bullet, outline-numbered-bullet,
Karl Heuer <kwzh@gnu.org>
parents:
13337
diff
changeset
|
941 confirmation for layout operation solicited from user each time; |
15664
a50ebf4ac764
(outline-auto-activation, outline-layout)
Karl Heuer <kwzh@gnu.org>
parents:
15663
diff
changeset
|
942 - `report', just report and return the current auto-activation state; |
7527
1f09079e18c4
(outline-mode): Use outline-this-or-next-heading.
Richard M. Stallman <rms@gnu.org>
parents:
7476
diff
changeset
|
943 - anything else \(eg, t) for auto-activation and auto-layout, without |
1f09079e18c4
(outline-mode): Use outline-this-or-next-heading.
Richard M. Stallman <rms@gnu.org>
parents:
7476
diff
changeset
|
944 any confirmation check. |
7416
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
945 |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
946 Use this function to setup your emacs session for automatic activation |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
947 of allout outline mode, contingent to the buffer-specific setting of |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
948 the `outline-layout' variable. (See `outline-layout' and |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
949 `outline-expose-topic' docstrings for more details on auto layout). |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
950 |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
951 `outline-init' works by setting up (or removing) the outline-mode |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
952 find-file-hook, and giving `outline-auto-activation' a suitable |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
953 setting. |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
954 |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
955 To prime your emacs session for full auto-outline operation, include |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
956 the following two lines in your emacs init file: |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
957 |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
958 \(require 'allout) |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
959 \(outline-init t)" |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
960 |
7527
1f09079e18c4
(outline-mode): Use outline-this-or-next-heading.
Richard M. Stallman <rms@gnu.org>
parents:
7476
diff
changeset
|
961 (interactive) |
1f09079e18c4
(outline-mode): Use outline-this-or-next-heading.
Richard M. Stallman <rms@gnu.org>
parents:
7476
diff
changeset
|
962 (if (interactive-p) |
7416
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
963 (progn |
7527
1f09079e18c4
(outline-mode): Use outline-this-or-next-heading.
Richard M. Stallman <rms@gnu.org>
parents:
7476
diff
changeset
|
964 (setq mode |
1f09079e18c4
(outline-mode): Use outline-this-or-next-heading.
Richard M. Stallman <rms@gnu.org>
parents:
7476
diff
changeset
|
965 (completing-read |
1f09079e18c4
(outline-mode): Use outline-this-or-next-heading.
Richard M. Stallman <rms@gnu.org>
parents:
7476
diff
changeset
|
966 (concat "Select outline auto setup mode " |
1f09079e18c4
(outline-mode): Use outline-this-or-next-heading.
Richard M. Stallman <rms@gnu.org>
parents:
7476
diff
changeset
|
967 "(empty for report, ? for options) ") |
1f09079e18c4
(outline-mode): Use outline-this-or-next-heading.
Richard M. Stallman <rms@gnu.org>
parents:
7476
diff
changeset
|
968 '(("nil")("full")("activate")("deactivate") |
1f09079e18c4
(outline-mode): Use outline-this-or-next-heading.
Richard M. Stallman <rms@gnu.org>
parents:
7476
diff
changeset
|
969 ("ask") ("report") ("")) |
1f09079e18c4
(outline-mode): Use outline-this-or-next-heading.
Richard M. Stallman <rms@gnu.org>
parents:
7476
diff
changeset
|
970 nil |
1f09079e18c4
(outline-mode): Use outline-this-or-next-heading.
Richard M. Stallman <rms@gnu.org>
parents:
7476
diff
changeset
|
971 t)) |
1f09079e18c4
(outline-mode): Use outline-this-or-next-heading.
Richard M. Stallman <rms@gnu.org>
parents:
7476
diff
changeset
|
972 (if (string= mode "") |
1f09079e18c4
(outline-mode): Use outline-this-or-next-heading.
Richard M. Stallman <rms@gnu.org>
parents:
7476
diff
changeset
|
973 (setq mode 'report) |
1f09079e18c4
(outline-mode): Use outline-this-or-next-heading.
Richard M. Stallman <rms@gnu.org>
parents:
7476
diff
changeset
|
974 (setq mode (intern-soft mode))))) |
1f09079e18c4
(outline-mode): Use outline-this-or-next-heading.
Richard M. Stallman <rms@gnu.org>
parents:
7476
diff
changeset
|
975 (let |
1f09079e18c4
(outline-mode): Use outline-this-or-next-heading.
Richard M. Stallman <rms@gnu.org>
parents:
7476
diff
changeset
|
976 ;; convenience aliases, for consistent ref to respective vars: |
1f09079e18c4
(outline-mode): Use outline-this-or-next-heading.
Richard M. Stallman <rms@gnu.org>
parents:
7476
diff
changeset
|
977 ((hook 'outline-find-file-hook) |
1f09079e18c4
(outline-mode): Use outline-this-or-next-heading.
Richard M. Stallman <rms@gnu.org>
parents:
7476
diff
changeset
|
978 (curr-mode 'outline-auto-activation)) |
15664
a50ebf4ac764
(outline-auto-activation, outline-layout)
Karl Heuer <kwzh@gnu.org>
parents:
15663
diff
changeset
|
979 |
7527
1f09079e18c4
(outline-mode): Use outline-this-or-next-heading.
Richard M. Stallman <rms@gnu.org>
parents:
7476
diff
changeset
|
980 (cond ((not mode) |
1f09079e18c4
(outline-mode): Use outline-this-or-next-heading.
Richard M. Stallman <rms@gnu.org>
parents:
7476
diff
changeset
|
981 (setq find-file-hooks (delq hook find-file-hooks)) |
1f09079e18c4
(outline-mode): Use outline-this-or-next-heading.
Richard M. Stallman <rms@gnu.org>
parents:
7476
diff
changeset
|
982 (if (interactive-p) |
1f09079e18c4
(outline-mode): Use outline-this-or-next-heading.
Richard M. Stallman <rms@gnu.org>
parents:
7476
diff
changeset
|
983 (message "Allout outline mode auto-activation inhibited."))) |
1f09079e18c4
(outline-mode): Use outline-this-or-next-heading.
Richard M. Stallman <rms@gnu.org>
parents:
7476
diff
changeset
|
984 ((eq mode 'report) |
1f09079e18c4
(outline-mode): Use outline-this-or-next-heading.
Richard M. Stallman <rms@gnu.org>
parents:
7476
diff
changeset
|
985 (if (not (memq hook find-file-hooks)) |
1f09079e18c4
(outline-mode): Use outline-this-or-next-heading.
Richard M. Stallman <rms@gnu.org>
parents:
7476
diff
changeset
|
986 (outline-init nil) |
1f09079e18c4
(outline-mode): Use outline-this-or-next-heading.
Richard M. Stallman <rms@gnu.org>
parents:
7476
diff
changeset
|
987 ;; Just punt and use the reports from each of the modes: |
1f09079e18c4
(outline-mode): Use outline-this-or-next-heading.
Richard M. Stallman <rms@gnu.org>
parents:
7476
diff
changeset
|
988 (outline-init (symbol-value curr-mode)))) |
1f09079e18c4
(outline-mode): Use outline-this-or-next-heading.
Richard M. Stallman <rms@gnu.org>
parents:
7476
diff
changeset
|
989 (t (add-hook 'find-file-hooks hook) |
15664
a50ebf4ac764
(outline-auto-activation, outline-layout)
Karl Heuer <kwzh@gnu.org>
parents:
15663
diff
changeset
|
990 (set curr-mode ; `set', not `setq'! |
7527
1f09079e18c4
(outline-mode): Use outline-this-or-next-heading.
Richard M. Stallman <rms@gnu.org>
parents:
7476
diff
changeset
|
991 (cond ((eq mode 'activate) |
1f09079e18c4
(outline-mode): Use outline-this-or-next-heading.
Richard M. Stallman <rms@gnu.org>
parents:
7476
diff
changeset
|
992 (message |
1f09079e18c4
(outline-mode): Use outline-this-or-next-heading.
Richard M. Stallman <rms@gnu.org>
parents:
7476
diff
changeset
|
993 "Outline mode auto-activation enabled.") |
1f09079e18c4
(outline-mode): Use outline-this-or-next-heading.
Richard M. Stallman <rms@gnu.org>
parents:
7476
diff
changeset
|
994 'activate) |
1f09079e18c4
(outline-mode): Use outline-this-or-next-heading.
Richard M. Stallman <rms@gnu.org>
parents:
7476
diff
changeset
|
995 ((eq mode 'report) |
1f09079e18c4
(outline-mode): Use outline-this-or-next-heading.
Richard M. Stallman <rms@gnu.org>
parents:
7476
diff
changeset
|
996 ;; Return the current mode setting: |
1f09079e18c4
(outline-mode): Use outline-this-or-next-heading.
Richard M. Stallman <rms@gnu.org>
parents:
7476
diff
changeset
|
997 (outline-init mode)) |
1f09079e18c4
(outline-mode): Use outline-this-or-next-heading.
Richard M. Stallman <rms@gnu.org>
parents:
7476
diff
changeset
|
998 ((eq mode 'ask) |
1f09079e18c4
(outline-mode): Use outline-this-or-next-heading.
Richard M. Stallman <rms@gnu.org>
parents:
7476
diff
changeset
|
999 (message |
1f09079e18c4
(outline-mode): Use outline-this-or-next-heading.
Richard M. Stallman <rms@gnu.org>
parents:
7476
diff
changeset
|
1000 (concat "Outline mode auto-activation and " |
1f09079e18c4
(outline-mode): Use outline-this-or-next-heading.
Richard M. Stallman <rms@gnu.org>
parents:
7476
diff
changeset
|
1001 "-layout \(upon confirmation) enabled.")) |
1f09079e18c4
(outline-mode): Use outline-this-or-next-heading.
Richard M. Stallman <rms@gnu.org>
parents:
7476
diff
changeset
|
1002 'ask) |
1f09079e18c4
(outline-mode): Use outline-this-or-next-heading.
Richard M. Stallman <rms@gnu.org>
parents:
7476
diff
changeset
|
1003 ((message |
1f09079e18c4
(outline-mode): Use outline-this-or-next-heading.
Richard M. Stallman <rms@gnu.org>
parents:
7476
diff
changeset
|
1004 "Outline mode auto-activation and -layout enabled.") |
1f09079e18c4
(outline-mode): Use outline-this-or-next-heading.
Richard M. Stallman <rms@gnu.org>
parents:
7476
diff
changeset
|
1005 'full))))))) |
29490 | 1006 |
1007 ;;;_ > outline-setup-menubar () | |
1008 (defun outline-setup-menubar () | |
1009 "Populate the current buffer's menubar with allout outline-mode stuff." | |
1010 (let ((menus (list outline-mode-exposure-menu | |
1011 outline-mode-editing-menu | |
1012 outline-mode-navigation-menu | |
1013 outline-mode-misc-menu)) | |
1014 cur) | |
1015 (while menus | |
1016 (setq cur (car menus) | |
1017 menus (cdr menus)) | |
1018 (easy-menu-add cur)))) | |
7416
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1019 ;;;_ > outline-mode (&optional toggle) |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1020 ;;;_ : Defun: |
3430 | 1021 (defun outline-mode (&optional toggle) |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1022 ;;;_ . Doc string: |
7416
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1023 "Toggle minor mode for controlling exposure and editing of text outlines. |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1024 |
29490 | 1025 Optional arg forces mode to re-initialize iff arg is positive num or |
1026 symbol. Allout outline mode always runs as a minor mode. | |
1027 | |
1028 Allout outline mode provides extensive outline-oriented formatting and | |
1029 manipulation. It enables structural editing of outlines, as well as | |
1030 navigation and exposure. It also is specifically aimed at | |
1031 accommodating syntax-sensitive text like programming languages. \(For | |
1032 an example, see the allout code itself, which is organized as an allout | |
1033 outline.) | |
1034 | |
1035 In addition to outline navigation and exposure, allout includes: | |
1036 | |
1037 - topic-oriented repositioning, cut, and paste | |
1038 - integral outline exposure-layout | |
1039 - incremental search with dynamic exposure and reconcealment of hidden text | |
1040 - automatic topic-number maintenance | |
1041 - \"Hot-spot\" operation, for single-keystroke maneuvering and | |
1042 exposure control. \(See the outline-mode docstring.) | |
1043 | |
1044 and many other features. | |
7416
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1045 |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1046 Below is a description of the bindings, and then explanation of |
29490 | 1047 special outline-mode features and terminology. See also the outline |
1048 menubar additions for quick reference to many of the features, and see | |
1049 the docstring of the variable `outline-init' for instructions on | |
1050 priming your emacs session for automatic activation of outline-mode. | |
1051 | |
1052 | |
1053 The bindings are dictated by the `outline-keybindings-list' and | |
1054 `outline-command-prefix' variables. | |
7416
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1055 |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1056 Navigation: Exposure Control: |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1057 ---------- ---------------- |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1058 C-c C-n outline-next-visible-heading | C-c C-h outline-hide-current-subtree |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1059 C-c C-p outline-previous-visible-heading | C-c C-i outline-show-children |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1060 C-c C-u outline-up-current-level | C-c C-s outline-show-current-subtree |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1061 C-c C-f outline-forward-current-level | C-c C-o outline-show-current-entry |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1062 C-c C-b outline-backward-current-level | ^U C-c C-s outline-show-all |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1063 C-c C-e outline-end-of-current-entry | outline-hide-current-leaves |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1064 C-c C-a outline-beginning-of-current-entry, alternately, goes to hot-spot |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1065 |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1066 Topic Header Production: |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1067 ----------------------- |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1068 C-c<SP> outline-open-sibtopic Create a new sibling after current topic. |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1069 C-c . outline-open-subtopic ... an offspring of current topic. |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1070 C-c , outline-open-supertopic ... a sibling of the current topic's parent. |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1071 |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1072 Topic Level and Prefix Adjustment: |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1073 --------------------------------- |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1074 C-c > outline-shift-in Shift current topic and all offspring deeper. |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1075 C-c < outline-shift-out ... less deep. |
15664
a50ebf4ac764
(outline-auto-activation, outline-layout)
Karl Heuer <kwzh@gnu.org>
parents:
15663
diff
changeset
|
1076 C-c<CR> outline-rebullet-topic Reconcile bullets of topic and its offspring |
7416
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1077 - distinctive bullets are not changed, others |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1078 alternated according to nesting depth. |
29490 | 1079 C-c b outline-rebullet-current-heading Prompt for alternate bullet for |
7416
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1080 current topic. |
3430 | 1081 C-c # outline-number-siblings Number bullets of topic and siblings - the |
1082 offspring are not affected. With repeat | |
1083 count, revoke numbering. | |
1084 | |
7416
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1085 Topic-oriented Killing and Yanking: |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1086 ---------------------------------- |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1087 C-c C-k outline-kill-topic Kill current topic, including offspring. |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1088 C-k outline-kill-line Like kill-line, but reconciles numbering, etc. |
3430 | 1089 C-y outline-yank Yank, adjusting depth of yanked topic to |
1090 depth of heading if yanking into bare topic | |
7416
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1091 heading (ie, prefix sans text). |
3430 | 1092 M-y outline-yank-pop Is to outline-yank as yank-pop is to yank |
1093 | |
7416
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1094 Misc commands: |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1095 ------------- |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1096 M-x outlineify-sticky Activate outline mode for current buffer, |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1097 and establish a default file-var setting |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1098 for `outline-layout'. |
29490 | 1099 C-c C-SPC outline-mark-topic |
1100 C-c = c outline-copy-exposed-to-buffer | |
1101 Duplicate outline, sans concealed text, to | |
1102 buffer with name derived from derived from | |
1103 that of current buffer - \"*XXX exposed*\". | |
1104 C-c = p outline-flatten-exposed-to-buffer | |
1105 Like above 'copy-exposed', but convert topic | |
1106 prefixes to section.subsection... numeric | |
1107 format. | |
7416
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1108 ESC ESC (outline-init t) Setup emacs session for outline mode |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1109 auto-activation. |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1110 |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1111 HOT-SPOT Operation |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1112 |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1113 Hot-spot operation provides a means for easy, single-keystroke outline |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1114 navigation and exposure control. |
3430 | 1115 |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1116 \\<outline-mode-map> |
7416
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1117 When the text cursor is positioned directly on the bullet character of |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1118 a topic, regular characters (a to z) invoke the commands of the |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1119 corresponding outline-mode keymap control chars. For example, \"f\" |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1120 would invoke the command typically bound to \"C-c C-f\" |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1121 \(\\[outline-forward-current-level] `outline-forward-current-level'). |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1122 |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1123 Thus, by positioning the cursor on a topic bullet, you can execute |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1124 the outline navigation and manipulation commands with a single |
7416
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1125 keystroke. Non-literal chars never get this special translation, so |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1126 you can use them to get away from the hot-spot, and back to normal |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1127 operation. |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1128 |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1129 Note that the command `outline-beginning-of-current-entry' \(\\[outline-beginning-of-current-entry]\) |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1130 will move to the hot-spot when the cursor is already located at the |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1131 beginning of the current entry, so you can simply hit \\[outline-beginning-of-current-entry] |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1132 twice in a row to get to the hot-spot. |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1133 |
7416
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1134 Terminology |
3430 | 1135 |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1136 Topic hierarchy constituents - TOPICS and SUBTOPICS: |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1137 |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1138 TOPIC: A basic, coherent component of an emacs outline. It can |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1139 contain other topics, and it can be subsumed by other topics, |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1140 CURRENT topic: |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1141 The visible topic most immediately containing the cursor. |
7416
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1142 DEPTH: The degree of nesting of a topic; it increases with |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1143 containment. Also called the: |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1144 LEVEL: The same as DEPTH. |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1145 |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1146 ANCESTORS: |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1147 The topics that contain a topic. |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1148 PARENT: A topic's immediate ancestor. It has a depth one less than |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1149 the topic. |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1150 OFFSPRING: |
7416
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1151 The topics contained by a topic; |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1152 SUBTOPIC: |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1153 An immediate offspring of a topic; |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1154 CHILDREN: |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1155 The immediate offspring of a topic. |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1156 SIBLINGS: |
7416
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1157 Topics having the same parent and depth. |
15664
a50ebf4ac764
(outline-auto-activation, outline-layout)
Karl Heuer <kwzh@gnu.org>
parents:
15663
diff
changeset
|
1158 |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1159 Topic text constituents: |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1160 |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1161 HEADER: The first line of a topic, include the topic PREFIX and header |
15664
a50ebf4ac764
(outline-auto-activation, outline-layout)
Karl Heuer <kwzh@gnu.org>
parents:
15663
diff
changeset
|
1162 text. |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1163 PREFIX: The leading text of a topic which which distinguishes it from |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1164 normal text. It has a strict form, which consists of a |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1165 prefix-lead string, padding, and a bullet. The bullet may be |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1166 followed by a number, indicating the ordinal number of the |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1167 topic among its siblings, a space, and then the header text. |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1168 |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1169 The relative length of the PREFIX determines the nesting depth |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1170 of the topic. |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1171 PREFIX-LEAD: |
15664
a50ebf4ac764
(outline-auto-activation, outline-layout)
Karl Heuer <kwzh@gnu.org>
parents:
15663
diff
changeset
|
1172 The string at the beginning of a topic prefix, normally a `.'. |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1173 It can be customized by changing the setting of |
7416
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1174 `outline-header-prefix' and then reinitializing outline-mode. |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1175 |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1176 By setting the prefix-lead to the comment-string of a |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1177 programming language, you can embed outline-structuring in |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1178 program code without interfering with the language processing |
7416
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1179 of that code. See `outline-use-mode-specific-leader' |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1180 docstring for more detail. |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1181 PREFIX-PADDING: |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1182 Spaces or asterisks which separate the prefix-lead and the |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1183 bullet, according to the depth of the topic. |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1184 BULLET: A character at the end of the topic prefix, it must be one of |
15664
a50ebf4ac764
(outline-auto-activation, outline-layout)
Karl Heuer <kwzh@gnu.org>
parents:
15663
diff
changeset
|
1185 the characters listed on `outline-plain-bullets-string' or |
a50ebf4ac764
(outline-auto-activation, outline-layout)
Karl Heuer <kwzh@gnu.org>
parents:
15663
diff
changeset
|
1186 `outline-distinctive-bullets-string'. (See the documentation |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1187 for these variables for more details.) The default choice of |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1188 bullet when generating varies in a cycle with the depth of the |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1189 topic. |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1190 ENTRY: The text contained in a topic before any offspring. |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1191 BODY: Same as ENTRY. |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1192 |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1193 |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1194 EXPOSURE: |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1195 The state of a topic which determines the on-screen visibility |
15664
a50ebf4ac764
(outline-auto-activation, outline-layout)
Karl Heuer <kwzh@gnu.org>
parents:
15663
diff
changeset
|
1196 of its offspring and contained text. |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1197 CONCEALED: |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1198 Topics and entry text whose display is inhibited. Contiguous |
15664
a50ebf4ac764
(outline-auto-activation, outline-layout)
Karl Heuer <kwzh@gnu.org>
parents:
15663
diff
changeset
|
1199 units of concealed text is represented by `...' ellipses. |
a50ebf4ac764
(outline-auto-activation, outline-layout)
Karl Heuer <kwzh@gnu.org>
parents:
15663
diff
changeset
|
1200 (Ref the `selective-display' var.) |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1201 |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1202 Concealed topics are effectively collapsed within an ancestor. |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1203 CLOSED: A topic whose immediate offspring and body-text is concealed. |
15664
a50ebf4ac764
(outline-auto-activation, outline-layout)
Karl Heuer <kwzh@gnu.org>
parents:
15663
diff
changeset
|
1204 OPEN: A topic that is not closed, though its offspring or body may be." |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1205 ;;;_ . Code |
3430 | 1206 (interactive "P") |
1207 | |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1208 (let* ((active (and (not (equal major-mode 'outline)) |
7416
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1209 (outline-mode-p))) |
15664
a50ebf4ac764
(outline-auto-activation, outline-layout)
Karl Heuer <kwzh@gnu.org>
parents:
15663
diff
changeset
|
1210 ; Massage universal-arg `toggle' val: |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1211 (toggle (and toggle |
7416
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1212 (or (and (listp toggle)(car toggle)) |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1213 toggle))) |
13964
4de229297f1f
(outline-primary-bullet, outline-numbered-bullet,
Karl Heuer <kwzh@gnu.org>
parents:
13337
diff
changeset
|
1214 ; Activation specifically demanded? |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1215 (explicit-activation (or |
7416
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1216 ;; |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1217 (and toggle |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1218 (or (symbolp toggle) |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1219 (and (natnump toggle) |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1220 (not (zerop toggle))))))) |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1221 ;; outline-mode already called once during this complex command? |
29490 | 1222 (same-complex-command (eq outline-v18/19-file-var-hack |
7416
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1223 (car command-history))) |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1224 do-layout |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1225 ) |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1226 |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1227 ; See comments below re v19.18,.19 bug. |
29490 | 1228 (setq outline-v18/19-file-var-hack (car command-history)) |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1229 |
3430 | 1230 (cond |
1231 | |
7416
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1232 ;; Provision for v19.18, 19.19 bug - |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1233 ;; Emacs v 19.18, 19.19 file-var code invokes prop-line-designated |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1234 ;; modes twice when file is visited. We have to avoid toggling mode |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1235 ;; off on second invocation, so we detect it as best we can, and |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1236 ;; skip everything. |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1237 ((and same-complex-command ; Still in same complex command |
7416
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1238 ; as last time outline-mode invoked. |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1239 active ; Already activated. |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1240 (not explicit-activation) ; Prop-line file-vars don't have args. |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1241 (string-match "^19.1[89]" ; Bug only known to be in v19.18 and |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1242 emacs-version)); 19.19. |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1243 t) |
15664
a50ebf4ac764
(outline-auto-activation, outline-layout)
Karl Heuer <kwzh@gnu.org>
parents:
15663
diff
changeset
|
1244 |
7416
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1245 ;; Deactivation: |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1246 ((and (not explicit-activation) |
7416
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1247 (or active toggle)) |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1248 ; Activation not explicitly |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1249 ; requested, and either in |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1250 ; active state or *de*activation |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1251 ; specifically requested: |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1252 (setq outline-explicitly-deactivated t) |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1253 (if (string-match "^18\." emacs-version) |
7416
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1254 ; Revoke those keys that remain |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1255 ; as we set them: |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1256 (let ((curr-loc (current-local-map))) |
29490 | 1257 (mapcar (function |
1258 (lambda (cell) | |
7416
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1259 (if (eq (lookup-key curr-loc (car cell)) |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1260 (car (cdr cell))) |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1261 (define-key curr-loc (car cell) |
29490 | 1262 (assq (car cell) outline-prior-bindings))))) |
7416
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1263 outline-added-bindings) |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1264 (outline-resumptions 'outline-added-bindings) |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1265 (outline-resumptions 'outline-prior-bindings))) |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1266 |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1267 (if outline-old-style-prefixes |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1268 (progn |
7416
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1269 (outline-resumptions 'outline-primary-bullet) |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1270 (outline-resumptions 'outline-old-style-prefixes))) |
3430 | 1271 (outline-resumptions 'selective-display) |
29490 | 1272 (if (and (boundp 'before-change-functions) before-change-functions) |
1273 (outline-resumptions 'before-change-functions)) | |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1274 (setq local-write-file-hooks |
7416
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1275 (delq 'outline-write-file-hook |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1276 local-write-file-hooks)) |
3430 | 1277 (outline-resumptions 'paragraph-start) |
1278 (outline-resumptions 'paragraph-separate) | |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1279 (outline-resumptions (if (string-match "^18" emacs-version) |
7416
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1280 'auto-fill-hook |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1281 'auto-fill-function)) |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1282 (outline-resumptions 'outline-former-auto-filler) |
3430 | 1283 (setq outline-mode nil)) |
1284 | |
7416
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1285 ;; Activation: |
3430 | 1286 ((not active) |
7416
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1287 (setq outline-explicitly-deactivated nil) |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1288 (if outline-old-style-prefixes |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1289 (progn ; Inhibit all the fancy formatting: |
7416
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1290 (outline-resumptions 'outline-primary-bullet '("*")) |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1291 (outline-resumptions 'outline-old-style-prefixes '(())))) |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1292 |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1293 (outline-infer-header-lead) |
7527
1f09079e18c4
(outline-mode): Use outline-this-or-next-heading.
Richard M. Stallman <rms@gnu.org>
parents:
7476
diff
changeset
|
1294 (outline-infer-body-reindent) |
7416
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1295 |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1296 (set-outline-regexp) |
7416
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1297 |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1298 ; Produce map from current version |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1299 ; of outline-keybindings-list: |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1300 (if (boundp 'minor-mode-map-alist) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1301 |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1302 (progn ; V19, and maybe lucid and |
7416
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1303 ; epoch, minor-mode key bindings: |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1304 (setq outline-mode-map |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1305 (produce-outline-mode-map outline-keybindings-list)) |
29490 | 1306 (produce-outline-mode-menubar-entries) |
7416
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1307 (fset 'outline-mode-map outline-mode-map) |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1308 ; Include on minor-mode-map-alist, |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1309 ; if not already there: |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1310 (if (not (member '(outline-mode . outline-mode-map) |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1311 minor-mode-map-alist)) |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1312 (setq minor-mode-map-alist |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1313 (cons '(outline-mode . outline-mode-map) |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1314 minor-mode-map-alist)))) |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1315 |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1316 ; V18 minor-mode key bindings: |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1317 ; Stash record of added bindings |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1318 ; for later revocation: |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1319 (outline-resumptions 'outline-added-bindings |
7416
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1320 (list outline-keybindings-list)) |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1321 (outline-resumptions 'outline-prior-bindings |
7416
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1322 (list (current-local-map))) |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1323 ; and add them: |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1324 (use-local-map (produce-outline-mode-map outline-keybindings-list |
7416
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1325 (current-local-map))) |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1326 ) |
15664
a50ebf4ac764
(outline-auto-activation, outline-layout)
Karl Heuer <kwzh@gnu.org>
parents:
15663
diff
changeset
|
1327 |
7416
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1328 ; selective-display is the |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1329 ; emacs conditional exposure |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1330 ; mechanism: |
3430 | 1331 (outline-resumptions 'selective-display '(t)) |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1332 (if outline-inhibit-protection |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1333 t |
29490 | 1334 (outline-resumptions 'before-change-functions |
7416
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1335 '(outline-before-change-protect))) |
29490 | 1336 (add-hook 'pre-command-hook 'outline-pre-command-business) |
1337 (add-hook 'post-command-hook 'outline-post-command-business) | |
7416
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1338 ; Temporarily set by any outline |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1339 ; functions that can be trusted to |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1340 ; deal properly with concealed text. |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1341 (add-hook 'local-write-file-hooks 'outline-write-file-hook) |
7416
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1342 ; Custom auto-fill func, to support |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1343 ; respect for topic headline, |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1344 ; hanging-indents, etc: |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1345 (let* ((fill-func-var (if (string-match "^18" emacs-version) |
7416
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1346 'auto-fill-hook |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1347 'auto-fill-function)) |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1348 (fill-func (symbol-value fill-func-var))) |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1349 ;; Register prevailing fill func for use by outline-auto-fill: |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1350 (outline-resumptions 'outline-former-auto-filler (list fill-func)) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1351 ;; Register outline-auto-fill to be used if filling is active: |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1352 (outline-resumptions fill-func-var '(outline-auto-fill))) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1353 ;; Paragraphs are broken by topic headlines. |
3430 | 1354 (make-local-variable 'paragraph-start) |
1355 (outline-resumptions 'paragraph-start | |
29490 | 1356 (list (concat paragraph-start "\\|^\\(" |
7416
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1357 outline-regexp "\\)"))) |
3430 | 1358 (make-local-variable 'paragraph-separate) |
1359 (outline-resumptions 'paragraph-separate | |
29490 | 1360 (list (concat paragraph-separate "\\|^\\(" |
7416
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1361 outline-regexp "\\)"))) |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1362 |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1363 (or (assq 'outline-mode minor-mode-alist) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1364 (setq minor-mode-alist |
7416
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1365 (cons '(outline-mode " Outl") minor-mode-alist))) |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1366 |
29490 | 1367 (outline-setup-menubar) |
1368 | |
7416
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1369 (if outline-layout |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1370 (setq do-layout t)) |
3430 | 1371 |
29490 | 1372 (if (and outline-isearch-dynamic-expose |
1373 (not (fboundp 'outline-real-isearch-abort))) | |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1374 (outline-enwrap-isearch)) |
7416
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1375 |
3430 | 1376 (run-hooks 'outline-mode-hook) |
1377 (setq outline-mode t)) | |
7416
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1378 |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1379 ;; Reactivation: |
7527
1f09079e18c4
(outline-mode): Use outline-this-or-next-heading.
Richard M. Stallman <rms@gnu.org>
parents:
7476
diff
changeset
|
1380 ((setq do-layout t) |
1f09079e18c4
(outline-mode): Use outline-this-or-next-heading.
Richard M. Stallman <rms@gnu.org>
parents:
7476
diff
changeset
|
1381 (outline-infer-body-reindent)) |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1382 ) ; cond |
7416
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1383 |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1384 (if (and do-layout |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1385 outline-auto-activation |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1386 (listp outline-layout) |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1387 (and (not (eq outline-auto-activation 'activate)) |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1388 (if (eq outline-auto-activation 'ask) |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1389 (if (y-or-n-p (format "Expose %s with layout '%s'? " |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1390 (buffer-name) |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1391 outline-layout)) |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1392 t |
7527
1f09079e18c4
(outline-mode): Use outline-this-or-next-heading.
Richard M. Stallman <rms@gnu.org>
parents:
7476
diff
changeset
|
1393 (message "Skipped %s layout." (buffer-name)) |
7416
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1394 nil) |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1395 t))) |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1396 (save-excursion |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1397 (message "Adjusting '%s' exposure..." (buffer-name)) |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1398 (goto-char 0) |
7527
1f09079e18c4
(outline-mode): Use outline-this-or-next-heading.
Richard M. Stallman <rms@gnu.org>
parents:
7476
diff
changeset
|
1399 (outline-this-or-next-heading) |
1f09079e18c4
(outline-mode): Use outline-this-or-next-heading.
Richard M. Stallman <rms@gnu.org>
parents:
7476
diff
changeset
|
1400 (condition-case err |
15664
a50ebf4ac764
(outline-auto-activation, outline-layout)
Karl Heuer <kwzh@gnu.org>
parents:
15663
diff
changeset
|
1401 (progn |
7527
1f09079e18c4
(outline-mode): Use outline-this-or-next-heading.
Richard M. Stallman <rms@gnu.org>
parents:
7476
diff
changeset
|
1402 (apply 'outline-expose-topic (list outline-layout)) |
1f09079e18c4
(outline-mode): Use outline-this-or-next-heading.
Richard M. Stallman <rms@gnu.org>
parents:
7476
diff
changeset
|
1403 (message "Adjusting '%s' exposure... done." (buffer-name))) |
1f09079e18c4
(outline-mode): Use outline-this-or-next-heading.
Richard M. Stallman <rms@gnu.org>
parents:
7476
diff
changeset
|
1404 ;; Problem applying exposure - notify user, but don't |
1f09079e18c4
(outline-mode): Use outline-this-or-next-heading.
Richard M. Stallman <rms@gnu.org>
parents:
7476
diff
changeset
|
1405 ;; interrupt, eg, file visit: |
1f09079e18c4
(outline-mode): Use outline-this-or-next-heading.
Richard M. Stallman <rms@gnu.org>
parents:
7476
diff
changeset
|
1406 (error (message "%s" (car (cdr err))) |
1f09079e18c4
(outline-mode): Use outline-this-or-next-heading.
Richard M. Stallman <rms@gnu.org>
parents:
7476
diff
changeset
|
1407 (sit-for 1))))) |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1408 outline-mode |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1409 ) ; let* |
7416
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1410 ) ; defun |
29490 | 1411 ;;;_ > outline-minor-mode |
1412 ;;; XXX released verion doesn't do this? | |
1413 (defalias 'outline-minor-mode 'outline-mode) | |
7416
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1414 |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1415 ;;;_ #3 Internal Position State-Tracking - "outline-recent-*" funcs |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1416 ;;; All the basic outline functions that directly do string matches to |
3430 | 1417 ;;; evaluate heading prefix location set the variables |
7416
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1418 ;;; `outline-recent-prefix-beginning' and `outline-recent-prefix-end' |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1419 ;;; when successful. Functions starting with `outline-recent-' all |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1420 ;;; use this state, providing the means to avoid redundant searches |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1421 ;;; for just-established data. This optimization can provide |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1422 ;;; significant speed improvement, but it must be employed carefully. |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1423 ;;;_ = outline-recent-prefix-beginning |
3430 | 1424 (defvar outline-recent-prefix-beginning 0 |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1425 "Buffer point of the start of the last topic prefix encountered.") |
3430 | 1426 (make-variable-buffer-local 'outline-recent-prefix-beginning) |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1427 ;;;_ = outline-recent-prefix-end |
3430 | 1428 (defvar outline-recent-prefix-end 0 |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1429 "Buffer point of the end of the last topic prefix encountered.") |
3430 | 1430 (make-variable-buffer-local 'outline-recent-prefix-end) |
7416
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1431 ;;;_ = outline-recent-end-of-subtree |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1432 (defvar outline-recent-end-of-subtree 0 |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1433 "Buffer point last returned by outline-end-of-current-subtree.") |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1434 (make-variable-buffer-local 'outline-recent-end-of-subtree) |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1435 ;;;_ > outline-prefix-data (beg end) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1436 (defmacro outline-prefix-data (beg end) |
7416
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1437 "Register outline-prefix state data - BEGINNING and END of prefix. |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1438 |
15664
a50ebf4ac764
(outline-auto-activation, outline-layout)
Karl Heuer <kwzh@gnu.org>
parents:
15663
diff
changeset
|
1439 For reference by `outline-recent' funcs. Returns BEGINNING." |
29490 | 1440 `(setq outline-recent-prefix-end ,end |
1441 outline-recent-prefix-beginning ,beg)) | |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1442 ;;;_ > outline-recent-depth () |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1443 (defmacro outline-recent-depth () |
7416
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1444 "Return depth of last heading encountered by an outline maneuvering function. |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1445 |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1446 All outline functions which directly do string matches to assess |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1447 headings set the variables outline-recent-prefix-beginning and |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1448 outline-recent-prefix-end if successful. This function uses those settings |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1449 to return the current depth." |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1450 |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1451 '(max 1 (- outline-recent-prefix-end |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1452 outline-recent-prefix-beginning |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1453 outline-header-subtraction))) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1454 ;;;_ > outline-recent-prefix () |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1455 (defmacro outline-recent-prefix () |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1456 "Like outline-recent-depth, but returns text of last encountered prefix. |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1457 |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1458 All outline functions which directly do string matches to assess |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1459 headings set the variables outline-recent-prefix-beginning and |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1460 outline-recent-prefix-end if successful. This function uses those settings |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1461 to return the current depth." |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1462 '(buffer-substring outline-recent-prefix-beginning |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1463 outline-recent-prefix-end)) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1464 ;;;_ > outline-recent-bullet () |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1465 (defmacro outline-recent-bullet () |
7416
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1466 "Like outline-recent-prefix, but returns bullet of last encountered prefix. |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1467 |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1468 All outline functions which directly do string matches to assess |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1469 headings set the variables outline-recent-prefix-beginning and |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1470 outline-recent-prefix-end if successful. This function uses those settings |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1471 to return the current depth of the most recently matched topic." |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1472 '(buffer-substring (1- outline-recent-prefix-end) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1473 outline-recent-prefix-end)) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1474 |
7416
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1475 ;;;_ #4 Navigation |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1476 |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1477 ;;;_ - Position Assessment |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1478 ;;;_ : Location Predicates |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1479 ;;;_ > outline-on-current-heading-p () |
3430 | 1480 (defun outline-on-current-heading-p () |
7416
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1481 "Return non-nil if point is on current visible topics' header line. |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1482 |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1483 Actually, returns prefix beginning point." |
3430 | 1484 (save-excursion |
1485 (beginning-of-line) | |
1486 (and (looking-at outline-regexp) | |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1487 (outline-prefix-data (match-beginning 0) (match-end 0))))) |
29490 | 1488 ;;;_ > outline-on-heading-p () |
1489 (defalias 'outline-on-heading-p 'outline-on-current-heading-p) | |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1490 ;;;_ > outline-e-o-prefix-p () |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1491 (defun outline-e-o-prefix-p () |
7416
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1492 "True if point is located where current topic prefix ends, heading begins." |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1493 (and (save-excursion (beginning-of-line) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1494 (looking-at outline-regexp)) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1495 (= (point)(save-excursion (outline-end-of-prefix)(point))))) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1496 ;;;_ > outline-hidden-p () |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1497 (defmacro outline-hidden-p () |
3430 | 1498 "True if point is in hidden text." |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1499 '(save-excursion |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1500 (and (re-search-backward "[\n\r]" () t) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1501 (= ?\r (following-char))))) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1502 ;;;_ > outline-visible-p () |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1503 (defmacro outline-visible-p () |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1504 "True if point is not in hidden text." |
3430 | 1505 (interactive) |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1506 '(not (outline-hidden-p))) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1507 ;;;_ : Location attributes |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1508 ;;;_ > outline-depth () |
29490 | 1509 (defsubst outline-depth () |
7416
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1510 "Like outline-current-depth, but respects hidden as well as visible topics." |
29490 | 1511 (save-excursion |
1512 (if (outline-goto-prefix) | |
1513 (outline-recent-depth) | |
1514 (progn | |
1515 ;; Oops, no prefix, zero prefix data: | |
1516 (outline-prefix-data (point)(point)) | |
1517 ;; ... and return 0: | |
1518 0)))) | |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1519 ;;;_ > outline-current-depth () |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1520 (defmacro outline-current-depth () |
7416
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1521 "Return nesting depth of visible topic most immediately containing point." |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1522 '(save-excursion |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1523 (if (outline-back-to-current-heading) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1524 (max 1 |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1525 (- outline-recent-prefix-end |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1526 outline-recent-prefix-beginning |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1527 outline-header-subtraction)) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1528 0))) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1529 ;;;_ > outline-get-current-prefix () |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1530 (defun outline-get-current-prefix () |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1531 "Topic prefix of the current topic." |
3430 | 1532 (save-excursion |
1533 (if (outline-goto-prefix) | |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1534 (outline-recent-prefix)))) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1535 ;;;_ > outline-get-bullet () |
3430 | 1536 (defun outline-get-bullet () |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1537 "Return bullet of containing topic (visible or not)." |
3430 | 1538 (save-excursion |
1539 (and (outline-goto-prefix) | |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1540 (outline-recent-bullet)))) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1541 ;;;_ > outline-current-bullet () |
3430 | 1542 (defun outline-current-bullet () |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1543 "Return bullet of current (visible) topic heading, or none if none found." |
3430 | 1544 (condition-case err |
1545 (save-excursion | |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1546 (outline-back-to-current-heading) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1547 (buffer-substring (- outline-recent-prefix-end 1) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1548 outline-recent-prefix-end)) |
3430 | 1549 ;; Quick and dirty provision, ostensibly for missing bullet: |
29490 | 1550 ('args-out-of-range nil)) |
3430 | 1551 ) |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1552 ;;;_ > outline-get-prefix-bullet (prefix) |
3430 | 1553 (defun outline-get-prefix-bullet (prefix) |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1554 "Return the bullet of the header prefix string PREFIX." |
3430 | 1555 ;; Doesn't make sense if we're old-style prefixes, but this just |
1556 ;; oughtn't be called then, so forget about it... | |
1557 (if (string-match outline-regexp prefix) | |
1558 (substring prefix (1- (match-end 0)) (match-end 0)))) | |
29490 | 1559 ;;;_ > outline-sibling-index (&optional depth) |
1560 (defun outline-sibling-index (&optional depth) | |
1561 "Item number of this prospective topic among its siblings. | |
1562 | |
1563 If optional arg depth is greater than current depth, then we're | |
1564 opening a new level, and return 0. | |
1565 | |
1566 If less than this depth, ascend to that depth and count..." | |
1567 | |
1568 (save-excursion | |
1569 (cond ((and depth (<= depth 0) 0)) | |
1570 ((or (not depth) (= depth (outline-depth))) | |
1571 (let ((index 1)) | |
1572 (while (outline-previous-sibling (outline-recent-depth) nil) | |
1573 (setq index (1+ index))) | |
1574 index)) | |
1575 ((< depth (outline-recent-depth)) | |
1576 (outline-ascend-to-depth depth) | |
1577 (outline-sibling-index)) | |
1578 (0)))) | |
1579 ;;;_ > outline-topic-flat-index () | |
1580 (defun outline-topic-flat-index () | |
1581 "Return a list indicating point's numeric section.subsect.subsubsect... | |
1582 Outermost is first." | |
1583 (let* ((depth (outline-depth)) | |
1584 (next-index (outline-sibling-index depth)) | |
1585 (rev-sibls nil)) | |
1586 (while (> next-index 0) | |
1587 (setq rev-sibls (cons next-index rev-sibls)) | |
1588 (setq depth (1- depth)) | |
1589 (setq next-index (outline-sibling-index depth))) | |
1590 rev-sibls) | |
1591 ) | |
3430 | 1592 |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1593 ;;;_ - Navigation macros |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1594 ;;;_ > outline-next-heading () |
29490 | 1595 (defsubst outline-next-heading () |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1596 "Move to the heading for the topic \(possibly invisible) before this one. |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1597 |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1598 Returns the location of the heading, or nil if none found." |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1599 |
29490 | 1600 (if (and (bobp) (not (eobp))) |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1601 (forward-char 1)) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1602 |
29490 | 1603 (if (re-search-forward outline-line-boundary-regexp nil 0) |
1604 (outline-prefix-data ; Got valid location state - set vars: | |
1605 (goto-char (or (match-beginning 2) | |
1606 outline-recent-prefix-beginning)) | |
1607 (or (match-end 2) outline-recent-prefix-end)))) | |
7527
1f09079e18c4
(outline-mode): Use outline-this-or-next-heading.
Richard M. Stallman <rms@gnu.org>
parents:
7476
diff
changeset
|
1608 ;;;_ : outline-this-or-next-heading |
1f09079e18c4
(outline-mode): Use outline-this-or-next-heading.
Richard M. Stallman <rms@gnu.org>
parents:
7476
diff
changeset
|
1609 (defun outline-this-or-next-heading () |
1f09079e18c4
(outline-mode): Use outline-this-or-next-heading.
Richard M. Stallman <rms@gnu.org>
parents:
7476
diff
changeset
|
1610 "Position cursor on current or next heading." |
1f09079e18c4
(outline-mode): Use outline-this-or-next-heading.
Richard M. Stallman <rms@gnu.org>
parents:
7476
diff
changeset
|
1611 ;; A throwaway non-macro that is defined after outline-next-heading |
1f09079e18c4
(outline-mode): Use outline-this-or-next-heading.
Richard M. Stallman <rms@gnu.org>
parents:
7476
diff
changeset
|
1612 ;; and usable by outline-mode. |
1f09079e18c4
(outline-mode): Use outline-this-or-next-heading.
Richard M. Stallman <rms@gnu.org>
parents:
7476
diff
changeset
|
1613 (if (not (outline-goto-prefix)) (outline-next-heading))) |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1614 ;;;_ > outline-previous-heading () |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1615 (defmacro outline-previous-heading () |
7416
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1616 "Move to the prior \(possibly invisible) heading line. |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1617 |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1618 Return the location of the beginning of the heading, or nil if not found." |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1619 |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1620 '(if (bobp) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1621 nil |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1622 (outline-goto-prefix) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1623 (if |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1624 ;; searches are unbounded and return nil if failed: |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1625 (or (re-search-backward outline-line-boundary-regexp nil 0) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1626 (looking-at outline-bob-regexp)) |
7416
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1627 (progn ; Got valid location state - set vars: |
15664
a50ebf4ac764
(outline-auto-activation, outline-layout)
Karl Heuer <kwzh@gnu.org>
parents:
15663
diff
changeset
|
1628 (outline-prefix-data |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1629 (goto-char (or (match-beginning 2) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1630 outline-recent-prefix-beginning)) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1631 (or (match-end 2) outline-recent-prefix-end)))))) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1632 |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1633 ;;;_ - Subtree Charting |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1634 ;;;_ " These routines either produce or assess charts, which are |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1635 ;;; nested lists of the locations of topics within a subtree. |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1636 ;;; |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1637 ;;; Use of charts enables efficient navigation of subtrees, by |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1638 ;;; requiring only a single regexp-search based traversal, to scope |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1639 ;;; out the subtopic locations. The chart then serves as the basis |
29490 | 1640 ;;; for assessment or adjustment of the subtree, without redundant |
1641 ;;; traversal of the structure. | |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1642 |
7416
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1643 ;;;_ > outline-chart-subtree (&optional levels orig-depth prev-depth) |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1644 (defun outline-chart-subtree (&optional levels orig-depth prev-depth) |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1645 "Produce a location \"chart\" of subtopics of the containing topic. |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1646 |
13964
4de229297f1f
(outline-primary-bullet, outline-numbered-bullet,
Karl Heuer <kwzh@gnu.org>
parents:
13337
diff
changeset
|
1647 Optional argument LEVELS specifies the depth \(relative to start |
29490 | 1648 depth) for the chart. Subsequent optional args are not for public |
7416
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1649 use. |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1650 |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1651 Charts are used to capture outline structure, so that outline-altering |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1652 routines need assess the structure only once, and then use the chart |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1653 for their elaborate manipulations. |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1654 |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1655 Topics are entered in the chart so the last one is at the car. |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1656 The entry for each topic consists of an integer indicating the point |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1657 at the beginning of the topic. Charts for offspring consists of a |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1658 list containing, recursively, the charts for the respective subtopics. |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1659 The chart for a topics' offspring precedes the entry for the topic |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1660 itself. |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1661 |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1662 The other function parameters are for internal recursion, and should |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1663 not be specified by external callers. ORIG-DEPTH is depth of topic at |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1664 starting point, and PREV-DEPTH is depth of prior topic." |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1665 |
15664
a50ebf4ac764
(outline-auto-activation, outline-layout)
Karl Heuer <kwzh@gnu.org>
parents:
15663
diff
changeset
|
1666 (let ((original (not orig-depth)) ; `orig-depth' set only in recursion. |
7416
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1667 chart curr-depth) |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1668 |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1669 (if original ; Just starting? |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1670 ; Register initial settings and |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1671 ; position to first offspring: |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1672 (progn (setq orig-depth (outline-depth)) |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1673 (or prev-depth (setq prev-depth (1+ orig-depth))) |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1674 (outline-next-heading))) |
7416
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1675 |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1676 ;; Loop over the current levels' siblings. Besides being more |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1677 ;; efficient than tail-recursing over a level, it avoids exceeding |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1678 ;; the typically quite constrained emacs max-lisp-eval-depth. |
29490 | 1679 ;; |
7416
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1680 ;; Probably would speed things up to implement loop-based stack |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1681 ;; operation rather than recursing for lower levels. Bah. |
29490 | 1682 |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1683 (while (and (not (eobp)) |
7416
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1684 ; Still within original topic? |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1685 (< orig-depth (setq curr-depth (outline-recent-depth))) |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1686 (cond ((= prev-depth curr-depth) |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1687 ;; Register this one and move on: |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1688 (setq chart (cons (point) chart)) |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1689 (if (and levels (<= levels 1)) |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1690 ;; At depth limit - skip sublevels: |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1691 (or (outline-next-sibling curr-depth) |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1692 ;; or no more siblings - proceed to |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1693 ;; next heading at lesser depth: |
7676
5b8a573e9f69
(outline-chart-subtree): Include outline-next-heading in loop conditions
Richard M. Stallman <rms@gnu.org>
parents:
7639
diff
changeset
|
1694 (while (and (<= curr-depth |
5b8a573e9f69
(outline-chart-subtree): Include outline-next-heading in loop conditions
Richard M. Stallman <rms@gnu.org>
parents:
7639
diff
changeset
|
1695 (outline-recent-depth)) |
5b8a573e9f69
(outline-chart-subtree): Include outline-next-heading in loop conditions
Richard M. Stallman <rms@gnu.org>
parents:
7639
diff
changeset
|
1696 (outline-next-heading)))) |
7416
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1697 (outline-next-heading))) |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1698 |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1699 ((and (< prev-depth curr-depth) |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1700 (or (not levels) |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1701 (> levels 0))) |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1702 ;; Recurse on deeper level of curr topic: |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1703 (setq chart |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1704 (cons (outline-chart-subtree (and levels |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1705 (1- levels)) |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1706 orig-depth |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1707 curr-depth) |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1708 chart)) |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1709 ;; ... then continue with this one. |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1710 ) |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1711 |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1712 ;; ... else nil if we've ascended back to prev-depth. |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1713 |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1714 ))) |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1715 |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1716 (if original ; We're at the last sibling on |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1717 ; the original level. Position |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1718 ; to the end of it: |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1719 (progn (and (not (eobp)) (forward-char -1)) |
29490 | 1720 (and (memq (preceding-char) '(?\n ?\r)) |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1721 (memq (aref (buffer-substring (max 1 (- (point) 3)) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1722 (point)) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1723 1) |
29490 | 1724 '(?\n ?\r)) |
7416
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1725 (forward-char -1)) |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1726 (setq outline-recent-end-of-subtree (point)))) |
15664
a50ebf4ac764
(outline-auto-activation, outline-layout)
Karl Heuer <kwzh@gnu.org>
parents:
15663
diff
changeset
|
1727 |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1728 chart ; (nreverse chart) not necessary, |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1729 ; and maybe not preferable. |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1730 )) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1731 ;;;_ > outline-chart-siblings (&optional start end) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1732 (defun outline-chart-siblings (&optional start end) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1733 "Produce a list of locations of this and succeeding sibling topics. |
15664
a50ebf4ac764
(outline-auto-activation, outline-layout)
Karl Heuer <kwzh@gnu.org>
parents:
15663
diff
changeset
|
1734 Effectively a top-level chart of siblings. See `outline-chart-subtree' |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1735 for an explanation of charts." |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1736 (save-excursion |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1737 (if (outline-goto-prefix) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1738 (let ((chart (list (point)))) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1739 (while (outline-next-sibling) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1740 (setq chart (cons (point) chart))) |
7416
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1741 (if chart (setq chart (nreverse chart))))))) |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1742 ;;;_ > outline-chart-to-reveal (chart depth) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1743 (defun outline-chart-to-reveal (chart depth) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1744 |
7416
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1745 "Return a flat list of hidden points in subtree CHART, up to DEPTH. |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1746 |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1747 Note that point can be left at any of the points on chart, or at the |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1748 start point." |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1749 |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1750 (let (result here) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1751 (while (and (or (eq depth t) (> depth 0)) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1752 chart) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1753 (setq here (car chart)) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1754 (if (listp here) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1755 (let ((further (outline-chart-to-reveal here (or (eq depth t) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1756 (1- depth))))) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1757 ;; We're on the start of a subtree - recurse with it, if there's |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1758 ;; more depth to go: |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1759 (if further (setq result (append further result))) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1760 (setq chart (cdr chart))) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1761 (goto-char here) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1762 (if (= (preceding-char) ?\r) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1763 (setq result (cons here result))) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1764 (setq chart (cdr chart)))) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1765 result)) |
7416
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1766 ;;;_ X outline-chart-spec (chart spec &optional exposing) |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1767 (defun outline-chart-spec (chart spec &optional exposing) |
29490 | 1768 "Not yet \(if ever) implemented. |
7416
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1769 |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1770 Produce exposure directives given topic/subtree CHART and an exposure SPEC. |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1771 |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1772 Exposure spec indicates the locations to be exposed and the prescribed |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1773 exposure status. Optional arg EXPOSING is an integer, with 0 |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1774 indicating pending concealment, anything higher indicating depth to |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1775 which subtopic headers should be exposed, and negative numbers |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1776 indicating (negative of) the depth to which subtopic headers and |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1777 bodies should be exposed. |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1778 |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1779 The produced list can have two types of entries. Bare numbers |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1780 indicate points in the buffer where topic headers that should be |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1781 exposed reside. |
7416
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1782 |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1783 - bare negative numbers indicates that the topic starting at the |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1784 point which is the negative of the number should be opened, |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1785 including their entries. |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1786 - bare positive values indicate that this topic header should be |
13964
4de229297f1f
(outline-primary-bullet, outline-numbered-bullet,
Karl Heuer <kwzh@gnu.org>
parents:
13337
diff
changeset
|
1787 opened. |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1788 - Lists signify the beginning and end points of regions that should |
15664
a50ebf4ac764
(outline-auto-activation, outline-layout)
Karl Heuer <kwzh@gnu.org>
parents:
15663
diff
changeset
|
1789 be flagged, and the flag to employ. (For concealment: `\(\?r\)', and |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1790 exposure:" |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1791 (while spec |
15664
a50ebf4ac764
(outline-auto-activation, outline-layout)
Karl Heuer <kwzh@gnu.org>
parents:
15663
diff
changeset
|
1792 (cond ((listp spec) |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1793 ) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1794 ) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1795 (setq spec (cdr spec))) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1796 ) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1797 |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1798 ;;;_ - Within Topic |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1799 ;;;_ > outline-goto-prefix () |
3430 | 1800 (defun outline-goto-prefix () |
29490 | 1801 "Put point at beginning of immediately containing outline topic. |
1802 | |
1803 Goes to most immediate subsequent topic if none immediately containing. | |
7416
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1804 |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1805 Not sensitive to topic visibility. |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1806 |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1807 Returns a the point at the beginning of the prefix, or nil if none." |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1808 |
7416
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1809 (let (done) |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1810 (while (and (not done) |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1811 (re-search-backward "[\n\r]" nil 1)) |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1812 (forward-char 1) |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1813 (if (looking-at outline-regexp) |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1814 (setq done (outline-prefix-data (match-beginning 0) |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1815 (match-end 0))) |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1816 (forward-char -1))) |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1817 (if (bobp) |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1818 (cond ((looking-at outline-regexp) |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1819 (outline-prefix-data (match-beginning 0)(match-end 0))) |
29490 | 1820 ((outline-next-heading)) |
7416
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1821 (done)) |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1822 done))) |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1823 ;;;_ > outline-end-of-prefix () |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1824 (defun outline-end-of-prefix (&optional ignore-decorations) |
7416
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1825 "Position cursor at beginning of header text. |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1826 |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1827 If optional IGNORE-DECORATIONS is non-nil, put just after bullet, |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1828 otherwise skip white space between bullet and ensuing text." |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1829 |
3430 | 1830 (if (not (outline-goto-prefix)) |
1831 nil | |
1832 (let ((match-data (match-data))) | |
1833 (goto-char (match-end 0)) | |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1834 (if ignore-decorations |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1835 t |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1836 (while (looking-at "[0-9]") (forward-char 1)) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1837 (if (and (not (eolp)) (looking-at "\\s-")) (forward-char 1))) |
29490 | 1838 (store-match-data match-data)) |
3430 | 1839 ;; Reestablish where we are: |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1840 (outline-current-depth))) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1841 ;;;_ > outline-current-bullet-pos () |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1842 (defun outline-current-bullet-pos () |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1843 "Return position of current \(visible) topic's bullet." |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1844 |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1845 (if (not (outline-current-depth)) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1846 nil |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1847 (1- (match-end 0)))) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1848 ;;;_ > outline-back-to-current-heading () |
3430 | 1849 (defun outline-back-to-current-heading () |
7416
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1850 "Move to heading line of current topic, or beginning if already on the line." |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1851 |
3430 | 1852 (beginning-of-line) |
1853 (prog1 (or (outline-on-current-heading-p) | |
1854 (and (re-search-backward (concat "^\\(" outline-regexp "\\)") | |
1855 nil | |
1856 'move) | |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1857 (outline-prefix-data (match-beginning 1)(match-end 1)))) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1858 (if (interactive-p) (outline-end-of-prefix)))) |
29490 | 1859 ;;;_ > outline-back-to-heading () |
1860 (defalias 'outline-back-to-heading 'outline-back-to-current-heading) | |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1861 ;;;_ > outline-pre-next-preface () |
3430 | 1862 (defun outline-pre-next-preface () |
1863 "Skip forward to just before the next heading line. | |
1864 | |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1865 Returns that character position." |
3430 | 1866 |
1867 (if (re-search-forward outline-line-boundary-regexp nil 'move) | |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1868 (prog1 (goto-char (match-beginning 0)) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1869 (outline-prefix-data (match-beginning 2)(match-end 2))))) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1870 ;;;_ > outline-end-of-current-subtree () |
3430 | 1871 (defun outline-end-of-current-subtree () |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1872 "Put point at the end of the last leaf in the currently visible topic." |
3430 | 1873 (interactive) |
1874 (outline-back-to-current-heading) | |
7416
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1875 (let ((level (outline-recent-depth))) |
3430 | 1876 (outline-next-heading) |
1877 (while (and (not (eobp)) | |
1878 (> (outline-recent-depth) level)) | |
1879 (outline-next-heading)) | |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1880 (and (not (eobp)) (forward-char -1)) |
29490 | 1881 (and (memq (preceding-char) '(?\n ?\r)) |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1882 (memq (aref (buffer-substring (max 1 (- (point) 3)) (point)) 1) |
29490 | 1883 '(?\n ?\r)) |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1884 (forward-char -1)) |
7416
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1885 (setq outline-recent-end-of-subtree (point)))) |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1886 ;;;_ > outline-beginning-of-current-entry () |
3430 | 1887 (defun outline-beginning-of-current-entry () |
7416
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1888 "When not already there, position point at beginning of current topic's body. |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1889 |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1890 If already there, move cursor to bullet for hot-spot operation. |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1891 \(See outline-mode doc string for details on hot-spot operation.)" |
3430 | 1892 (interactive) |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1893 (let ((start-point (point))) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1894 (outline-end-of-prefix) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1895 (if (and (interactive-p) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1896 (= (point) start-point)) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1897 (goto-char (outline-current-bullet-pos))))) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1898 ;;;_ > outline-end-of-current-entry () |
3430 | 1899 (defun outline-end-of-current-entry () |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1900 "Position the point at the end of the current topics' entry." |
3430 | 1901 (interactive) |
1902 (outline-show-entry) | |
1903 (prog1 (outline-pre-next-preface) | |
1904 (if (and (not (bobp))(looking-at "^$")) | |
7416
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1905 (forward-char -1)))) |
29490 | 1906 ;;;_ > outline-end-of-current-heading () |
1907 (defun outline-end-of-current-heading () | |
1908 (interactive) | |
1909 (outline-beginning-of-current-entry) | |
1910 (forward-line -1) | |
1911 (end-of-line)) | |
1912 (defalias 'outline-end-of-heading 'outline-end-of-current-heading) | |
3430 | 1913 |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1914 ;;;_ - Depth-wise |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1915 ;;;_ > outline-ascend-to-depth (depth) |
3430 | 1916 (defun outline-ascend-to-depth (depth) |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1917 "Ascend to depth DEPTH, returning depth if successful, nil if not." |
3430 | 1918 (if (and (> depth 0)(<= depth (outline-depth))) |
1919 (let ((last-good (point))) | |
1920 (while (and (< depth (outline-depth)) | |
1921 (setq last-good (point)) | |
1922 (outline-beginning-of-level) | |
1923 (outline-previous-heading))) | |
1924 (if (= (outline-recent-depth) depth) | |
1925 (progn (goto-char outline-recent-prefix-beginning) | |
1926 depth) | |
1927 (goto-char last-good) | |
1928 nil)) | |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1929 (if (interactive-p) (outline-end-of-prefix)))) |
29490 | 1930 ;;;_ > outline-ascend () |
1931 (defun outline-ascend () | |
1932 "Ascend one level, returning t if successful, nil if not." | |
1933 (prog1 | |
1934 (if (outline-beginning-of-level) | |
1935 (outline-previous-heading)) | |
1936 (if (interactive-p) (outline-end-of-prefix)))) | |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1937 ;;;_ > outline-descend-to-depth (depth) |
3430 | 1938 (defun outline-descend-to-depth (depth) |
7416
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1939 "Descend to depth DEPTH within current topic. |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1940 |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1941 Returning depth if successful, nil if not." |
3430 | 1942 (let ((start-point (point)) |
1943 (start-depth (outline-depth))) | |
1944 (while | |
1945 (and (> (outline-depth) 0) | |
1946 (not (= depth (outline-recent-depth))) ; ... not there yet | |
1947 (outline-next-heading) ; ... go further | |
1948 (< start-depth (outline-recent-depth)))) ; ... still in topic | |
1949 (if (and (> (outline-depth) 0) | |
1950 (= (outline-recent-depth) depth)) | |
1951 depth | |
1952 (goto-char start-point) | |
1953 nil)) | |
1954 ) | |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1955 ;;;_ > outline-up-current-level (arg &optional dont-complain) |
3430 | 1956 (defun outline-up-current-level (arg &optional dont-complain) |
7416
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1957 "Move out ARG levels from current visible topic. |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1958 |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1959 Positions on heading line of containing topic. Error if unable to |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1960 ascend that far, or nil if unable to ascend but optional arg |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1961 DONT-COMPLAIN is non-nil." |
3430 | 1962 (interactive "p") |
1963 (outline-back-to-current-heading) | |
7416
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1964 (let ((present-level (outline-recent-depth)) |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1965 (last-good (point)) |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1966 failed |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1967 return) |
3430 | 1968 ;; Loop for iterating arg: |
1969 (while (and (> (outline-recent-depth) 1) | |
1970 (> arg 0) | |
7416
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1971 (not (bobp)) |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1972 (not failed)) |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1973 (setq last-good (point)) |
3430 | 1974 ;; Loop for going back over current or greater depth: |
1975 (while (and (not (< (outline-recent-depth) present-level)) | |
7416
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1976 (or (outline-previous-visible-heading 1) |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1977 (not (setq failed present-level))))) |
3430 | 1978 (setq present-level (outline-current-depth)) |
1979 (setq arg (- arg 1))) | |
7416
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1980 (if (or failed |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1981 (> arg 0)) |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1982 (progn (goto-char last-good) |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1983 (if (interactive-p) (outline-end-of-prefix)) |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1984 (if (not dont-complain) |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1985 (error "Can't ascend past outermost level.") |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1986 (if (interactive-p) (outline-end-of-prefix)) |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1987 nil)) |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1988 (if (interactive-p) (outline-end-of-prefix)) |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1989 outline-recent-prefix-beginning))) |
3430 | 1990 |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1991 ;;;_ - Linear |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1992 ;;;_ > outline-next-sibling (&optional depth backward) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1993 (defun outline-next-sibling (&optional depth backward) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1994 "Like outline-forward-current-level, but respects invisible topics. |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1995 |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1996 Traverse at optional DEPTH, or current depth if none specified. |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1997 |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1998 Go backward if optional arg BACKWARD is non-nil. |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1999 |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2000 Return depth if successful, nil otherwise." |
3430 | 2001 |
2002 (if (and backward (bobp)) | |
2003 nil | |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2004 (let ((start-depth (or depth (outline-depth))) |
3430 | 2005 (start-point (point)) |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2006 last-depth) |
3430 | 2007 (while (and (not (if backward (bobp) (eobp))) |
2008 (if backward (outline-previous-heading) | |
2009 (outline-next-heading)) | |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2010 (> (setq last-depth (outline-recent-depth)) start-depth))) |
3430 | 2011 (if (and (not (eobp)) |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2012 (and (> (or last-depth (outline-depth)) 0) |
3430 | 2013 (= (outline-recent-depth) start-depth))) |
2014 outline-recent-prefix-beginning | |
2015 (goto-char start-point) | |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2016 (if depth (outline-depth) start-depth) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2017 nil)))) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2018 ;;;_ > outline-previous-sibling (&optional depth backward) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2019 (defun outline-previous-sibling (&optional depth backward) |
7416
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
2020 "Like outline-forward-current-level,but backwards & respect invisible topics. |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2021 |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2022 Optional DEPTH specifies depth to traverse, default current depth. |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2023 |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2024 Optional BACKWARD reverses direction. |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2025 |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2026 Return depth if successful, nil otherwise." |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2027 (outline-next-sibling depth (not backward)) |
3430 | 2028 ) |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2029 ;;;_ > outline-snug-back () |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2030 (defun outline-snug-back () |
7416
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
2031 "Position cursor at end of previous topic |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
2032 |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
2033 Presumes point is at the start of a topic prefix." |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2034 (if (or (bobp) (eobp)) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2035 nil |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2036 (forward-char -1)) |
29490 | 2037 (if (or (bobp) (not (memq (preceding-char) '(?\n ?\r)))) |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2038 nil |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2039 (forward-char -1) |
29490 | 2040 (if (or (bobp) (not (memq (preceding-char) '(?\n ?\r)))) |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2041 (forward-char -1))) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2042 (point)) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2043 ;;;_ > outline-beginning-of-level () |
3430 | 2044 (defun outline-beginning-of-level () |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2045 "Go back to the first sibling at this level, visible or not." |
3430 | 2046 (outline-end-of-level 'backward)) |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2047 ;;;_ > outline-end-of-level (&optional backward) |
3430 | 2048 (defun outline-end-of-level (&optional backward) |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2049 "Go to the last sibling at this level, visible or not." |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2050 |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2051 (let ((depth (outline-depth))) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2052 (while (outline-previous-sibling depth nil)) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2053 (prog1 (outline-recent-depth) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2054 (if (interactive-p) (outline-end-of-prefix))))) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2055 ;;;_ > outline-next-visible-heading (arg) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2056 (defun outline-next-visible-heading (arg) |
7416
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
2057 "Move to the next ARG'th visible heading line, backward if arg is negative. |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
2058 |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
2059 Move as far as possible in indicated direction \(beginning or end of |
29490 | 2060 buffer) if headings are exhausted." |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2061 |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2062 (interactive "p") |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2063 (let* ((backward (if (< arg 0) (setq arg (* -1 arg)))) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2064 (step (if backward -1 1)) |
7416
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
2065 (start-point (point)) |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2066 prev got) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2067 |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2068 (while (> arg 0) ; limit condition |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2069 (while (and (not (if backward (bobp)(eobp))) ; boundary condition |
7416
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
2070 ;; Move, skipping over all those concealed lines: |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
2071 (< -1 (forward-line step)) |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
2072 (not (setq got (looking-at outline-regexp))))) |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2073 ;; Register this got, it may be the last: |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2074 (if got (setq prev got)) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2075 (setq arg (1- arg))) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2076 (cond (got ; Last move was to a prefix: |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2077 (outline-prefix-data (match-beginning 0) (match-end 0)) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2078 (outline-end-of-prefix)) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2079 (prev ; Last move wasn't, but prev was: |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2080 (outline-prefix-data (match-beginning 0) (match-end 0))) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2081 ((not backward) (end-of-line) nil)))) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2082 ;;;_ > outline-previous-visible-heading (arg) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2083 (defun outline-previous-visible-heading (arg) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2084 "Move to the previous heading line. |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2085 |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2086 With argument, repeats or can move forward if negative. |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2087 A heading line is one that starts with a `*' (or that outline-regexp |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2088 matches)." |
3430 | 2089 (interactive "p") |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2090 (outline-next-visible-heading (- arg))) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2091 ;;;_ > outline-forward-current-level (arg) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2092 (defun outline-forward-current-level (arg) |
7416
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
2093 "Position point at the next heading of the same level. |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
2094 |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
2095 Takes optional repeat-count, goes backward if count is negative. |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
2096 |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
2097 Returns resulting position, else nil if none found." |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2098 (interactive "p") |
7416
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
2099 (let ((start-depth (outline-current-depth)) |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
2100 (start-point (point)) |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
2101 (start-arg arg) |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
2102 (backward (> 0 arg)) |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
2103 last-depth |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
2104 (last-good (point)) |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
2105 at-boundary) |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
2106 (if (= 0 start-depth) |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
2107 (error "No siblings, not in a topic...")) |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
2108 (if backward (setq arg (* -1 arg))) |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
2109 (while (not (or (zerop arg) |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
2110 at-boundary)) |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
2111 (while (and (not (if backward (bobp) (eobp))) |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
2112 (if backward (outline-previous-visible-heading 1) |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
2113 (outline-next-visible-heading 1)) |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
2114 (> (setq last-depth (outline-recent-depth)) start-depth))) |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
2115 (if (and last-depth (= last-depth start-depth) |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
2116 (not (if backward (bobp) (eobp)))) |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
2117 (setq last-good (point) |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
2118 arg (1- arg)) |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
2119 (setq at-boundary t))) |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
2120 (if (and (not (eobp)) |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
2121 (= arg 0) |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
2122 (and (> (or last-depth (outline-depth)) 0) |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
2123 (= (outline-recent-depth) start-depth))) |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
2124 outline-recent-prefix-beginning |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
2125 (goto-char last-good) |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
2126 (if (not (interactive-p)) |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
2127 nil |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
2128 (outline-end-of-prefix) |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
2129 (error "Hit %s level %d topic, traversed %d of %d requested." |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
2130 (if backward "first" "last") |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
2131 (outline-recent-depth) |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
2132 (- (abs start-arg) arg) |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
2133 (abs start-arg)))))) |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2134 ;;;_ > outline-backward-current-level (arg) |
3430 | 2135 (defun outline-backward-current-level (arg) |
7416
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
2136 "Inverse of `outline-forward-current-level'." |
3430 | 2137 (interactive "p") |
7416
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
2138 (if (interactive-p) |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
2139 (let ((current-prefix-arg (* -1 arg))) |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
2140 (call-interactively 'outline-forward-current-level)) |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
2141 (outline-forward-current-level (* -1 arg)))) |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
2142 |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
2143 ;;;_ #5 Alteration |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2144 |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2145 ;;;_ - Fundamental |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2146 ;;;_ > outline-before-change-protect (beg end) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2147 (defun outline-before-change-protect (beg end) |
7416
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
2148 "Outline before-change hook, regulates changes to concealed text. |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
2149 |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
2150 Reveal concealed text that would be changed by current command, and |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2151 offer user choice to commit or forego the change. Unchanged text is |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2152 reconcealed. User has option to have changed text reconcealed. |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2153 |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2154 Undo commands are specially treated - the user is not prompted for |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2155 choice, the undoes are always committed (based on presumption that the |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2156 things being undone were already subject to this regulation routine), |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2157 and undoes always leave the changed stuff exposed. |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2158 |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2159 Changes to concealed regions are ignored while file is being written. |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2160 \(This is for the sake of functions that do change the file during |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2161 writes, like crypt and zip modes.) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2162 |
29490 | 2163 Locally bound in outline buffers to `before-change-functions', which |
2164 in emacs 19 is run before any change to the buffer. | |
15664
a50ebf4ac764
(outline-auto-activation, outline-layout)
Karl Heuer <kwzh@gnu.org>
parents:
15663
diff
changeset
|
2165 |
a50ebf4ac764
(outline-auto-activation, outline-layout)
Karl Heuer <kwzh@gnu.org>
parents:
15663
diff
changeset
|
2166 Any functions which set [`this-command' to `undo', or which set] |
a50ebf4ac764
(outline-auto-activation, outline-layout)
Karl Heuer <kwzh@gnu.org>
parents:
15663
diff
changeset
|
2167 `outline-override-protect' non-nil (as does, eg, outline-flag-chars) |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2168 are exempt from this restriction." |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2169 (if (and (outline-mode-p) |
15664
a50ebf4ac764
(outline-auto-activation, outline-layout)
Karl Heuer <kwzh@gnu.org>
parents:
15663
diff
changeset
|
2170 ; outline-override-protect |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2171 ; set by functions that know what |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2172 ; they're doing, eg outline internals: |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2173 (not outline-override-protect) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2174 (not outline-during-write-cue) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2175 (save-match-data ; Preserve operation position state. |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2176 ; Both beginning and end chars must |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2177 ; be exposed: |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2178 (save-excursion (if (memq this-command '(newline open-line)) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2179 ;; Compensate for stupid emacs {new, |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2180 ;; open-}line display optimization: |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2181 (setq beg (1+ beg) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2182 end (1+ end))) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2183 (goto-char beg) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2184 (or (outline-hidden-p) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2185 (and (not (= beg end)) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2186 (goto-char end) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2187 (outline-hidden-p)))))) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2188 (save-match-data |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2189 (if (equal this-command 'undo) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2190 ;; Allow undo without inhibition. |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2191 ;; - Undoing new and open-line hits stupid emacs redisplay |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2192 ;; optimization (em 19 cmds.c, ~ line 200). |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2193 ;; - Presumably, undoing what was properly protected when |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2194 ;; done. |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2195 ;; - Undo may be users' only recourse in protection faults. |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2196 ;; So, expose what getting changed: |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2197 (progn (message "Undo! - exposing concealed target...") |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2198 (if (outline-hidden-p) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2199 (outline-show-children)) |
7416
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
2200 (message "Undo!")) |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2201 (let (response |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2202 (rehide-completely (save-excursion (outline-goto-prefix) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2203 (outline-hidden-p))) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2204 rehide-place) |
15664
a50ebf4ac764
(outline-auto-activation, outline-layout)
Karl Heuer <kwzh@gnu.org>
parents:
15663
diff
changeset
|
2205 |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2206 (save-excursion |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2207 (if (condition-case err |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2208 ;; Condition case to catch keyboard quits during reads. |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2209 (progn |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2210 ; Give them a peek where |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2211 (save-excursion |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2212 (if (eolp) (setq rehide-place |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2213 (outline-goto-prefix))) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2214 (outline-show-entry)) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2215 ; Present the message, but... |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2216 ; leave the cursor at the location |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2217 ; until they respond: |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2218 ; Then interpret the response: |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2219 (while |
15664
a50ebf4ac764
(outline-auto-activation, outline-layout)
Karl Heuer <kwzh@gnu.org>
parents:
15663
diff
changeset
|
2220 (progn |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2221 (message (concat "Change inside concealed" |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2222 " region - do it? " |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2223 "(n or 'y'/'r'eclose)")) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2224 (setq response (read-char)) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2225 (not |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2226 (cond ((memq response '(?r ?R)) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2227 (setq response 'reclose)) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2228 ((memq response '(?y ?Y ? )) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2229 (setq response t)) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2230 ((memq response '(?n ?N 127)) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2231 (setq response nil) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2232 t) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2233 ((eq response ??) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2234 (message |
15664
a50ebf4ac764
(outline-auto-activation, outline-layout)
Karl Heuer <kwzh@gnu.org>
parents:
15663
diff
changeset
|
2235 "`r' means `yes, then reclose'") |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2236 nil) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2237 (t (message "Please answer y, n, or r") |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2238 (sit-for 1) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2239 nil))))) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2240 response) |
29490 | 2241 ('quit nil)) |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2242 ; Continue: |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2243 (if (eq response 'reclose) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2244 (save-excursion |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2245 (if rehide-place (goto-char rehide-place)) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2246 (if rehide-completely |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2247 (outline-hide-current-entry-completely) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2248 (outline-hide-current-entry))) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2249 (if (outline-ascend-to-depth (1- (outline-recent-depth))) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2250 (outline-show-children) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2251 (outline-show-to-offshoot))) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2252 ; Prevent: |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2253 (if rehide-completely |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2254 (save-excursion |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2255 (if rehide-place (goto-char rehide-place)) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2256 (outline-hide-current-entry-completely)) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2257 (outline-hide-current-entry)) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2258 (error (concat |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2259 "Change within concealed region prevented."))))))) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2260 ) ; if |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2261 ) ; defun |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2262 ;;;_ = outline-post-goto-bullet |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2263 (defvar outline-post-goto-bullet nil |
7416
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
2264 "Outline internal var, for `outline-pre-command-business' hot-spot operation. |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
2265 |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
2266 When set, tells post-processing to reposition on topic bullet, and |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
2267 then unset it. Set by outline-pre-command-business when implementing |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
2268 hot-spot operation, where literal characters typed over a topic bullet |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
2269 are mapped to the command of the corresponding control-key on the |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
2270 outline-mode-map.") |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2271 (make-variable-buffer-local 'outline-post-goto-bullet) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2272 ;;;_ > outline-post-command-business () |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2273 (defun outline-post-command-business () |
7416
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
2274 "Outline post-command-hook function. |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
2275 |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
2276 - Null outline-override-protect, so it's not left open. |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
2277 |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
2278 - Implement (and clear) outline-post-goto-bullet, for hot-spot |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2279 outline commands. |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2280 |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2281 - Massages buffer-undo-list so successive, standard character self-inserts are |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2282 aggregated. This kludge compensates for lack of undo bunching when |
29490 | 2283 before-change-functions is used." |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2284 |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2285 ; Apply any external change func: |
7416
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
2286 (if (not (outline-mode-p)) ; In outline-mode. |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
2287 nil |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
2288 (setq outline-override-protect nil) |
29490 | 2289 (if outline-isearch-dynamic-expose |
2290 (outline-isearch-rectification)) | |
7416
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
2291 (if outline-during-write-cue |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
2292 ;; Was used by outline-before-change-protect, done with it now: |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
2293 (setq outline-during-write-cue nil)) |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
2294 ;; Undo bunching business: |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
2295 (if (and (listp buffer-undo-list) ; Undo history being kept. |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
2296 (equal this-command 'self-insert-command) |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
2297 (equal last-command 'self-insert-command)) |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
2298 (let* ((prev-stuff (cdr buffer-undo-list)) |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
2299 (before-prev-stuff (cdr (cdr prev-stuff))) |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
2300 cur-cell cur-from cur-to |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
2301 prev-cell prev-from prev-to) |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
2302 (if (and before-prev-stuff ; Goes back far enough to bother, |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
2303 (not (car prev-stuff)) ; and break before current, |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
2304 (not (car before-prev-stuff)) ; !and break before prev! |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
2305 (setq prev-cell (car (cdr prev-stuff))) ; contents now, |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
2306 (setq cur-cell (car buffer-undo-list)) ; contents prev. |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
2307 |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
2308 ;; cur contents denote a single char insertion: |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
2309 (numberp (setq cur-from (car cur-cell))) |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
2310 (numberp (setq cur-to (cdr cur-cell))) |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
2311 (= 1 (- cur-to cur-from)) |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
2312 |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
2313 ;; prev contents denote fewer than aggregate-limit |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
2314 ;; insertions: |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
2315 (numberp (setq prev-from (car prev-cell))) |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
2316 (numberp (setq prev-to (cdr prev-cell))) |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2317 ; Below threshold: |
7416
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
2318 (> outline-undo-aggregation (- prev-to prev-from))) |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
2319 (setq buffer-undo-list |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
2320 (cons (cons prev-from cur-to) |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
2321 (cdr (cdr (cdr buffer-undo-list)))))))) |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
2322 ;; Implement -post-goto-bullet, if set: (must be after undo business) |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
2323 (if (and outline-post-goto-bullet |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
2324 (outline-current-bullet-pos)) |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
2325 (progn (goto-char (outline-current-bullet-pos)) |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
2326 (setq outline-post-goto-bullet nil))) |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
2327 )) |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2328 ;;;_ > outline-pre-command-business () |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2329 (defun outline-pre-command-business () |
7416
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
2330 "Outline pre-command-hook function for outline buffers. |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
2331 Implements special behavior when cursor is on bullet char. |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2332 |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2333 Self-insert characters are reinterpreted control-character references |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2334 into the outline-mode-map. The outline-mode post-command hook will |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2335 position a cursor that has moved as a result of such reinterpretation, |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2336 on the destination topic's bullet, when the cursor wound up in the |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2337 |
29490 | 2338 The upshot is that you can get easy, single (ie, unmodified) key |
2339 outline maneuvering operations by positioning the cursor on the bullet | |
2340 char. You stay in this mode until you use some regular | |
2341 cursor-positioning command to relocate the cursor off of a bullet | |
2342 char." | |
2343 | |
2344 (if (not (outline-mode-p)) | |
2345 ;; Shouldn't be invoked if not in allout outline-mode, but just in case: | |
2346 nil | |
2347 ;; Register isearch status: | |
2348 (if (and (boundp 'isearch-mode) isearch-mode) | |
2349 (setq outline-pre-was-isearching t) | |
2350 (setq outline-pre-was-isearching nil)) | |
2351 ;; Hot-spot navigation provisions: | |
2352 (if (and (eq this-command 'self-insert-command) | |
2353 (eq (point)(outline-current-bullet-pos))) | |
2354 (let* ((this-key-num (cond | |
2355 ((numberp last-command-char) | |
2356 last-command-char) | |
2357 ;; XXX Only xemacs has characterp. | |
2358 ((and (fboundp 'characterp) | |
2359 (characterp last-command-char)) | |
2360 (char-to-int last-command-char)) | |
2361 (t 0))) | |
2362 mapped-binding) | |
2363 (if (zerop this-key-num) | |
2364 nil | |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2365 ; Map upper-register literals |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2366 ; to lower register: |
29490 | 2367 (if (<= 96 this-key-num) |
2368 (setq this-key-num (- this-key-num 32))) | |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2369 ; Check if we have a literal: |
29490 | 2370 (if (and (<= 64 this-key-num) |
2371 (>= 96 this-key-num)) | |
2372 (setq mapped-binding | |
2373 (lookup-key 'outline-mode-map | |
2374 (concat outline-command-prefix | |
2375 (char-to-string (- this-key-num | |
2376 64)))))) | |
2377 (if mapped-binding | |
2378 (setq outline-post-goto-bullet t | |
2379 this-command mapped-binding))))))) | |
7416
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
2380 ;;;_ > outline-find-file-hook () |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
2381 (defun outline-find-file-hook () |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
2382 "Activate outline-mode when `outline-auto-activation' & `outline-layout' are non-nil. |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
2383 |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
2384 See `outline-init' for setup instructions." |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
2385 (if (and outline-auto-activation |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
2386 (not (outline-mode-p)) |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
2387 outline-layout) |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
2388 (outline-mode t))) |
29490 | 2389 ;;;_ > outline-isearch-rectification |
2390 (defun outline-isearch-rectification () | |
2391 "Rectify outline exposure before, during, or after isearch. | |
2392 | |
2393 Called as part of outline-post-command-business." | |
2394 | |
2395 (let ((isearching (and (boundp 'isearch-mode) isearch-mode))) | |
2396 (cond ((and isearching (not outline-pre-was-isearching)) | |
2397 (outline-isearch-expose 'start)) | |
2398 ((and isearching outline-pre-was-isearching) | |
2399 (outline-isearch-expose 'continue)) | |
2400 ((and (not isearching) outline-pre-was-isearching) | |
2401 (outline-isearch-expose 'final)) | |
2402 ;; Not and wasn't isearching: | |
2403 (t (setq outline-isearch-prior-pos nil) | |
2404 (setq outline-isearch-did-quit nil))))) | |
2405 ;;;_ = outline-isearch-was-font-lock | |
2406 (defvar outline-isearch-was-font-lock | |
2407 (and (boundp 'font-lock-mode) font-lock-mode)) | |
36390
495ba6e137c7
(outline-flag-region): Move macro in front of first
Gerd Moellmann <gerd@gnu.org>
parents:
29490
diff
changeset
|
2408 |
495ba6e137c7
(outline-flag-region): Move macro in front of first
Gerd Moellmann <gerd@gnu.org>
parents:
29490
diff
changeset
|
2409 ;;;_ > outline-flag-region (from to flag) |
495ba6e137c7
(outline-flag-region): Move macro in front of first
Gerd Moellmann <gerd@gnu.org>
parents:
29490
diff
changeset
|
2410 (defmacro outline-flag-region (from to flag) |
495ba6e137c7
(outline-flag-region): Move macro in front of first
Gerd Moellmann <gerd@gnu.org>
parents:
29490
diff
changeset
|
2411 "Hide or show lines from FROM to TO, via emacs selective-display FLAG char. |
495ba6e137c7
(outline-flag-region): Move macro in front of first
Gerd Moellmann <gerd@gnu.org>
parents:
29490
diff
changeset
|
2412 Ie, text following flag C-m \(carriage-return) is hidden until the |
495ba6e137c7
(outline-flag-region): Move macro in front of first
Gerd Moellmann <gerd@gnu.org>
parents:
29490
diff
changeset
|
2413 next C-j (newline) char. |
495ba6e137c7
(outline-flag-region): Move macro in front of first
Gerd Moellmann <gerd@gnu.org>
parents:
29490
diff
changeset
|
2414 |
495ba6e137c7
(outline-flag-region): Move macro in front of first
Gerd Moellmann <gerd@gnu.org>
parents:
29490
diff
changeset
|
2415 Returns the endpoint of the region." |
495ba6e137c7
(outline-flag-region): Move macro in front of first
Gerd Moellmann <gerd@gnu.org>
parents:
29490
diff
changeset
|
2416 `(let ((buffer-read-only nil) |
495ba6e137c7
(outline-flag-region): Move macro in front of first
Gerd Moellmann <gerd@gnu.org>
parents:
29490
diff
changeset
|
2417 (outline-override-protect t)) |
495ba6e137c7
(outline-flag-region): Move macro in front of first
Gerd Moellmann <gerd@gnu.org>
parents:
29490
diff
changeset
|
2418 (subst-char-in-region ,from ,to |
495ba6e137c7
(outline-flag-region): Move macro in front of first
Gerd Moellmann <gerd@gnu.org>
parents:
29490
diff
changeset
|
2419 (if (= ,flag ?\n) ?\r ?\n) |
495ba6e137c7
(outline-flag-region): Move macro in front of first
Gerd Moellmann <gerd@gnu.org>
parents:
29490
diff
changeset
|
2420 ,flag t))) |
495ba6e137c7
(outline-flag-region): Move macro in front of first
Gerd Moellmann <gerd@gnu.org>
parents:
29490
diff
changeset
|
2421 |
29490 | 2422 ;;;_ > outline-isearch-expose (mode) |
2423 (defun outline-isearch-expose (mode) | |
2424 "Mode is either 'clear, 'start, 'continue, or 'final." | |
2425 ;; outline-isearch-prior-pos encodes exposure status of prior pos: | |
2426 ;; (pos was-vis header-pos end-pos) | |
2427 ;; pos - point of concern | |
2428 ;; was-vis - t, else 'topic if entire topic was exposed, 'entry otherwise | |
2429 ;; Do reclosure or prior pos, as necessary: | |
2430 (if (eq mode 'start) | |
2431 (setq outline-isearch-was-font-lock (and (boundp 'font-lock-mode) | |
2432 font-lock-mode) | |
2433 font-lock-mode nil) | |
2434 (if (eq mode 'final) | |
2435 (setq font-lock-mode outline-isearch-was-font-lock)) | |
2436 (if (and outline-isearch-prior-pos | |
2437 (listp outline-isearch-prior-pos)) | |
2438 ;; Conceal prior peek: | |
2439 (outline-flag-region (car (cdr outline-isearch-prior-pos)) | |
2440 (car (cdr (cdr outline-isearch-prior-pos))) | |
2441 ?\r))) | |
2442 (if (outline-visible-p) | |
2443 (setq outline-isearch-prior-pos nil) | |
2444 (if (not (eq mode 'final)) | |
2445 (setq outline-isearch-prior-pos (cons (point) (outline-show-entry))) | |
2446 (if outline-isearch-did-quit | |
2447 nil | |
2448 (setq outline-isearch-prior-pos nil) | |
2449 (outline-show-children)))) | |
2450 (setq outline-isearch-did-quit nil)) | |
2451 ;;;_ > outline-enwrap-isearch () | |
2452 (defun outline-enwrap-isearch () | |
2453 "Impose outline-mode isearch-abort wrapper for dynamic exposure in isearch. | |
2454 | |
2455 The function checks to ensure that the rebinding is done only once." | |
2456 | |
2457 (add-hook 'isearch-mode-end-hook 'outline-isearch-rectification) | |
2458 (if (fboundp 'outline-real-isearch-abort) | |
2459 ;; | |
2460 nil | |
2461 ; Ensure load of isearch-mode: | |
2462 (if (or (and (fboundp 'isearch-mode) | |
2463 (fboundp 'isearch-abort)) | |
2464 (condition-case error | |
2465 (load-library "isearch-mode") | |
2466 ('file-error (message | |
2467 "Skipping isearch-mode provisions - %s '%s'" | |
2468 (car (cdr error)) | |
2469 (car (cdr (cdr error)))) | |
2470 (sit-for 1) | |
2471 ;; Inhibit subsequent tries and return nil: | |
2472 (setq outline-isearch-dynamic-expose nil)))) | |
2473 ;; Isearch-mode loaded, encapsulate specific entry points for | |
2474 ;; outline dynamic-exposure business: | |
2475 (progn | |
2476 ;; stash crucial isearch-mode funcs under known, private | |
2477 ;; names, then register wrapper functions under the old | |
2478 ;; names, in their stead: | |
2479 (fset 'outline-real-isearch-abort (symbol-function 'isearch-abort)) | |
2480 (fset 'isearch-abort 'outline-isearch-abort))))) | |
2481 ;;;_ > outline-isearch-abort () | |
2482 (defun outline-isearch-abort () | |
2483 "Wrapper for outline-real-isearch-abort \(which see), to register | |
2484 actual quits." | |
2485 (interactive) | |
2486 (setq outline-isearch-did-quit nil) | |
2487 (condition-case what | |
2488 (outline-real-isearch-abort) | |
2489 ('quit (setq outline-isearch-did-quit t) | |
2490 (signal 'quit nil)))) | |
2491 | |
2492 ;;; Prevent unnecessary font-lock while isearching! | |
2493 (defvar isearch-was-font-locking nil) | |
2494 (defun isearch-inhibit-font-lock () | |
2495 "Inhibit font-lock while isearching - for use on isearch-mode-hook." | |
2496 (if (and (outline-mode-p) (boundp 'font-lock-mode) font-lock-mode) | |
2497 (setq isearch-was-font-locking t | |
2498 font-lock-mode nil))) | |
2499 (add-hook 'isearch-mode-hook 'isearch-inhibit-font-lock) | |
2500 (defun isearch-reenable-font-lock () | |
2501 "Reenable font-lock after isearching - for use on isearch-mode-end-hook." | |
2502 (if (and (boundp 'font-lock-mode) font-lock-mode) | |
2503 (if (and (outline-mode-p) isearch-was-font-locking) | |
2504 (setq isearch-was-font-locking nil | |
2505 font-lock-mode t)))) | |
2506 (add-hook 'isearch-mode-end-hook 'isearch-reenable-font-lock) | |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2507 |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2508 ;;;_ - Topic Format Assessment |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2509 ;;;_ > outline-solicit-alternate-bullet (depth &optional current-bullet) |
3430 | 2510 (defun outline-solicit-alternate-bullet (depth &optional current-bullet) |
2511 | |
7416
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
2512 "Prompt for and return a bullet char as an alternative to the current one. |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
2513 |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
2514 Offer one suitable for current depth DEPTH as default." |
3430 | 2515 |
29490 | 2516 (let* ((default-bullet (or (and (stringp current-bullet) current-bullet) |
3430 | 2517 (outline-bullet-for-depth depth))) |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2518 (sans-escapes (regexp-sans-escapes outline-bullets-string)) |
29490 | 2519 choice) |
2520 (save-excursion | |
2521 (goto-char (outline-current-bullet-pos)) | |
2522 (setq choice (solicit-char-in-string | |
2523 (format "Select bullet: %s ('%s' default): " | |
2524 sans-escapes | |
2525 default-bullet) | |
2526 sans-escapes | |
2527 t))) | |
2528 (message "") | |
3430 | 2529 (if (string= choice "") default-bullet choice)) |
2530 ) | |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2531 ;;;_ > outline-distinctive-bullet (bullet) |
3430 | 2532 (defun outline-distinctive-bullet (bullet) |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2533 "True if bullet is one of those on outline-distinctive-bullets-string." |
3430 | 2534 (string-match (regexp-quote bullet) outline-distinctive-bullets-string)) |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2535 ;;;_ > outline-numbered-type-prefix (&optional prefix) |
3430 | 2536 (defun outline-numbered-type-prefix (&optional prefix) |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2537 "True if current header prefix bullet is numbered bullet." |
3430 | 2538 (and outline-numbered-bullet |
2539 (string= outline-numbered-bullet | |
2540 (if prefix | |
2541 (outline-get-prefix-bullet prefix) | |
2542 (outline-get-bullet))))) | |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2543 ;;;_ > outline-bullet-for-depth (&optional depth) |
3430 | 2544 (defun outline-bullet-for-depth (&optional depth) |
7416
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
2545 "Return outline topic bullet suited to optional DEPTH, or current depth." |
3430 | 2546 ;; Find bullet in plain-bullets-string modulo DEPTH. |
2547 (if outline-stylish-prefixes | |
2548 (char-to-string (aref outline-plain-bullets-string | |
2549 (% (max 0 (- depth 2)) | |
2550 outline-plain-bullets-string-len))) | |
2551 outline-primary-bullet) | |
2552 ) | |
2553 | |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2554 ;;;_ - Topic Production |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2555 ;;;_ > outline-make-topic-prefix (&optional prior-bullet |
3430 | 2556 (defun outline-make-topic-prefix (&optional prior-bullet |
2557 new | |
2558 depth | |
2559 solicit | |
2560 number-control | |
2561 index) | |
2562 ;; Depth null means use current depth, non-null means we're either | |
2563 ;; opening a new topic after current topic, lower or higher, or we're | |
2564 ;; changing level of current topic. | |
2565 ;; Solicit dominates specified bullet-char. | |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2566 ;;;_ . Doc string: |
7416
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
2567 "Generate a topic prefix suitable for optional arg DEPTH, or current depth. |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2568 |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2569 All the arguments are optional. |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2570 |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2571 PRIOR-BULLET indicates the bullet of the prefix being changed, or |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2572 nil if none. This bullet may be preserved (other options |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2573 notwithstanding) if it is on the outline-distinctive-bullets-string, |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2574 for instance. |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2575 |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2576 Second arg NEW indicates that a new topic is being opened after the |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2577 topic at point, if non-nil. Default bullet for new topics, eg, may |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2578 be set (contingent to other args) to numbered bullets if previous |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2579 sibling is one. The implication otherwise is that the current topic |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2580 is being adjusted - shifted or rebulleted - and we don't consider |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2581 bullet or previous sibling. |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2582 |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2583 Third arg DEPTH forces the topic prefix to that depth, regardless of |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2584 the current topics' depth. |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2585 |
29490 | 2586 If SOLICIT is non-nil, then the choice of bullet is solicited from |
2587 user. If it's a character, then that character is offered as the | |
2588 default, otherwise the one suited to the context \(according to | |
2589 distinction or depth) is offered. \(This overrides other options, | |
2590 including, eg, a distinctive PRIOR-BULLET.) If non-nil, then the | |
2591 context-specific bullet is used. | |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2592 |
15664
a50ebf4ac764
(outline-auto-activation, outline-layout)
Karl Heuer <kwzh@gnu.org>
parents:
15663
diff
changeset
|
2593 Fifth arg, NUMBER-CONTROL, matters only if `outline-numbered-bullet' |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2594 is non-nil *and* soliciting was not explicitly invoked. Then |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2595 NUMBER-CONTROL non-nil forces prefix to either numbered or |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2596 denumbered format, depending on the value of the sixth arg, INDEX. |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2597 |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2598 \(Note that NUMBER-CONTROL does *not* apply to level 1 topics. Sorry...) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2599 |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2600 If NUMBER-CONTROL is non-nil and sixth arg INDEX is non-nil then |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2601 the prefix of the topic is forced to be numbered. Non-nil |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2602 NUMBER-CONTROL and nil INDEX forces non-numbered format on the |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2603 bullet. Non-nil NUMBER-CONTROL and non-nil, non-number INDEX means |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2604 that the index for the numbered prefix will be derived, by counting |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2605 siblings back to start of level. If INDEX is a number, then that |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2606 number is used as the index for the numbered prefix (allowing, eg, |
13964
4de229297f1f
(outline-primary-bullet, outline-numbered-bullet,
Karl Heuer <kwzh@gnu.org>
parents:
13337
diff
changeset
|
2607 sequential renumbering to not require this function counting back the |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2608 index for each successive sibling)." |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2609 ;;;_ . Code: |
3430 | 2610 ;; The options are ordered in likely frequence of use, most common |
2611 ;; highest, least lowest. Ie, more likely to be doing prefix | |
2612 ;; adjustments than soliciting, and yet more than numbering. | |
2613 ;; Current prefix is least dominant, but most likely to be commonly | |
2614 ;; specified... | |
2615 | |
2616 (let* (body | |
2617 numbering | |
2618 denumbering | |
2619 (depth (or depth (outline-depth))) | |
2620 (header-lead outline-header-prefix) | |
2621 (bullet-char | |
2622 | |
2623 ;; Getting value for bullet char is practically the whole job: | |
2624 | |
2625 (cond | |
2626 ; Simplest situation - level 1: | |
2627 ((<= depth 1) (setq header-lead "") outline-primary-bullet) | |
2628 ; Simple, too: all asterisks: | |
2629 (outline-old-style-prefixes | |
2630 ;; Cheat - make body the whole thing, null out header-lead and | |
2631 ;; bullet-char: | |
2632 (setq body (make-string depth | |
2633 (string-to-char outline-primary-bullet))) | |
2634 (setq header-lead "") | |
2635 "") | |
2636 | |
2637 ;; (Neither level 1 nor old-style, so we're space padding. | |
2638 ;; Sneak it in the condition of the next case, whatever it is.) | |
2639 | |
2640 ;; Solicitation overrides numbering and other cases: | |
2641 ((progn (setq body (make-string (- depth 2) ?\ )) | |
2642 ;; The actual condition: | |
2643 solicit) | |
29490 | 2644 (let* ((got (outline-solicit-alternate-bullet depth solicit))) |
3430 | 2645 ;; Gotta check whether we're numbering and got a numbered bullet: |
2646 (setq numbering (and outline-numbered-bullet | |
2647 (not (and number-control (not index))) | |
2648 (string= got outline-numbered-bullet))) | |
2649 ;; Now return what we got, regardless: | |
2650 got)) | |
2651 | |
2652 ;; Numbering invoked through args: | |
2653 ((and outline-numbered-bullet number-control) | |
2654 (if (setq numbering (not (setq denumbering (not index)))) | |
2655 outline-numbered-bullet | |
7416
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
2656 (if (and prior-bullet |
3430 | 2657 (not (string= outline-numbered-bullet |
7416
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
2658 prior-bullet))) |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
2659 prior-bullet |
3430 | 2660 (outline-bullet-for-depth depth)))) |
2661 | |
2662 ;;; Neither soliciting nor controlled numbering ;;; | |
2663 ;;; (may be controlled denumbering, tho) ;;; | |
2664 | |
2665 ;; Check wrt previous sibling: | |
2666 ((and new ; only check for new prefixes | |
2667 (<= depth (outline-depth)) | |
2668 outline-numbered-bullet ; ... & numbering enabled | |
2669 (not denumbering) | |
2670 (let ((sibling-bullet | |
2671 (save-excursion | |
2672 ;; Locate correct sibling: | |
2673 (or (>= depth (outline-depth)) | |
2674 (outline-ascend-to-depth depth)) | |
2675 (outline-get-bullet)))) | |
2676 (if (and sibling-bullet | |
2677 (string= outline-numbered-bullet sibling-bullet)) | |
2678 (setq numbering sibling-bullet))))) | |
2679 | |
2680 ;; Distinctive prior bullet? | |
2681 ((and prior-bullet | |
2682 (outline-distinctive-bullet prior-bullet) | |
2683 ;; Either non-numbered: | |
2684 (or (not (and outline-numbered-bullet | |
2685 (string= prior-bullet outline-numbered-bullet))) | |
2686 ;; or numbered, and not denumbering: | |
2687 (setq numbering (not denumbering))) | |
2688 ;; Here 'tis: | |
2689 prior-bullet)) | |
2690 | |
2691 ;; Else, standard bullet per depth: | |
2692 ((outline-bullet-for-depth depth))))) | |
2693 | |
2694 (concat header-lead | |
2695 body | |
2696 bullet-char | |
2697 (if numbering | |
2698 (format "%d" (cond ((and index (numberp index)) index) | |
2699 (new (1+ (outline-sibling-index depth))) | |
2700 ((outline-sibling-index)))))) | |
2701 ) | |
2702 ) | |
29490 | 2703 ;;;_ > outline-open-topic (relative-depth &optional before use_sib_bullet) |
2704 (defun outline-open-topic (relative-depth &optional before use_sib_bullet) | |
7416
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
2705 "Open a new topic at depth DEPTH. |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
2706 |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
2707 New topic is situated after current one, unless optional flag BEFORE |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
2708 is non-nil, or unless current line is complete empty (not even |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
2709 whitespace), in which case open is done on current line. |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2710 |
29490 | 2711 If USE_SIB_BULLET is true, use the bullet of the prior sibling. |
2712 | |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2713 Nuances: |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2714 |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2715 - Creation of new topics is with respect to the visible topic |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2716 containing the cursor, regardless of intervening concealed ones. |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2717 |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2718 - New headers are generally created after/before the body of a |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2719 topic. However, they are created right at cursor location if the |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2720 cursor is on a blank line, even if that breaks the current topic |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2721 body. This is intentional, to provide a simple means for |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2722 deliberately dividing topic bodies. |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2723 |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2724 - Double spacing of topic lists is preserved. Also, the first |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2725 level two topic is created double-spaced (and so would be |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2726 subsequent siblings, if that's left intact). Otherwise, |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2727 single-spacing is used. |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2728 |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2729 - Creation of sibling or nested topics is with respect to the topic |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2730 you're starting from, even when creating backwards. This way you |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2731 can easily create a sibling in front of the current topic without |
13964
4de229297f1f
(outline-primary-bullet, outline-numbered-bullet,
Karl Heuer <kwzh@gnu.org>
parents:
13337
diff
changeset
|
2732 having to go to its preceding sibling, and then open forward |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2733 from there." |
3430 | 2734 |
2735 (let* ((depth (+ (outline-current-depth) relative-depth)) | |
2736 (opening-on-blank (if (looking-at "^\$") | |
2737 (not (setq before nil)))) | |
2738 opening-numbered ; Will get while computing ref-topic, below | |
29490 | 2739 ref-depth ; Will get while computing ref-topic, below |
2740 ref-bullet ; Will get while computing ref-topic, next | |
3430 | 2741 (ref-topic (save-excursion |
2742 (cond ((< relative-depth 0) | |
2743 (outline-ascend-to-depth depth)) | |
2744 ((>= relative-depth 1) nil) | |
2745 (t (outline-back-to-current-heading))) | |
2746 (setq ref-depth (outline-recent-depth)) | |
29490 | 2747 (setq ref-bullet |
2748 (if (> outline-recent-prefix-end 1) | |
2749 (outline-recent-bullet) | |
2750 "")) | |
3430 | 2751 (setq opening-numbered |
2752 (save-excursion | |
2753 (and outline-numbered-bullet | |
2754 (or (<= relative-depth 0) | |
2755 (outline-descend-to-depth depth)) | |
2756 (if (outline-numbered-type-prefix) | |
2757 outline-numbered-bullet)))) | |
2758 (point))) | |
2759 dbl-space | |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2760 doing-beginning) |
3430 | 2761 |
2762 (if (not opening-on-blank) | |
2763 ; Positioning and vertical | |
2764 ; padding - only if not | |
2765 ; opening-on-blank: | |
15664
a50ebf4ac764
(outline-auto-activation, outline-layout)
Karl Heuer <kwzh@gnu.org>
parents:
15663
diff
changeset
|
2766 (progn |
3430 | 2767 (goto-char ref-topic) |
2768 (setq dbl-space ; Determine double space action: | |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2769 (or (and (<= relative-depth 0) ; not descending; |
3430 | 2770 (save-excursion |
13964
4de229297f1f
(outline-primary-bullet, outline-numbered-bullet,
Karl Heuer <kwzh@gnu.org>
parents:
13337
diff
changeset
|
2771 ;; at b-o-b or preceded by a blank line? |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2772 (or (> 0 (forward-line -1)) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2773 (looking-at "^\\s-*$") |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2774 (bobp))) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2775 (save-excursion |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2776 ;; succeeded by a blank line? |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2777 (outline-end-of-current-subtree) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2778 (bolp))) |
3430 | 2779 (and (= ref-depth 1) |
2780 (or before | |
2781 (= depth 1) | |
2782 (save-excursion | |
2783 ;; Don't already have following | |
2784 ;; vertical padding: | |
2785 (not (outline-pre-next-preface))))))) | |
2786 | |
2787 ; Position to prior heading, | |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2788 ; if inserting backwards, and |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2789 ; not going outwards: |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2790 (if (and before (>= relative-depth 0)) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2791 (progn (outline-back-to-current-heading) |
3430 | 2792 (setq doing-beginning (bobp)) |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2793 (if (not (bobp)) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2794 (outline-previous-heading))) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2795 (if (and before (bobp)) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2796 (outline-unprotected (open-line 1)))) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2797 |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2798 (if (<= relative-depth 0) |
3430 | 2799 ;; Not going inwards, don't snug up: |
2800 (if doing-beginning | |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2801 (outline-unprotected (open-line (if dbl-space 2 1))) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2802 (if before |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2803 (progn (end-of-line) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2804 (outline-pre-next-preface) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2805 (while (= ?\r (following-char)) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2806 (forward-char 1)) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2807 (if (not (looking-at "^$")) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2808 (outline-unprotected (open-line 1)))) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2809 (outline-end-of-current-subtree))) |
3430 | 2810 ;; Going inwards - double-space if first offspring is, |
2811 ;; otherwise snug up. | |
2812 (end-of-line) ; So we skip any concealed progeny. | |
2813 (outline-pre-next-preface) | |
2814 (if (bolp) | |
2815 ;; Blank lines between current header body and next | |
2816 ;; header - get to last substantive (non-white-space) | |
2817 ;; line in body: | |
2818 (re-search-backward "[^ \t\n]" nil t)) | |
2819 (if (save-excursion | |
2820 (outline-next-heading) | |
2821 (if (> (outline-recent-depth) ref-depth) | |
2822 ;; This is an offspring. | |
2823 (progn (forward-line -1) | |
2824 (looking-at "^\\s-*$")))) | |
2825 (progn (forward-line 1) | |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2826 (outline-unprotected (open-line 1)))) |
3430 | 2827 (end-of-line)) |
2828 ;;(if doing-beginning (goto-char doing-beginning)) | |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2829 (if (not (bobp)) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2830 (progn (if (and (not (> depth ref-depth)) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2831 (not before)) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2832 (outline-unprotected (open-line 1)) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2833 (if (> depth ref-depth) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2834 (outline-unprotected (newline 1)) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2835 (if dbl-space |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2836 (outline-unprotected (open-line 1)) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2837 (if (not before) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2838 (outline-unprotected (newline 1)))))) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2839 (if dbl-space |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2840 (outline-unprotected (newline 1))) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2841 (if (and (not (eobp)) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2842 (not (bolp))) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2843 (forward-char 1)))) |
3430 | 2844 )) |
2845 (insert-string (concat (outline-make-topic-prefix opening-numbered | |
2846 t | |
2847 depth) | |
2848 " ")) | |
2849 | |
2850 ;;(if doing-beginning (save-excursion (newline (if dbl-space 2 1)))) | |
2851 | |
2852 | |
29490 | 2853 (outline-rebullet-heading (and use_sib_bullet ref-bullet);;; solicit |
2854 depth ;;; depth | |
2855 nil ;;; number-control | |
2856 nil ;;; index | |
3430 | 2857 t) (end-of-line) |
2858 ) | |
2859 ) | |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2860 ;;;_ . open-topic contingencies |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2861 ;;;_ ; base topic - one from which open was issued |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2862 ;;;_ , beginning char |
13964
4de229297f1f
(outline-primary-bullet, outline-numbered-bullet,
Karl Heuer <kwzh@gnu.org>
parents:
13337
diff
changeset
|
2863 ;;;_ , amount of space before will be used, unless opening in place |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2864 ;;;_ , end char will be used, unless opening before (and it still may) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2865 ;;;_ ; absolute depth of new topic |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2866 ;;;_ ! insert in place - overrides most stuff |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2867 ;;;_ ; relative depth of new re base |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2868 ;;;_ ; before or after base topic |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2869 ;;;_ ; spacing around topic, if any, prior to new topic and at same depth |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2870 ;;;_ ; buffer boundaries - special provisions for beginning and end ob |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2871 ;;;_ ; level 1 topics have special provisions also - double space. |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2872 ;;;_ ; location of new topic |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2873 ;;;_ > outline-open-subtopic (arg) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2874 (defun outline-open-subtopic (arg) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2875 "Open new topic header at deeper level than the current one. |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2876 |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2877 Negative universal arg means to open deeper, but place the new topic |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2878 prior to the current one." |
3430 | 2879 (interactive "p") |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2880 (outline-open-topic 1 (> 0 arg))) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2881 ;;;_ > outline-open-sibtopic (arg) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2882 (defun outline-open-sibtopic (arg) |
7416
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
2883 "Open new topic header at same level as the current one. |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
2884 |
29490 | 2885 Positive universal arg means to use the bullet of the prior sibling. |
2886 | |
7416
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
2887 Negative universal arg means to place the new topic prior to the current |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2888 one." |
3430 | 2889 (interactive "p") |
29490 | 2890 (outline-open-topic 0 (> 0 arg) (< 1 arg))) |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2891 ;;;_ > outline-open-supertopic (arg) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2892 (defun outline-open-supertopic (arg) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2893 "Open new topic header at shallower level than the current one. |
7416
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
2894 |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2895 Negative universal arg means to open shallower, but place the new |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2896 topic prior to the current one." |
3430 | 2897 |
2898 (interactive "p") | |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2899 (outline-open-topic -1 (> 0 arg))) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2900 |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2901 ;;;_ - Outline Alteration |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2902 ;;;_ : Topic Modification |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2903 ;;;_ = outline-former-auto-filler |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2904 (defvar outline-former-auto-filler nil |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2905 "Name of modal fill function being wrapped by outline-auto-fill.") |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2906 ;;;_ > outline-auto-fill () |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2907 (defun outline-auto-fill () |
7416
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
2908 "Outline-mode autofill function. |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
2909 |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
2910 Maintains outline hanging topic indentation if |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
2911 `outline-use-hanging-indents' is set." |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2912 (let ((fill-prefix (if outline-use-hanging-indents |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2913 ;; Check for topic header indentation: |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2914 (save-excursion |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2915 (beginning-of-line) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2916 (if (looking-at outline-regexp) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2917 ;; ... construct indentation to account for |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2918 ;; length of topic prefix: |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2919 (make-string (progn (outline-end-of-prefix) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2920 (current-column)) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2921 ?\ )))))) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2922 (if (or outline-former-auto-filler outline-use-hanging-indents) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2923 (do-auto-fill)))) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2924 ;;;_ > outline-reindent-body (old-depth new-depth &optional number) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2925 (defun outline-reindent-body (old-depth new-depth &optional number) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2926 "Reindent body lines which were indented at old-depth to new-depth. |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2927 |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2928 Optional arg NUMBER indicates numbering is being added, and it must |
13964
4de229297f1f
(outline-primary-bullet, outline-numbered-bullet,
Karl Heuer <kwzh@gnu.org>
parents:
13337
diff
changeset
|
2929 be accommodated. |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2930 |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2931 Note that refill of indented paragraphs is not done." |
3430 | 2932 |
2933 (save-excursion | |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2934 (outline-end-of-prefix) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2935 (let* ((new-margin (current-column)) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2936 excess old-indent-begin old-indent-end |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2937 curr-ind |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2938 ;; We want the column where the header-prefix text started |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2939 ;; *before* the prefix was changed, so we infer it relative |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2940 ;; to the new margin and the shift in depth: |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2941 (old-margin (+ old-depth (- new-margin new-depth)))) |
15664
a50ebf4ac764
(outline-auto-activation, outline-layout)
Karl Heuer <kwzh@gnu.org>
parents:
15663
diff
changeset
|
2942 |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2943 ;; Process lines up to (but excluding) next topic header: |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2944 (outline-unprotected |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2945 (save-match-data |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2946 (while |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2947 (and (re-search-forward "[\n\r]\\(\\s-*\\)" |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2948 nil |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2949 t) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2950 ;; Register the indent data, before we reset the |
15664
a50ebf4ac764
(outline-auto-activation, outline-layout)
Karl Heuer <kwzh@gnu.org>
parents:
15663
diff
changeset
|
2951 ;; match data with a subsequent `looking-at': |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2952 (setq old-indent-begin (match-beginning 1) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2953 old-indent-end (match-end 1)) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2954 (not (looking-at outline-regexp))) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2955 (if (> 0 (setq excess (- (current-column) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2956 old-margin))) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2957 ;; Text starts left of old margin - don't adjust: |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2958 nil |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2959 ;; Text was hanging at or right of old left margin - |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2960 ;; reindent it, preserving its existing indentation |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2961 ;; beyond the old margin: |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2962 (delete-region old-indent-begin old-indent-end) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2963 (indent-to (+ new-margin excess))))))))) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2964 ;;;_ > outline-rebullet-current-heading (arg) |
3430 | 2965 (defun outline-rebullet-current-heading (arg) |
29490 | 2966 "Solicit new bullet for current visible heading." |
2967 (interactive "p") | |
2968 (let ((initial-col (current-column)) | |
2969 (on-bullet (eq (point)(outline-current-bullet-pos))) | |
2970 (backwards (if (< arg 0) | |
2971 (setq arg (* arg -1))))) | |
2972 (while (> arg 0) | |
2973 (save-excursion (outline-back-to-current-heading) | |
2974 (outline-end-of-prefix) | |
2975 (outline-rebullet-heading t ;;; solicit | |
2976 nil ;;; depth | |
2977 nil ;;; number-control | |
2978 nil ;;; index | |
2979 t)) ;;; do-successors | |
2980 (setq arg (1- arg)) | |
2981 (if (<= arg 0) | |
2982 nil | |
2983 (setq initial-col nil) ; Override positioning back to init col | |
2984 (if (not backwards) | |
2985 (outline-next-visible-heading 1) | |
2986 (outline-goto-prefix) | |
2987 (outline-next-visible-heading -1)))) | |
2988 (message "Done.") | |
2989 (cond (on-bullet (goto-char (outline-current-bullet-pos))) | |
2990 (initial-col (move-to-column initial-col))))) | |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2991 ;;;_ > outline-rebullet-heading (&optional solicit ...) |
3430 | 2992 (defun outline-rebullet-heading (&optional solicit |
2993 new-depth | |
2994 number-control | |
2995 index | |
2996 do-successors) | |
2997 | |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2998 "Adjust bullet of current topic prefix. |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2999 |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3000 All args are optional. |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3001 |
29490 | 3002 If SOLICIT is non-nil, then the choice of bullet is solicited from |
3003 user. If it's a character, then that character is offered as the | |
3004 default, otherwise the one suited to the context \(according to | |
3005 distinction or depth) is offered. If non-nil, then the | |
3006 context-specific bullet is just used. | |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3007 |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3008 Second arg DEPTH forces the topic prefix to that depth, regardless |
29490 | 3009 of the topic's current depth. |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3010 |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3011 Third arg NUMBER-CONTROL can force the prefix to or away from |
15664
a50ebf4ac764
(outline-auto-activation, outline-layout)
Karl Heuer <kwzh@gnu.org>
parents:
15663
diff
changeset
|
3012 numbered form. It has effect only if `outline-numbered-bullet' is |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3013 non-nil and soliciting was not explicitly invoked (via first arg). |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3014 Its effect, numbering or denumbering, then depends on the setting |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3015 of the forth arg, INDEX. |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3016 |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3017 If NUMBER-CONTROL is non-nil and forth arg INDEX is nil, then the |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3018 prefix of the topic is forced to be non-numbered. Null index and |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3019 non-nil NUMBER-CONTROL forces denumbering. Non-nil INDEX (and |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3020 non-nil NUMBER-CONTROL) forces a numbered-prefix form. If non-nil |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3021 INDEX is a number, then that number is used for the numbered |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3022 prefix. Non-nil and non-number means that the index for the |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3023 numbered prefix will be derived by outline-make-topic-prefix. |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3024 |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3025 Fifth arg DO-SUCCESSORS t means re-resolve count on succeeding |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3026 siblings. |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3027 |
15664
a50ebf4ac764
(outline-auto-activation, outline-layout)
Karl Heuer <kwzh@gnu.org>
parents:
15663
diff
changeset
|
3028 Cf vars `outline-stylish-prefixes', `outline-old-style-prefixes', |
a50ebf4ac764
(outline-auto-activation, outline-layout)
Karl Heuer <kwzh@gnu.org>
parents:
15663
diff
changeset
|
3029 and `outline-numbered-bullet', which all affect the behavior of |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3030 this function." |
3430 | 3031 |
3032 (let* ((current-depth (outline-depth)) | |
3033 (new-depth (or new-depth current-depth)) | |
3034 (mb outline-recent-prefix-beginning) | |
3035 (me outline-recent-prefix-end) | |
3036 (current-bullet (buffer-substring (- me 1) me)) | |
3037 (new-prefix (outline-make-topic-prefix current-bullet | |
3038 nil | |
3039 new-depth | |
3040 solicit | |
3041 number-control | |
3042 index))) | |
3043 | |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3044 ;; Is new one is identical to old? |
3430 | 3045 (if (and (= current-depth new-depth) |
3046 (string= current-bullet | |
3047 (substring new-prefix (1- (length new-prefix))))) | |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3048 ;; Nothing to do: |
3430 | 3049 t |
3050 | |
3051 ;; New prefix probably different from old: | |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3052 ; get rid of old one: |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3053 (outline-unprotected (delete-region mb me)) |
3430 | 3054 (goto-char mb) |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3055 ; Dispense with number if |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3056 ; numbered-bullet prefix: |
3430 | 3057 (if (and outline-numbered-bullet |
3058 (string= outline-numbered-bullet current-bullet) | |
3059 (looking-at "[0-9]+")) | |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3060 (outline-unprotected |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3061 (delete-region (match-beginning 0)(match-end 0)))) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3062 |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3063 ; Put in new prefix: |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3064 (outline-unprotected (insert-string new-prefix)) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3065 |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3066 ;; Reindent the body if elected and margin changed: |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3067 (if (and outline-reindent-bodies |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3068 (not (= new-depth current-depth))) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3069 (outline-reindent-body current-depth new-depth)) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3070 |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3071 ;; Recursively rectify successive siblings of orig topic if |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3072 ;; caller elected for it: |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3073 (if do-successors |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3074 (save-excursion |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3075 (while (outline-next-sibling new-depth nil) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3076 (setq index |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3077 (cond ((numberp index) (1+ index)) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3078 ((not number-control) (outline-sibling-index)))) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3079 (if (outline-numbered-type-prefix) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3080 (outline-rebullet-heading nil ;;; solicit |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3081 new-depth ;;; new-depth |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3082 number-control;;; number-control |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3083 index ;;; index |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3084 nil))))) ;;;(dont!)do-successors |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3085 ) ; (if (and (= current-depth new-depth)...)) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3086 ) ; let* ((current-depth (outline-depth))...) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3087 ) ; defun |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3088 ;;;_ > outline-rebullet-topic (arg) |
3430 | 3089 (defun outline-rebullet-topic (arg) |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3090 "Like outline-rebullet-topic-grunt, but start from topic visible at point. |
7416
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
3091 |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3092 Descends into invisible as well as visible topics, however. |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3093 |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3094 With repeat count, shift topic depth by that amount." |
3430 | 3095 (interactive "P") |
3096 (let ((start-col (current-column)) | |
3097 (was-eol (eolp))) | |
3098 (save-excursion | |
3099 ;; Normalize arg: | |
3100 (cond ((null arg) (setq arg 0)) | |
3101 ((listp arg) (setq arg (car arg)))) | |
3102 ;; Fill the user in, in case we're shifting a big topic: | |
3103 (if (not (zerop arg)) (message "Shifting...")) | |
3104 (outline-back-to-current-heading) | |
3105 (if (<= (+ (outline-recent-depth) arg) 0) | |
3106 (error "Attempt to shift topic below level 1")) | |
3107 (outline-rebullet-topic-grunt arg) | |
3108 (if (not (zerop arg)) (message "Shifting... done."))) | |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3109 (move-to-column (max 0 (+ start-col arg))))) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3110 ;;;_ > outline-rebullet-topic-grunt (&optional relative-depth ...) |
3430 | 3111 (defun outline-rebullet-topic-grunt (&optional relative-depth |
3112 starting-depth | |
3113 starting-point | |
3114 index | |
3115 do-successors) | |
3116 | |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3117 "Rebullet the topic at point, visible or invisible, and all |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3118 contained subtopics. See outline-rebullet-heading for rebulleting |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3119 behavior. |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3120 |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3121 All arguments are optional. |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3122 |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3123 First arg RELATIVE-DEPTH means to shift the depth of the entire |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3124 topic that amount. |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3125 |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3126 The rest of the args are for internal recursive use by the function |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3127 itself. The are STARTING-DEPTH, STARTING-POINT, and INDEX." |
3430 | 3128 |
3129 (let* ((relative-depth (or relative-depth 0)) | |
3130 (new-depth (outline-depth)) | |
3131 (starting-depth (or starting-depth new-depth)) | |
3132 (on-starting-call (null starting-point)) | |
3133 (index (or index | |
3134 ;; Leave index null on starting call, so rebullet-heading | |
3135 ;; calculates it at what might be new depth: | |
3136 (and (or (zerop relative-depth) | |
3137 (not on-starting-call)) | |
3138 (outline-sibling-index)))) | |
3139 (moving-outwards (< 0 relative-depth)) | |
3140 (starting-point (or starting-point (point)))) | |
3141 | |
3142 ;; Sanity check for excessive promotion done only on starting call: | |
3143 (and on-starting-call | |
3144 moving-outwards | |
3145 (> 0 (+ starting-depth relative-depth)) | |
3146 (error "Attempt to shift topic out beyond level 1.")) ;;; ====> | |
3147 | |
3148 (cond ((= starting-depth new-depth) | |
3149 ;; We're at depth to work on this one: | |
3150 (outline-rebullet-heading nil ;;; solicit | |
3151 (+ starting-depth ;;; starting-depth | |
3152 relative-depth) | |
3153 nil ;;; number | |
3154 index ;;; index | |
3155 ;; Every contained topic will get hit, | |
3156 ;; and we have to get to outside ones | |
3157 ;; deliberately: | |
3158 nil) ;;; do-successors | |
3159 ;; ... and work on subsequent ones which are at greater depth: | |
3160 (setq index 0) | |
3161 (outline-next-heading) | |
3162 (while (and (not (eobp)) | |
3163 (< starting-depth (outline-recent-depth))) | |
3164 (setq index (1+ index)) | |
3165 (outline-rebullet-topic-grunt relative-depth ;;; relative-depth | |
3166 (1+ starting-depth);;;starting-depth | |
3167 starting-point ;;; starting-point | |
3168 index))) ;;; index | |
3169 | |
3170 ((< starting-depth new-depth) | |
3171 ;; Rare case - subtopic more than one level deeper than parent. | |
3172 ;; Treat this one at an even deeper level: | |
3173 (outline-rebullet-topic-grunt relative-depth ;;; relative-depth | |
3174 new-depth ;;; starting-depth | |
3175 starting-point ;;; starting-point | |
3176 index))) ;;; index | |
3177 | |
3178 (if on-starting-call | |
3179 (progn | |
3180 ;; Rectify numbering of former siblings of the adjusted topic, | |
3181 ;; if topic has changed depth | |
3182 (if (or do-successors | |
3183 (and (not (zerop relative-depth)) | |
3184 (or (= (outline-recent-depth) starting-depth) | |
3185 (= (outline-recent-depth) (+ starting-depth | |
3186 relative-depth))))) | |
3187 (outline-rebullet-heading nil nil nil nil t)) | |
3188 ;; Now rectify numbering of new siblings of the adjusted topic, | |
3189 ;; if depth has been changed: | |
3190 (progn (goto-char starting-point) | |
3191 (if (not (zerop relative-depth)) | |
3192 (outline-rebullet-heading nil nil nil nil t))))) | |
3193 ) | |
3194 ) | |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3195 ;;;_ > outline-renumber-to-depth (&optional depth) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3196 (defun outline-renumber-to-depth (&optional depth) |
7416
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
3197 "Renumber siblings at current depth. |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
3198 |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
3199 Affects superior topics if optional arg DEPTH is less than current depth. |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3200 |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3201 Returns final depth." |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3202 |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3203 ;; Proceed by level, processing subsequent siblings on each, |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3204 ;; ascending until we get shallower than the start depth: |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3205 |
29490 | 3206 (let ((ascender (outline-depth)) |
3207 was-eobp) | |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3208 (while (and (not (eobp)) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3209 (outline-depth) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3210 (>= (outline-recent-depth) depth) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3211 (>= ascender depth)) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3212 ; Skip over all topics at |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3213 ; lesser depths, which can not |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3214 ; have been disturbed: |
29490 | 3215 (while (and (not (setq was-eobp (eobp))) |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3216 (> (outline-recent-depth) ascender)) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3217 (outline-next-heading)) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3218 ; Prime ascender for ascension: |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3219 (setq ascender (1- (outline-recent-depth))) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3220 (if (>= (outline-recent-depth) depth) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3221 (outline-rebullet-heading nil ;;; solicit |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3222 nil ;;; depth |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3223 nil ;;; number-control |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3224 nil ;;; index |
29490 | 3225 t)) ;;; do-successors |
3226 (if was-eobp (goto-char (point-max))))) | |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3227 (outline-recent-depth)) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3228 ;;;_ > outline-number-siblings (&optional denumber) |
3430 | 3229 (defun outline-number-siblings (&optional denumber) |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3230 "Assign numbered topic prefix to this topic and its siblings. |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3231 |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3232 With universal argument, denumber - assign default bullet to this |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3233 topic and its siblings. |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3234 |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3235 With repeated universal argument (`^U^U'), solicit bullet for each |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3236 rebulleting each topic at this level." |
3430 | 3237 |
3238 (interactive "P") | |
3239 | |
3240 (save-excursion | |
3241 (outline-back-to-current-heading) | |
3242 (outline-beginning-of-level) | |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3243 (let ((depth (outline-recent-depth)) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3244 (index (if (not denumber) 1)) |
3430 | 3245 (use-bullet (equal '(16) denumber)) |
3246 (more t)) | |
3247 (while more | |
3248 (outline-rebullet-heading use-bullet ;;; solicit | |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3249 depth ;;; depth |
3430 | 3250 t ;;; number-control |
3251 index ;;; index | |
3252 nil) ;;; do-successors | |
3253 (if index (setq index (1+ index))) | |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3254 (setq more (outline-next-sibling depth nil)))))) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3255 ;;;_ > outline-shift-in (arg) |
3430 | 3256 (defun outline-shift-in (arg) |
7416
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
3257 "Increase depth of current heading and any topics collapsed within it." |
3430 | 3258 (interactive "p") |
3259 (outline-rebullet-topic arg)) | |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3260 ;;;_ > outline-shift-out (arg) |
3430 | 3261 (defun outline-shift-out (arg) |
7416
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
3262 "Decrease depth of current heading and any topics collapsed within it." |
3430 | 3263 (interactive "p") |
3264 (outline-rebullet-topic (* arg -1))) | |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3265 ;;;_ : Surgery (kill-ring) functions with special provisions for outlines: |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3266 ;;;_ > outline-kill-line (&optional arg) |
3430 | 3267 (defun outline-kill-line (&optional arg) |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3268 "Kill line, adjusting subsequent lines suitably for outline mode." |
3430 | 3269 |
3270 (interactive "*P") | |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3271 (if (not (and (outline-mode-p) ; active outline mode, |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3272 outline-numbered-bullet ; numbers may need adjustment, |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3273 (bolp) ; may be clipping topic head, |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3274 (looking-at outline-regexp))) ; are clipping topic head. |
3430 | 3275 ;; Above conditions do not obtain - just do a regular kill: |
3276 (kill-line arg) | |
3277 ;; Ah, have to watch out for adjustments: | |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3278 (let* ((depth (outline-depth))) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3279 ; Do the kill: |
3430 | 3280 (kill-line arg) |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3281 ; Provide some feedback: |
3430 | 3282 (sit-for 0) |
3283 (save-excursion | |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3284 ; Start with the topic |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3285 ; following killed line: |
3430 | 3286 (if (not (looking-at outline-regexp)) |
3287 (outline-next-heading)) | |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3288 (outline-renumber-to-depth depth))))) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3289 ;;;_ > outline-kill-topic () |
3430 | 3290 (defun outline-kill-topic () |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3291 "Kill topic together with subtopics. |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3292 |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3293 Leaves primary topic's trailing vertical whitespace, if any." |
3430 | 3294 |
3295 ;; Some finagling is done to make complex topic kills appear faster | |
3296 ;; than they actually are. A redisplay is performed immediately | |
3297 ;; after the region is disposed of, though the renumbering process | |
3298 ;; has yet to be performed. This means that there may appear to be | |
3299 ;; a lag *after* the kill has been performed. | |
3300 | |
3301 (interactive) | |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3302 (let* ((beg (prog1 (outline-back-to-current-heading)(beginning-of-line))) |
3430 | 3303 (depth (outline-recent-depth))) |
3304 (outline-end-of-current-subtree) | |
3305 (if (not (eobp)) | |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3306 (if (or (not (looking-at "^$")) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3307 ;; A blank line - cut it with this topic *unless* this |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3308 ;; is the last topic at this level, in which case |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3309 ;; we'll leave the blank line as part of the |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3310 ;; containing topic: |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3311 (save-excursion |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3312 (and (outline-next-heading) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3313 (>= (outline-recent-depth) depth)))) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3314 (forward-char 1))) |
15664
a50ebf4ac764
(outline-auto-activation, outline-layout)
Karl Heuer <kwzh@gnu.org>
parents:
15663
diff
changeset
|
3315 |
3430 | 3316 (kill-region beg (point)) |
3317 (sit-for 0) | |
3318 (save-excursion | |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3319 (outline-renumber-to-depth depth)))) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3320 ;;;_ > outline-yank-processing () |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3321 (defun outline-yank-processing (&optional arg) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3322 |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3323 "Incidental outline-specific business to be done just after text yanks. |
7416
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
3324 |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3325 Does depth adjustment of yanked topics, when: |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3326 |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3327 1 the stuff being yanked starts with a valid outline header prefix, and |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3328 2 it is being yanked at the end of a line which consists of only a valid |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3329 topic prefix. |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3330 |
13964
4de229297f1f
(outline-primary-bullet, outline-numbered-bullet,
Karl Heuer <kwzh@gnu.org>
parents:
13337
diff
changeset
|
3331 Also, adjusts numbering of subsequent siblings when appropriate. |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3332 |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3333 Depth adjustment alters the depth of all the topics being yanked |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3334 the amount it takes to make the first topic have the depth of the |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3335 header into which it's being yanked. |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3336 |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3337 The point is left in front of yanked, adjusted topics, rather than |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3338 at the end (and vice-versa with the mark). Non-adjusted yanks, |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3339 however, are left exactly like normal, non-outline-specific yanks." |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3340 |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3341 (interactive "*P") |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3342 ; Get to beginning, leaving |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3343 ; region around subject: |
29490 | 3344 (if (< (my-mark-marker t) (point)) |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3345 (exchange-point-and-mark)) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3346 (let* ((subj-beg (point)) |
29490 | 3347 (subj-end (my-mark-marker t)) |
3348 ;; 'resituate' if yanking an entire topic into topic header: | |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3349 (resituate (and (outline-e-o-prefix-p) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3350 (looking-at (concat "\\(" outline-regexp "\\)")) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3351 (outline-prefix-data (match-beginning 1) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3352 (match-end 1)))) |
15664
a50ebf4ac764
(outline-auto-activation, outline-layout)
Karl Heuer <kwzh@gnu.org>
parents:
15663
diff
changeset
|
3353 ;; `rectify-numbering' if resituating (where several topics may |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3354 ;; be resituating) or yanking a topic into a topic slot (bol): |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3355 (rectify-numbering (or resituate |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3356 (and (bolp) (looking-at outline-regexp))))) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3357 (if resituate |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3358 ; The yanked stuff is a topic: |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3359 (let* ((prefix-len (- (match-end 1) subj-beg)) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3360 (subj-depth (outline-recent-depth)) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3361 (prefix-bullet (outline-recent-bullet)) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3362 (adjust-to-depth |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3363 ;; Nil if adjustment unnecessary, otherwise depth to which |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3364 ;; adjustment should be made: |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3365 (save-excursion |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3366 (and (goto-char subj-end) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3367 (eolp) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3368 (goto-char subj-beg) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3369 (and (looking-at outline-regexp) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3370 (progn |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3371 (beginning-of-line) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3372 (not (= (point) subj-beg))) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3373 (looking-at outline-regexp) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3374 (outline-prefix-data (match-beginning 0) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3375 (match-end 0))) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3376 (outline-recent-depth)))) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3377 done |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3378 (more t)) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3379 (setq rectify-numbering outline-numbered-bullet) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3380 (if adjust-to-depth |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3381 ; Do the adjustment: |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3382 (progn |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3383 (message "... yanking") (sit-for 0) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3384 (save-restriction |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3385 (narrow-to-region subj-beg subj-end) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3386 ; Trim off excessive blank |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3387 ; line at end, if any: |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3388 (goto-char (point-max)) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3389 (if (looking-at "^$") |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3390 (outline-unprotected (delete-char -1))) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3391 ; Work backwards, with each |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3392 ; shallowest level, |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3393 ; successively excluding the |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3394 ; last processed topic from |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3395 ; the narrow region: |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3396 (while more |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3397 (outline-back-to-current-heading) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3398 ; go as high as we can in each bunch: |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3399 (while (outline-ascend-to-depth (1- (outline-depth)))) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3400 (save-excursion |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3401 (outline-rebullet-topic-grunt (- adjust-to-depth |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3402 subj-depth)) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3403 (outline-depth)) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3404 (if (setq more (not (bobp))) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3405 (progn (widen) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3406 (forward-char -1) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3407 (narrow-to-region subj-beg (point)))))) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3408 (message "") |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3409 ;; Preserve new bullet if it's a distinctive one, otherwise |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3410 ;; use old one: |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3411 (if (string-match (regexp-quote prefix-bullet) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3412 outline-distinctive-bullets-string) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3413 ; Delete from bullet of old to |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3414 ; before bullet of new: |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3415 (progn |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3416 (beginning-of-line) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3417 (delete-region (point) subj-beg) |
29490 | 3418 (set-marker (my-mark-marker t) subj-end) |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3419 (goto-char subj-beg) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3420 (outline-end-of-prefix)) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3421 ; Delete base subj prefix, |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3422 ; leaving old one: |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3423 (delete-region (point) (+ (point) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3424 prefix-len |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3425 (- adjust-to-depth subj-depth))) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3426 ; and delete residual subj |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3427 ; prefix digits and space: |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3428 (while (looking-at "[0-9]") (delete-char 1)) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3429 (if (looking-at " ") (delete-char 1)))) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3430 (exchange-point-and-mark)))) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3431 (if rectify-numbering |
15664
a50ebf4ac764
(outline-auto-activation, outline-layout)
Karl Heuer <kwzh@gnu.org>
parents:
15663
diff
changeset
|
3432 (progn |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3433 (save-excursion |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3434 ; Give some preliminary feedback: |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3435 (message "... reconciling numbers") (sit-for 0) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3436 ; ... and renumber, in case necessary: |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3437 (goto-char subj-beg) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3438 (if (outline-goto-prefix) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3439 (outline-rebullet-heading nil ;;; solicit |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3440 (outline-depth) ;;; depth |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3441 nil ;;; number-control |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3442 nil ;;; index |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3443 t)) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3444 (message "")))) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3445 (if (not resituate) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3446 (exchange-point-and-mark)))) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3447 ;;;_ > outline-yank (&optional arg) |
3430 | 3448 (defun outline-yank (&optional arg) |
7416
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
3449 "Outline-mode yank, with depth and numbering adjustment of yanked topics. |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
3450 |
13964
4de229297f1f
(outline-primary-bullet, outline-numbered-bullet,
Karl Heuer <kwzh@gnu.org>
parents:
13337
diff
changeset
|
3451 Non-topic yanks work no differently than normal yanks. |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3452 |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3453 If a topic is being yanked into a bare topic prefix, the depth of the |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3454 yanked topic is adjusted to the depth of the topic prefix. |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3455 |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3456 1 we're yanking in an outline-mode buffer |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3457 2 the stuff being yanked starts with a valid outline header prefix, and |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3458 3 it is being yanked at the end of a line which consists of only a valid |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3459 topic prefix. |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3460 |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3461 If these conditions hold then the depth of the yanked topics are all |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3462 adjusted the amount it takes to make the first one at the depth of the |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3463 header into which it's being yanked. |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3464 |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3465 The point is left in front of yanked, adjusted topics, rather than |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3466 at the end (and vice-versa with the mark). Non-adjusted yanks, |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3467 however, (ones that don't qualify for adjustment) are handled |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3468 exactly like normal yanks. |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3469 |
13964
4de229297f1f
(outline-primary-bullet, outline-numbered-bullet,
Karl Heuer <kwzh@gnu.org>
parents:
13337
diff
changeset
|
3470 Numbering of yanked topics, and the successive siblings at the depth |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3471 into which they're being yanked, is adjusted. |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3472 |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3473 Outline-yank-pop works with outline-yank just like normal yank-pop |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3474 works with normal yank in non-outline buffers." |
3430 | 3475 |
3476 (interactive "*P") | |
3477 (setq this-command 'yank) | |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3478 (yank arg) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3479 (if (outline-mode-p) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3480 (outline-yank-processing))) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3481 ;;;_ > outline-yank-pop (&optional arg) |
3430 | 3482 (defun outline-yank-pop (&optional arg) |
7416
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
3483 "Yank-pop like outline-yank when popping to bare outline prefixes. |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
3484 |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
3485 Adapts level of popped topics to level of fresh prefix. |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3486 |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3487 Note - prefix changes to distinctive bullets will stick, if followed |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3488 by pops to non-distinctive yanks. Bug..." |
3430 | 3489 |
3490 (interactive "*p") | |
3491 (setq this-command 'yank) | |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3492 (yank-pop arg) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3493 (if (outline-mode-p) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3494 (outline-yank-processing))) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3495 |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3496 ;;;_ - Specialty bullet functions |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3497 ;;;_ : File Cross references |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3498 ;;;_ > outline-resolve-xref () |
3430 | 3499 (defun outline-resolve-xref () |
7416
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
3500 "Pop to file associated with current heading, if it has an xref bullet. |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
3501 |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
3502 \(Works according to setting of `outline-file-xref-bullet')." |
3430 | 3503 (interactive) |
3504 (if (not outline-file-xref-bullet) | |
3505 (error | |
15664
a50ebf4ac764
(outline-auto-activation, outline-layout)
Karl Heuer <kwzh@gnu.org>
parents:
15663
diff
changeset
|
3506 "outline cross references disabled - no `outline-file-xref-bullet'") |
3430 | 3507 (if (not (string= (outline-current-bullet) outline-file-xref-bullet)) |
15664
a50ebf4ac764
(outline-auto-activation, outline-layout)
Karl Heuer <kwzh@gnu.org>
parents:
15663
diff
changeset
|
3508 (error "current heading lacks cross-reference bullet `%s'" |
3430 | 3509 outline-file-xref-bullet) |
3510 (let (file-name) | |
3511 (save-excursion | |
3512 (let* ((text-start outline-recent-prefix-end) | |
15663
4f762e6ae80a
(outline-resolve-xref): Do not mistake a blank line
Karl Heuer <kwzh@gnu.org>
parents:
14416
diff
changeset
|
3513 (heading-end (progn (end-of-line) (point)))) |
3430 | 3514 (goto-char text-start) |
3515 (setq file-name | |
3516 (if (re-search-forward "\\s-\\(\\S-*\\)" heading-end t) | |
3517 (buffer-substring (match-beginning 1) (match-end 1)))))) | |
3518 (setq file-name | |
3519 (if (not (= (aref file-name 0) ?:)) | |
3520 (expand-file-name file-name) | |
15664
a50ebf4ac764
(outline-auto-activation, outline-layout)
Karl Heuer <kwzh@gnu.org>
parents:
15663
diff
changeset
|
3521 ; A registry-files ref, strip the `:' |
3430 | 3522 ; and try to follow it: |
3523 (let ((reg-ref (reference-registered-file | |
3524 (substring file-name 1) nil t))) | |
3525 (if reg-ref (car (cdr reg-ref)))))) | |
3526 (if (or (file-exists-p file-name) | |
3527 (if (file-writable-p file-name) | |
3528 (y-or-n-p (format "%s not there, create one? " | |
3529 file-name)) | |
3530 (error "%s not found and can't be created" file-name))) | |
3531 (condition-case failure | |
3532 (find-file-other-window file-name) | |
29490 | 3533 ('error failure)) |
3430 | 3534 (error "%s not found" file-name)) |
3535 ) | |
3536 ) | |
3537 ) | |
3538 ) | |
7416
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
3539 |
29490 | 3540 ;;;_ #6 Exposure Control |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3541 |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3542 ;;;_ - Fundamental |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3543 ;;;_ > outline-flag-current-subtree (flag) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3544 (defun outline-flag-current-subtree (flag) |
7416
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
3545 "Hide or show subtree of currently-visible topic. |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
3546 |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
3547 See `outline-flag-region' for more details." |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
3548 |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3549 (save-excursion |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3550 (outline-back-to-current-heading) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3551 (outline-flag-region (point) |
7416
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
3552 (progn (outline-end-of-current-subtree) (1- (point))) |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
3553 flag))) |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3554 |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3555 ;;;_ - Topic-specific |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3556 ;;;_ > outline-show-entry () |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3557 (defun outline-show-entry () |
7416
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
3558 "Like `outline-show-current-entry', reveals entries nested in hidden topics. |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3559 |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3560 This is a way to give restricted peek at a concealed locality without the |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3561 expense of exposing its context, but can leave the outline with aberrant |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3562 exposure. outline-hide-current-entry-completely or outline-show-offshoot |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3563 should be used after the peek to rectify the exposure." |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3564 |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3565 (interactive) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3566 (save-excursion |
29490 | 3567 (let ((at (point)) |
3568 beg end) | |
3569 (outline-goto-prefix) | |
3570 (setq beg (if (= (preceding-char) ?\r) (1- (point)) (point))) | |
3571 (re-search-forward "[\n\r]" nil t) | |
3572 (setq end (1- (if (< at (point)) | |
3573 ;; We're on topic head line - show only it: | |
3574 (point) | |
3575 ;; or we're in body - include it: | |
3576 (max beg (or (outline-pre-next-preface) (point)))))) | |
3577 (outline-flag-region beg end ?\n) | |
3578 (list beg end)))) | |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3579 ;;;_ > outline-show-children (&optional level strict) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3580 (defun outline-show-children (&optional level strict) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3581 |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3582 "If point is visible, show all direct subheadings of this heading. |
7416
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
3583 |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3584 Otherwise, do outline-show-to-offshoot, and then show subheadings. |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3585 |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3586 Optional LEVEL specifies how many levels below the current level |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3587 should be shown, or all levels if t. Default is 1. |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3588 |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3589 Optional STRICT means don't resort to -show-to-offshoot, no matter |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3590 what. This is basically so -show-to-offshoot, which is called by |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3591 this function, can employ the pure offspring-revealing capabilities of |
7416
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
3592 it. |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
3593 |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
3594 Returns point at end of subtree that was opened, if any. (May get a |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
3595 point of non-opened subtree?)" |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3596 |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3597 (interactive "p") |
7416
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
3598 (let (max-pos) |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
3599 (if (and (not strict) |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
3600 (outline-hidden-p)) |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
3601 |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
3602 (progn (outline-show-to-offshoot) ; Point's concealed, open to |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
3603 ; expose it. |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
3604 ;; Then recurse, but with "strict" set so we don't |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
3605 ;; infinite regress: |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
3606 (setq max-pos (outline-show-children level t))) |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
3607 |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
3608 (save-excursion |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
3609 (save-restriction |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
3610 (let* ((start-pt (point)) |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
3611 (chart (outline-chart-subtree (or level 1))) |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
3612 (to-reveal (outline-chart-to-reveal chart (or level 1)))) |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
3613 (goto-char start-pt) |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
3614 (if (and strict (= (preceding-char) ?\r)) |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
3615 ;; Concealed root would already have been taken care of, |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
3616 ;; unless strict was set. |
29490 | 3617 (progn |
3618 (outline-flag-region (point) (outline-snug-back) ?\n) | |
3619 (if outline-show-bodies | |
3620 (progn (goto-char (car to-reveal)) | |
3621 (outline-show-current-entry))))) | |
7416
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
3622 (while to-reveal |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
3623 (goto-char (car to-reveal)) |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
3624 (outline-flag-region (point) (outline-snug-back) ?\n) |
29490 | 3625 (if outline-show-bodies |
3626 (progn (goto-char (car to-reveal)) | |
3627 (outline-show-current-entry))) | |
7416
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
3628 (setq to-reveal (cdr to-reveal))))))))) |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3629 ;;;_ > outline-hide-point-reconcile () |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3630 (defun outline-hide-reconcile () |
7416
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
3631 "Like `outline-hide-current-entry'; hides completely if within hidden region. |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3632 |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3633 Specifically intended for aberrant exposure states, like entries that were |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3634 exposed by outline-show-entry but are within otherwise concealed regions." |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3635 (interactive) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3636 (save-excursion |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3637 (outline-goto-prefix) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3638 (outline-flag-region (if (not (bobp)) (1- (point)) (point)) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3639 (progn (outline-pre-next-preface) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3640 (if (= ?\r (following-char)) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3641 (point) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3642 (1- (point)))) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3643 ?\r))) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3644 ;;;_ > outline-show-to-offshoot () |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3645 (defun outline-show-to-offshoot () |
29490 | 3646 "Like outline-show-entry, but reveals all concealed ancestors, as well. |
7416
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
3647 |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
3648 As with outline-hide-current-entry-completely, useful for rectifying |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
3649 aberrant exposure states produced by outline-show-entry." |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3650 |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3651 (interactive) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3652 (save-excursion |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3653 (let ((orig-pt (point)) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3654 (orig-pref (outline-goto-prefix)) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3655 (last-at (point)) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3656 bag-it) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3657 (while (or bag-it (= (preceding-char) ?\r)) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3658 (beginning-of-line) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3659 (if (= last-at (setq last-at (point))) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3660 ;; Oops, we're not making any progress! Show the current |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3661 ;; topic completely, and bag this try. |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3662 (progn (beginning-of-line) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3663 (outline-show-current-subtree) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3664 (goto-char orig-pt) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3665 (setq bag-it t) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3666 (beep) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3667 (message "%s: %s" |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3668 "outline-show-to-offshoot: " |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3669 "Aberrant nesting encountered."))) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3670 (outline-show-children) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3671 (goto-char orig-pref)) |
7416
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
3672 (goto-char orig-pt))) |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
3673 (if (outline-hidden-p) |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
3674 (outline-show-entry))) |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3675 ;;;_ > outline-hide-current-entry () |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3676 (defun outline-hide-current-entry () |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3677 "Hide the body directly following this heading." |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3678 (interactive) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3679 (outline-back-to-current-heading) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3680 (save-excursion |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3681 (outline-flag-region (point) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3682 (progn (outline-end-of-current-entry) (point)) |
29490 | 3683 ?\r))) |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3684 ;;;_ > outline-show-current-entry (&optional arg) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3685 (defun outline-show-current-entry (&optional arg) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3686 |
7416
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
3687 "Show body following current heading, or hide the entry if repeat count." |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3688 |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3689 (interactive "P") |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3690 (if arg |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3691 (outline-hide-current-entry) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3692 (save-excursion |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3693 (outline-flag-region (point) |
7416
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
3694 (progn (outline-end-of-current-entry) (point)) |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
3695 ?\n)))) |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3696 ;;;_ > outline-hide-current-entry-completely () |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3697 ; ... outline-hide-current-entry-completely also for isearch dynamic exposure: |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3698 (defun outline-hide-current-entry-completely () |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3699 "Like outline-hide-current-entry, but conceal topic completely. |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3700 |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3701 Specifically intended for aberrant exposure states, like entries that were |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3702 exposed by outline-show-entry but are within otherwise concealed regions." |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3703 (interactive) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3704 (save-excursion |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3705 (outline-goto-prefix) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3706 (outline-flag-region (if (not (bobp)) (1- (point)) (point)) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3707 (progn (outline-pre-next-preface) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3708 (if (= ?\r (following-char)) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3709 (point) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3710 (1- (point)))) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3711 ?\r))) |
7416
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
3712 ;;;_ > outline-show-current-subtree (&optional arg) |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
3713 (defun outline-show-current-subtree (&optional arg) |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
3714 "Show everything within the current topic. With a repeat-count, |
15664
a50ebf4ac764
(outline-auto-activation, outline-layout)
Karl Heuer <kwzh@gnu.org>
parents:
15663
diff
changeset
|
3715 expose this topic and its siblings." |
7416
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
3716 (interactive "P") |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
3717 (save-excursion |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
3718 (if (<= (outline-current-depth) 0) |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
3719 ;; Outside any topics - try to get to the first: |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
3720 (if (not (outline-next-heading)) |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
3721 (error "No topics.") |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
3722 ;; got to first, outermost topic - set to expose it and siblings: |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
3723 (message "Above outermost topic - exposing all.") |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
3724 (outline-flag-region (point-min)(point-max) ?\n)) |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
3725 (if (not arg) |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
3726 (outline-flag-current-subtree ?\n) |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
3727 (outline-beginning-of-level) |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
3728 (outline-expose-topic '(* :)))))) |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3729 ;;;_ > outline-hide-current-subtree (&optional just-close) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3730 (defun outline-hide-current-subtree (&optional just-close) |
7416
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
3731 "Close the current topic, or containing topic if this one is already closed. |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
3732 |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
3733 If this topic is closed and it's a top level topic, close this topic |
15664
a50ebf4ac764
(outline-auto-activation, outline-layout)
Karl Heuer <kwzh@gnu.org>
parents:
15663
diff
changeset
|
3734 and its siblings. |
7416
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
3735 |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
3736 If optional arg JUST-CLOSE is non-nil, do not treat the parent or |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
3737 siblings, even if the target topic is already closed." |
3430 | 3738 |
3739 (interactive) | |
7416
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
3740 (let ((from (point)) |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
3741 (orig-eol (progn (end-of-line) |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
3742 (if (not (outline-goto-prefix)) |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
3743 (error "No topics found.") |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
3744 (end-of-line)(point))))) |
29490 | 3745 (outline-flag-current-subtree ?\r) |
7416
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
3746 (goto-char from) |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
3747 (if (and (= orig-eol (progn (goto-char orig-eol) |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
3748 (end-of-line) |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
3749 (point))) |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
3750 (not just-close) |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3751 ;; Structure didn't change - try hiding current level: |
7416
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
3752 (goto-char from) |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
3753 (if (outline-up-current-level 1 t) |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
3754 t |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
3755 (goto-char 0) |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
3756 (let ((msg |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
3757 "Top-level topic already closed - closing siblings...")) |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
3758 (message msg) |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
3759 (outline-expose-topic '(0 :)) |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
3760 (message (concat msg " Done."))) |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
3761 nil) |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
3762 (/= (outline-recent-depth) 0)) |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
3763 (outline-hide-current-subtree)) |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
3764 (goto-char from))) |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3765 ;;;_ > outline-show-current-branches () |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3766 (defun outline-show-current-branches () |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3767 "Show all subheadings of this heading, but not their bodies." |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3768 (interactive) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3769 (beginning-of-line) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3770 (outline-show-children t)) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3771 ;;;_ > outline-hide-current-leaves () |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3772 (defun outline-hide-current-leaves () |
15664
a50ebf4ac764
(outline-auto-activation, outline-layout)
Karl Heuer <kwzh@gnu.org>
parents:
15663
diff
changeset
|
3773 "Hide the bodies of the current topic and all its offspring." |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3774 (interactive) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3775 (outline-back-to-current-heading) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3776 (outline-hide-region-body (point) (progn (outline-end-of-current-subtree) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3777 (point)))) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3778 |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3779 ;;;_ - Region and beyond |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3780 ;;;_ > outline-show-all () |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3781 (defun outline-show-all () |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3782 "Show all of the text in the buffer." |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3783 (interactive) |
7416
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
3784 (message "Exposing entire buffer...") |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
3785 (outline-flag-region (point-min) (point-max) ?\n) |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
3786 (message "Exposing entire buffer... Done.")) |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3787 ;;;_ > outline-hide-bodies () |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3788 (defun outline-hide-bodies () |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3789 "Hide all of buffer except headings." |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3790 (interactive) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3791 (outline-hide-region-body (point-min) (point-max))) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3792 ;;;_ > outline-hide-region-body (start end) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3793 (defun outline-hide-region-body (start end) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3794 "Hide all body lines in the region, but not headings." |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3795 (save-excursion |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3796 (save-restriction |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3797 (narrow-to-region start end) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3798 (goto-char (point-min)) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3799 (while (not (eobp)) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3800 (outline-flag-region (point) |
29490 | 3801 (progn (outline-pre-next-preface) (point)) ?\r) |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3802 (if (not (eobp)) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3803 (forward-char |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3804 (if (looking-at "[\n\r][\n\r]") |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3805 2 1))))))) |
7416
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
3806 |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
3807 ;;;_ > outline-expose-topic (spec) |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
3808 (defun outline-expose-topic (spec) |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
3809 "Apply exposure specs to successive outline topic items. |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
3810 |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
3811 Use the more convenient frontend, `outline-new-exposure', if you don't |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
3812 need evaluation of the arguments, or even better, the `outline-layout' |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
3813 variable-keyed mode-activation/auto-exposure feature of allout outline |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
3814 mode. See the respective documentation strings for more details. |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3815 |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3816 Cursor is left at start position. |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3817 |
7416
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
3818 SPEC is either a number or a list. |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
3819 |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
3820 Successive specs on a list are applied to successive sibling topics. |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3821 |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3822 A simple spec \(either a number, one of a few symbols, or the null |
7416
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
3823 list) dictates the exposure for the corresponding topic. |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
3824 |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
3825 Non-null lists recursively designate exposure specs for respective |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
3826 subtopics of the current topic. |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
3827 |
15664
a50ebf4ac764
(outline-auto-activation, outline-layout)
Karl Heuer <kwzh@gnu.org>
parents:
15663
diff
changeset
|
3828 The `:' repeat spec is used to specify exposure for any number of |
7416
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
3829 successive siblings, up to the trailing ones for which there are |
15664
a50ebf4ac764
(outline-auto-activation, outline-layout)
Karl Heuer <kwzh@gnu.org>
parents:
15663
diff
changeset
|
3830 explicit specs following the `:'. |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3831 |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3832 Simple (numeric and null-list) specs are interpreted as follows: |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3833 |
7416
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
3834 Numbers indicate the relative depth to open the corresponding topic. |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
3835 - negative numbers force the topic to be closed before opening to the |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
3836 absolute value of the number, so all siblings are open only to |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
3837 that level. |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
3838 - positive numbers open to the relative depth indicated by the |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
3839 number, but do not force already opened subtopics to be closed. |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
3840 - 0 means to close topic - hide all offspring. |
15664
a50ebf4ac764
(outline-auto-activation, outline-layout)
Karl Heuer <kwzh@gnu.org>
parents:
15663
diff
changeset
|
3841 : - `repeat' |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3842 apply prior element to all siblings at current level, *up to* |
15664
a50ebf4ac764
(outline-auto-activation, outline-layout)
Karl Heuer <kwzh@gnu.org>
parents:
15663
diff
changeset
|
3843 those siblings that would be covered by specs following the `:' |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3844 on the list. Ie, apply to all topics at level but the last |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3845 ones. \(Only first of multiple colons at same level is |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3846 respected - subsequent ones are discarded.) |
7416
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
3847 * - completely opens the topic, including bodies. |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
3848 + - shows all the sub headers, but not the bodies |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
3849 - - exposes the body of the corresponding topic. |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3850 |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3851 Examples: |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3852 \(outline-expose-topic '(-1 : 0)) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3853 Close this and all following topics at current level, exposing |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3854 only their immediate children, but close down the last topic |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3855 at this current level completely. |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3856 \(outline-expose-topic '(-1 () : 1 0)) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3857 Close current topic so only the immediate subtopics are shown; |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3858 show the children in the second to last topic, and completely |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3859 close the last one. |
7416
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
3860 \(outline-expose-topic '(-2 : -1 *)) |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3861 Expose children and grandchildren of all topics at current |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3862 level except the last two; expose children of the second to |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3863 last and completely open the last one." |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3864 |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3865 (interactive "xExposure spec: ") |
7416
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
3866 (if (not (listp spec)) |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
3867 nil |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
3868 (let ((depth (outline-depth)) |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
3869 (max-pos 0) |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
3870 prev-elem curr-elem |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
3871 stay done |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
3872 snug-back |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
3873 ) |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
3874 (while spec |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
3875 (setq prev-elem curr-elem |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
3876 curr-elem (car spec) |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
3877 spec (cdr spec)) |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
3878 (cond ; Do current element: |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
3879 ((null curr-elem) nil) |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
3880 ((symbolp curr-elem) |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
3881 (cond ((eq curr-elem '*) (outline-show-current-subtree) |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
3882 (if (> outline-recent-end-of-subtree max-pos) |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
3883 (setq max-pos outline-recent-end-of-subtree))) |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
3884 ((eq curr-elem '+) (outline-show-current-branches) |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
3885 (if (> outline-recent-end-of-subtree max-pos) |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
3886 (setq max-pos outline-recent-end-of-subtree))) |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
3887 ((eq curr-elem '-) (outline-show-current-entry)) |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
3888 ((eq curr-elem ':) |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
3889 (setq stay t) |
15664
a50ebf4ac764
(outline-auto-activation, outline-layout)
Karl Heuer <kwzh@gnu.org>
parents:
15663
diff
changeset
|
3890 ;; Expand the `repeat' spec to an explicit version, |
7416
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
3891 ;; w.r.t. remaining siblings: |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
3892 (let ((residue ; = # of sibs not covered by remaining spec |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
3893 ;; Dang - could be nice to make use of the chart, sigh: |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
3894 (- (length (outline-chart-siblings)) |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
3895 (length spec)))) |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
3896 (if (< 0 residue) |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
3897 ;; Some residue - cover it with prev-elem: |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
3898 (setq spec (append (make-list residue prev-elem) |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
3899 spec))))))) |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
3900 ((numberp curr-elem) |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
3901 (if (and (>= 0 curr-elem) (outline-visible-p)) |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
3902 (save-excursion (outline-hide-current-subtree t) |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
3903 (if (> 0 curr-elem) |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
3904 nil |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
3905 (if (> outline-recent-end-of-subtree max-pos) |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
3906 (setq max-pos |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
3907 outline-recent-end-of-subtree))))) |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
3908 (if (> (abs curr-elem) 0) |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
3909 (progn (outline-show-children (abs curr-elem)) |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
3910 (if (> outline-recent-end-of-subtree max-pos) |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
3911 (setq max-pos outline-recent-end-of-subtree))))) |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
3912 ((listp curr-elem) |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
3913 (if (outline-descend-to-depth (1+ depth)) |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
3914 (let ((got (outline-expose-topic curr-elem))) |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
3915 (if (and got (> got max-pos)) (setq max-pos got)))))) |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
3916 (cond (stay (setq stay nil)) |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
3917 ((listp (car spec)) nil) |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
3918 ((> max-pos (point)) |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
3919 ;; Capitalize on max-pos state to get us nearer next sibling: |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
3920 (progn (goto-char (min (point-max) max-pos)) |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
3921 (outline-next-heading))) |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
3922 ((outline-next-sibling depth)))) |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
3923 max-pos))) |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3924 ;;;_ > outline-old-expose-topic (spec &rest followers) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3925 (defun outline-old-expose-topic (spec &rest followers) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3926 |
7416
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
3927 "Deprecated. Use outline-expose-topic \(with different schema |
29490 | 3928 format) instead. |
7416
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
3929 |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
3930 Dictate wholesale exposure scheme for current topic, according to SPEC. |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3931 |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3932 SPEC is either a number or a list. Optional successive args |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3933 dictate exposure for subsequent siblings of current topic. |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3934 |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3935 A simple spec (either a number, a special symbol, or the null list) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3936 dictates the overall exposure for a topic. Non null lists are |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3937 composite specs whose first element dictates the overall exposure for |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3938 a topic, with the subsequent elements in the list interpreted as specs |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3939 that dictate the exposure for the successive offspring of the topic. |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3940 |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3941 Simple (numeric and null-list) specs are interpreted as follows: |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3942 |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3943 - Numbers indicate the relative depth to open the corresponding topic: |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3944 - negative numbers force the topic to be close before opening to the |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3945 absolute value of the number. |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3946 - positive numbers just open to the relative depth indicated by the number. |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3947 - 0 just closes |
15664
a50ebf4ac764
(outline-auto-activation, outline-layout)
Karl Heuer <kwzh@gnu.org>
parents:
15663
diff
changeset
|
3948 - `*' completely opens the topic, including bodies. |
a50ebf4ac764
(outline-auto-activation, outline-layout)
Karl Heuer <kwzh@gnu.org>
parents:
15663
diff
changeset
|
3949 - `+' shows all the sub headers, but not the bodies |
a50ebf4ac764
(outline-auto-activation, outline-layout)
Karl Heuer <kwzh@gnu.org>
parents:
15663
diff
changeset
|
3950 - `-' exposes the body and immediate offspring of the corresponding topic. |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3951 |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3952 If the spec is a list, the first element must be a number, which |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3953 dictates the exposure depth of the topic as a whole. Subsequent |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3954 elements of the list are nested SPECs, dictating the specific exposure |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3955 for the corresponding offspring of the topic. |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3956 |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3957 Optional FOLLOWER arguments dictate exposure for succeeding siblings." |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3958 |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3959 (interactive "xExposure spec: ") |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3960 (let ((depth (outline-current-depth)) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3961 done |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3962 max-pos) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3963 (cond ((null spec) nil) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3964 ((symbolp spec) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3965 (if (eq spec '*) (outline-show-current-subtree)) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3966 (if (eq spec '+) (outline-show-current-branches)) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3967 (if (eq spec '-) (outline-show-current-entry))) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3968 ((numberp spec) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3969 (if (>= 0 spec) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3970 (save-excursion (outline-hide-current-subtree t) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3971 (end-of-line) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3972 (if (or (not max-pos) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3973 (> (point) max-pos)) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3974 (setq max-pos (point))) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3975 (if (> 0 spec) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3976 (setq spec (* -1 spec))))) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3977 (if (> spec 0) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3978 (outline-show-children spec))) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3979 ((listp spec) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3980 ;(let ((got (outline-old-expose-topic (car spec)))) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3981 ; (if (and got (or (not max-pos) (> got max-pos))) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3982 ; (setq max-pos got))) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3983 (let ((new-depth (+ (outline-current-depth) 1)) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3984 got) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3985 (setq max-pos (outline-old-expose-topic (car spec))) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3986 (setq spec (cdr spec)) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3987 (if (and spec |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3988 (outline-descend-to-depth new-depth) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3989 (not (outline-hidden-p))) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3990 (progn (setq got (apply 'outline-old-expose-topic spec)) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3991 (if (and got (or (not max-pos) (> got max-pos))) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3992 (setq max-pos got))))))) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3993 (while (and followers |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3994 (progn (if (and max-pos (< (point) max-pos)) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3995 (progn (goto-char max-pos) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3996 (setq max-pos nil))) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3997 (end-of-line) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3998 (outline-next-sibling depth))) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3999 (outline-old-expose-topic (car followers)) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4000 (setq followers (cdr followers))) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4001 max-pos)) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4002 ;;;_ > outline-new-exposure '() |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4003 (defmacro outline-new-exposure (&rest spec) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4004 "Literal frontend for `outline-expose-topic', doesn't evaluate arguments. |
7416
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
4005 Some arguments that would need to be quoted in outline-expose-topic |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
4006 need not be quoted in outline-new-exposure. |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4007 |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4008 Cursor is left at start position. |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4009 |
15664
a50ebf4ac764
(outline-auto-activation, outline-layout)
Karl Heuer <kwzh@gnu.org>
parents:
15663
diff
changeset
|
4010 Use this instead of obsolete `outline-exposure'. |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4011 |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4012 Examples: |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4013 \(outline-exposure (-1 () () () 1) 0) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4014 Close current topic at current level so only the immediate |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4015 subtopics are shown, except also show the children of the |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4016 third subtopic; and close the next topic at the current level. |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4017 \(outline-exposure : -1 0) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4018 Close all topics at current level to expose only their |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4019 immediate children, except for the last topic at the current |
15664
a50ebf4ac764
(outline-auto-activation, outline-layout)
Karl Heuer <kwzh@gnu.org>
parents:
15663
diff
changeset
|
4020 level, in which even its immediate children are hidden. |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4021 \(outline-exposure -2 : -1 *) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4022 Expose children and grandchildren of first topic at current |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4023 level, and expose children of subsequent topics at current |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4024 level *except* for the last, which should be opened completely." |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4025 (list 'save-excursion |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4026 '(if (not (or (outline-goto-prefix) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4027 (outline-next-heading))) |
7416
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
4028 (error "outline-new-exposure: Can't find any outline topics.")) |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4029 (list 'outline-expose-topic (list 'quote spec)))) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4030 ;;;_ > outline-exposure '() |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4031 (defmacro outline-exposure (&rest spec) |
15664
a50ebf4ac764
(outline-auto-activation, outline-layout)
Karl Heuer <kwzh@gnu.org>
parents:
15663
diff
changeset
|
4032 "Being deprecated - use more recent `outline-new-exposure' instead. |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4033 |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4034 Literal frontend for `outline-old-expose-topic', doesn't evaluate arguments |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4035 and retains start position." |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4036 (list 'save-excursion |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4037 '(if (not (or (outline-goto-prefix) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4038 (outline-next-heading))) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4039 (error "Can't find any outline topics.")) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4040 (cons 'outline-old-expose-topic |
29490 | 4041 (mapcar (function (lambda (x) (list 'quote x))) spec)))) |
4042 | |
4043 ;;;_ #7 Systematic outline presentation - copying, printing, flattening | |
4044 | |
4045 ;;;_ - Mapping and processing of topics | |
4046 ;;;_ ( See also Subtree Charting, in Navigation code.) | |
4047 ;;;_ > outline-stringify-flat-index (flat-index) | |
4048 (defun outline-stringify-flat-index (flat-index &optional context) | |
4049 "Convert list representing section/subsection/... to document string. | |
4050 | |
4051 Optional arg CONTEXT indicates interior levels to include." | |
4052 (let ((delim ".") | |
4053 result | |
4054 numstr | |
4055 (context-depth (or (and context 2) 1))) | |
4056 ;; Take care of the explicit context: | |
4057 (while (> context-depth 0) | |
4058 (setq numstr (int-to-string (car flat-index)) | |
4059 flat-index (cdr flat-index) | |
4060 result (if flat-index | |
4061 (cons delim (cons numstr result)) | |
4062 (cons numstr result)) | |
4063 context-depth (if flat-index (1- context-depth) 0))) | |
4064 (setq delim " ") | |
4065 ;; Take care of the indentation: | |
4066 (if flat-index | |
4067 (progn | |
4068 (while flat-index | |
4069 (setq result | |
4070 (cons delim | |
4071 (cons (make-string | |
4072 (1+ (truncate (if (zerop (car flat-index)) | |
4073 1 | |
4074 (log10 (car flat-index))))) | |
4075 ? ) | |
4076 result))) | |
4077 (setq flat-index (cdr flat-index))) | |
4078 ;; Dispose of single extra delim: | |
4079 (setq result (cdr result)))) | |
4080 (apply 'concat result))) | |
4081 ;;;_ > outline-stringify-flat-index-plain (flat-index) | |
4082 (defun outline-stringify-flat-index-plain (flat-index) | |
4083 "Convert list representing section/subsection/... to document string." | |
4084 (let ((delim ".") | |
4085 result) | |
4086 (while flat-index | |
4087 (setq result (cons (int-to-string (car flat-index)) | |
4088 (if result | |
4089 (cons delim result)))) | |
4090 (setq flat-index (cdr flat-index))) | |
4091 (apply 'concat result))) | |
4092 ;;;_ > outline-stringify-flat-index-indented (flat-index) | |
4093 (defun outline-stringify-flat-index-indented (flat-index) | |
4094 "Convert list representing section/subsection/... to document string." | |
4095 (let ((delim ".") | |
4096 result | |
4097 numstr) | |
4098 ;; Take care of the explicit context: | |
4099 (setq numstr (int-to-string (car flat-index)) | |
4100 flat-index (cdr flat-index) | |
4101 result (if flat-index | |
4102 (cons delim (cons numstr result)) | |
4103 (cons numstr result))) | |
4104 (setq delim " ") | |
4105 ;; Take care of the indentation: | |
4106 (if flat-index | |
4107 (progn | |
4108 (while flat-index | |
4109 (setq result | |
4110 (cons delim | |
4111 (cons (make-string | |
4112 (1+ (truncate (if (zerop (car flat-index)) | |
4113 1 | |
4114 (log10 (car flat-index))))) | |
4115 ? ) | |
4116 result))) | |
4117 (setq flat-index (cdr flat-index))) | |
4118 ;; Dispose of single extra delim: | |
4119 (setq result (cdr result)))) | |
4120 (apply 'concat result))) | |
4121 ;;;_ > outline-listify-exposed (&optional start end format) | |
4122 (defun outline-listify-exposed (&optional start end format) | |
4123 | |
4124 "Produce a list representing exposed topics in current region. | |
4125 | |
4126 This list can then be used by `outline-process-exposed' to manipulate | |
4127 the subject region. | |
4128 | |
4129 Optional START and END indicate bounds of region. | |
4130 | |
4131 optional arg, FORMAT, designates an alternate presentation form for | |
4132 the prefix: | |
4133 | |
4134 list - Present prefix as numeric section.subsection..., starting with | |
4135 section indicated by the list, innermost nesting first. | |
4136 `indent' \(symbol) - Convert header prefixes to all white space, | |
4137 except for distinctive bullets. | |
4138 | |
4139 The elements of the list produced are lists that represents a topic | |
4140 header and body. The elements of that list are: | |
4141 | |
4142 - a number representing the depth of the topic, | |
4143 - a string representing the header-prefix, including trailing whitespace and | |
4144 bullet. | |
4145 - a string representing the bullet character, | |
4146 - and a series of strings, each containing one line of the exposed | |
4147 portion of the topic entry." | |
4148 | |
4149 (interactive "r") | |
4150 (save-excursion | |
4151 (let* | |
4152 ;; state vars: | |
4153 (strings prefix pad result depth new-depth out gone-out bullet beg | |
4154 next done) | |
4155 | |
4156 (goto-char start) | |
4157 (beginning-of-line) | |
4158 ;; Goto initial topic, and register preceeding stuff, if any: | |
4159 (if (> (outline-goto-prefix) start) | |
4160 ;; First topic follows beginning point - register preliminary stuff: | |
4161 (setq result (list (list 0 "" nil | |
4162 (buffer-substring start (1- (point))))))) | |
4163 (while (and (not done) | |
4164 (not (eobp)) ; Loop until we've covered the region. | |
4165 (not (> (point) end))) | |
4166 (setq depth (outline-recent-depth) ; Current topics depth, | |
4167 bullet (outline-recent-bullet) ; ... bullet, | |
4168 prefix (outline-recent-prefix) | |
4169 beg (progn (outline-end-of-prefix t) (point))) ; and beginning. | |
4170 (setq done ; The boundary for the current topic: | |
4171 (not (outline-next-visible-heading 1))) | |
4172 (setq new-depth (outline-recent-depth)) | |
4173 (setq gone-out out | |
4174 out (< new-depth depth)) | |
4175 (beginning-of-line) | |
4176 (setq next (point)) | |
4177 (goto-char beg) | |
4178 (setq strings nil) | |
4179 (while (> next (point)) ; Get all the exposed text in | |
4180 (setq strings | |
4181 (cons (buffer-substring | |
4182 beg | |
4183 ;To hidden text or end of line: | |
4184 (progn | |
4185 (search-forward "\r" | |
4186 (save-excursion (end-of-line) | |
4187 (point)) | |
4188 1) | |
4189 (if (= (preceding-char) ?\r) | |
4190 (1- (point)) | |
4191 (point)))) | |
4192 strings)) | |
4193 (if (< (point) next) ; Resume from after hid text, if any. | |
4194 (forward-line 1)) | |
4195 (setq beg (point))) | |
4196 ;; Accumulate list for this topic: | |
4197 (setq strings (nreverse strings)) | |
4198 (setq result | |
4199 (cons | |
4200 (if format | |
4201 (let ((special (if (string-match | |
4202 (regexp-quote bullet) | |
4203 outline-distinctive-bullets-string) | |
4204 bullet))) | |
4205 (cond ((listp format) | |
4206 (list depth | |
4207 (if outline-abbreviate-flattened-numbering | |
4208 (outline-stringify-flat-index format | |
4209 gone-out) | |
4210 (outline-stringify-flat-index-plain | |
4211 format)) | |
4212 strings | |
4213 special)) | |
4214 ((eq format 'indent) | |
4215 (if special | |
4216 (list depth | |
4217 (concat (make-string (1+ depth) ? ) | |
4218 (substring prefix -1)) | |
4219 strings) | |
4220 (list depth | |
4221 (make-string depth ? ) | |
4222 strings))) | |
4223 (t (error "outline-listify-exposed: %s %s" | |
4224 "invalid format" format)))) | |
4225 (list depth prefix strings)) | |
4226 result)) | |
4227 ;; Reasses format, if any: | |
4228 (if (and format (listp format)) | |
4229 (cond ((= new-depth depth) | |
4230 (setq format (cons (1+ (car format)) | |
4231 (cdr format)))) | |
4232 ((> new-depth depth) ; descending - assume by 1: | |
4233 (setq format (cons 1 format))) | |
4234 (t | |
4235 ; Pop the residue: | |
4236 (while (< new-depth depth) | |
4237 (setq format (cdr format)) | |
4238 (setq depth (1- depth))) | |
4239 ; And increment the current one: | |
4240 (setq format | |
4241 (cons (1+ (or (car format) | |
4242 -1)) | |
4243 (cdr format))))))) | |
4244 ;; Put the list with first at front, to last at back: | |
4245 (nreverse result)))) | |
4246 ;;;_ > outline-process-exposed (&optional func from to frombuf | |
4247 ;;; tobuf format) | |
4248 (defun outline-process-exposed (&optional func from to frombuf tobuf | |
4249 format &optional start-num) | |
4250 "Map function on exposed parts of current topic; results to another buffer. | |
4251 | |
4252 All args are options; default values itemized below. | |
4253 | |
4254 Apply FUNCTION to exposed portions FROM position TO position in buffer | |
4255 FROMBUF to buffer TOBUF. Sixth optional arg, FORMAT, designates an | |
4256 alternate presentation form: | |
4257 | |
4258 `flat' - Present prefix as numeric section.subsection..., starting with | |
4259 section indicated by the start-num, innermost nesting first. | |
4260 X`flat-indented' - Prefix is like `flat' for first topic at each | |
4261 X level, but subsequent topics have only leaf topic | |
4262 X number, padded with blanks to line up with first. | |
4263 `indent' \(symbol) - Convert header prefixes to all white space, | |
4264 except for distinctive bullets. | |
4265 | |
4266 Defaults: | |
4267 FUNCTION: `outline-insert-listified' | |
4268 FROM: region start, if region active, else start of buffer | |
4269 TO: region end, if region active, else end of buffer | |
4270 FROMBUF: current buffer | |
4271 TOBUF: buffer name derived: \"*current-buffer-name exposed*\" | |
4272 FORMAT: nil" | |
4273 | |
4274 ; Resolve arguments, | |
4275 ; defaulting if necessary: | |
4276 (if (not func) (setq func 'outline-insert-listified)) | |
4277 (if (not (and from to)) | |
4278 (if (my-region-active-p) | |
4279 (setq from (region-beginning) to (region-end)) | |
4280 (setq from (point-min) to (point-max)))) | |
4281 (if frombuf | |
4282 (if (not (bufferp frombuf)) | |
4283 ;; Specified but not a buffer - get it: | |
4284 (let ((got (get-buffer frombuf))) | |
4285 (if (not got) | |
4286 (error (concat "outline-process-exposed: source buffer " | |
4287 frombuf | |
4288 " not found.")) | |
4289 (setq frombuf got)))) | |
4290 ;; not specified - default it: | |
4291 (setq frombuf (current-buffer))) | |
4292 (if tobuf | |
4293 (if (not (bufferp tobuf)) | |
4294 (setq tobuf (get-buffer-create tobuf))) | |
4295 ;; not specified - default it: | |
4296 (setq tobuf (concat "*" (buffer-name frombuf) " exposed*"))) | |
4297 (if (listp format) | |
4298 (nreverse format)) | |
4299 | |
4300 (let* ((listified | |
4301 (progn (set-buffer frombuf) | |
4302 (outline-listify-exposed from to format)))) | |
4303 (set-buffer tobuf) | |
4304 (mapcar func listified) | |
4305 (pop-to-buffer tobuf))) | |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4306 |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4307 ;;;_ - Copy exposed |
29490 | 4308 ;;;_ > outline-insert-listified (listified) |
4309 (defun outline-insert-listified (listified) | |
4310 "Insert contents of listified outline portion in current buffer. | |
4311 | |
4312 Listified is a list representing each topic header and body: | |
4313 | |
4314 \`(depth prefix text)' | |
4315 | |
4316 or \`(depth prefix text bullet-plus)' | |
4317 | |
4318 If `bullet-plus' is specified, it is inserted just after the entire prefix." | |
4319 (setq listified (cdr listified)) | |
4320 (let ((prefix (prog1 | |
4321 (car listified) | |
4322 (setq listified (cdr listified)))) | |
4323 (text (prog1 | |
4324 (car listified) | |
4325 (setq listified (cdr listified)))) | |
4326 (bullet-plus (car listified))) | |
4327 (insert-string prefix) | |
4328 (if bullet-plus (insert-string (concat " " bullet-plus))) | |
4329 (while text | |
4330 (insert-string (car text)) | |
4331 (if (setq text (cdr text)) | |
4332 (insert-string "\n"))) | |
4333 (insert-string "\n"))) | |
4334 ;;;_ > outline-copy-exposed-to-buffer (&optional arg tobuf format) | |
4335 (defun outline-copy-exposed-to-buffer (&optional arg tobuf format) | |
4336 "Duplicate exposed portions of current outline to another buffer. | |
4337 | |
4338 Other buffer has current buffers name with \" exposed\" appended to it. | |
4339 | |
4340 With repeat count, copy the exposed parts of only the current topic. | |
4341 | |
4342 Optional second arg TOBUF is target buffer name. | |
4343 | |
4344 Optional third arg FORMAT, if non-nil, symbolically designates an | |
4345 alternate presentation format for the outline: | |
4346 | |
4347 `flat' - Convert topic header prefixes to numeric | |
4348 section.subsection... identifiers. | |
4349 `indent' - Convert header prefixes to all white space, except for | |
4350 distinctive bullets. | |
4351 `indent-flat' - The best of both - only the first of each level has | |
4352 the full path, the rest have only the section number | |
4353 of the leaf, preceded by the right amount of indentation." | |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4354 |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4355 (interactive "P") |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4356 (if (not tobuf) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4357 (setq tobuf (get-buffer-create (concat "*" (buffer-name) " exposed*")))) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4358 (let* ((start-pt (point)) |
29490 | 4359 (beg (if arg (outline-back-to-current-heading) (point-min))) |
4360 (end (if arg (outline-end-of-current-subtree) (point-max))) | |
4361 (buf (current-buffer)) | |
4362 (start-list ())) | |
4363 (if (eq format 'flat) | |
4364 (setq format (if arg (save-excursion | |
4365 (goto-char beg) | |
4366 (outline-topic-flat-index)) | |
4367 '(1)))) | |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4368 (save-excursion (set-buffer tobuf)(erase-buffer)) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4369 (outline-process-exposed 'outline-insert-listified |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4370 beg |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4371 end |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4372 (current-buffer) |
29490 | 4373 tobuf |
4374 format start-list) | |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4375 (goto-char (point-min)) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4376 (pop-to-buffer buf) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4377 (goto-char start-pt))) |
29490 | 4378 ;;;_ > outline-flatten-exposed-to-buffer (&optional arg tobuf) |
4379 (defun outline-flatten-exposed-to-buffer (&optional arg tobuf) | |
4380 "Present numeric outline of outline's exposed portions in another buffer. | |
4381 | |
4382 The resulting outline is not compatable with outline mode - use | |
4383 `outline-copy-exposed-to-buffer' if you want that. | |
4384 | |
4385 Use `outline-indented-exposed-to-buffer' for indented presentation. | |
4386 | |
4387 With repeat count, copy the exposed portions of only current topic. | |
4388 | |
4389 Other buffer has current buffers name with \" exposed\" appended to | |
4390 it, unless optional second arg TOBUF is specified, in which case it is | |
4391 used verbatim." | |
4392 (interactive "P") | |
4393 (outline-copy-exposed-to-buffer arg tobuf 'flat)) | |
4394 ;;;_ > outline-indented-exposed-to-buffer (&optional arg tobuf) | |
4395 (defun outline-indented-exposed-to-buffer (&optional arg tobuf) | |
4396 "Present indented outline of outline's exposed portions in another buffer. | |
4397 | |
4398 The resulting outline is not compatable with outline mode - use | |
4399 `outline-copy-exposed-to-buffer' if you want that. | |
4400 | |
4401 Use `outline-flatten-exposed-to-buffer' for numeric sectional presentation. | |
4402 | |
4403 With repeat count, copy the exposed portions of only current topic. | |
4404 | |
4405 Other buffer has current buffers name with \" exposed\" appended to | |
4406 it, unless optional second arg TOBUF is specified, in which case it is | |
4407 used verbatim." | |
4408 (interactive "P") | |
4409 (outline-copy-exposed-to-buffer arg tobuf 'indent)) | |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4410 |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4411 ;;;_ - LaTeX formatting |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4412 ;;;_ > outline-latex-verb-quote (str &optional flow) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4413 (defun outline-latex-verb-quote (str &optional flow) |
7416
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
4414 "Return copy of STRING for literal reproduction across latex processing. |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
4415 Expresses the original characters \(including carriage returns) of the |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
4416 string across latex processing." |
29490 | 4417 (mapconcat (function |
4418 (lambda (char) | |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4419 (cond ((memq char '(?\\ ?$ ?% ?# ?& ?{ ?} ?_ ?^ ?- ?*)) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4420 (concat "\\char" (number-to-string char) "{}")) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4421 ((= char ?\n) "\\\\") |
29490 | 4422 (t (char-to-string char))))) |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4423 str |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4424 "")) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4425 ;;;_ > outline-latex-verbatim-quote-curr-line () |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4426 (defun outline-latex-verbatim-quote-curr-line () |
29490 | 4427 "Express line for exact \(literal) representation across latex processing. |
7416
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
4428 |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
4429 Adjust line contents so it is unaltered \(from the original line) |
15664
a50ebf4ac764
(outline-auto-activation, outline-layout)
Karl Heuer <kwzh@gnu.org>
parents:
15663
diff
changeset
|
4430 across latex processing, within the context of a `verbatim' |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4431 environment. Leaves point at the end of the line." |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4432 (beginning-of-line) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4433 (let ((beg (point)) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4434 (end (progn (end-of-line)(point)))) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4435 (goto-char beg) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4436 (while (re-search-forward "\\\\" |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4437 ;;"\\\\\\|\\{\\|\\}\\|\\_\\|\\$\\|\\\"\\|\\&\\|\\^\\|\\-\\|\\*\\|#" |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4438 end ; bounded by end-of-line |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4439 1) ; no matches, move to end & return nil |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4440 (goto-char (match-beginning 0)) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4441 (insert-string "\\") |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4442 (setq end (1+ end)) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4443 (goto-char (1+ (match-end 0)))))) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4444 ;;;_ > outline-insert-latex-header (buf) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4445 (defun outline-insert-latex-header (buf) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4446 "Insert initial latex commands at point in BUFFER." |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4447 ;; Much of this is being derived from the stuff in appendix of E in |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4448 ;; the TeXBook, pg 421. |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4449 (set-buffer buf) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4450 (let ((doc-style (format "\n\\documentstyle{%s}\n" |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4451 "report")) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4452 (page-numbering (if outline-number-pages |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4453 "\\pagestyle{empty}\n" |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4454 "")) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4455 (linesdef (concat "\\def\\beginlines{" |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4456 "\\par\\begingroup\\nobreak\\medskip" |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4457 "\\parindent=0pt\n" |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4458 " \\kern1pt\\nobreak \\obeylines \\obeyspaces " |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4459 "\\everypar{\\strut}}\n" |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4460 "\\def\\endlines{" |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4461 "\\kern1pt\\endgroup\\medbreak\\noindent}\n")) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4462 (titlecmd (format "\\newcommand{\\titlecmd}[1]{{%s #1}}\n" |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4463 outline-title-style)) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4464 (labelcmd (format "\\newcommand{\\labelcmd}[1]{{%s #1}}\n" |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4465 outline-label-style)) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4466 (headlinecmd (format "\\newcommand{\\headlinecmd}[1]{{%s #1}}\n" |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4467 outline-head-line-style)) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4468 (bodylinecmd (format "\\newcommand{\\bodylinecmd}[1]{{%s #1}}\n" |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4469 outline-body-line-style)) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4470 (setlength (format "%s%s%s%s" |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4471 "\\newlength{\\stepsize}\n" |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4472 "\\setlength{\\stepsize}{" |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4473 outline-indent |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4474 "}\n")) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4475 (oneheadline (format "%s%s%s%s%s%s%s" |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4476 "\\newcommand{\\OneHeadLine}[3]{%\n" |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4477 "\\noindent%\n" |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4478 "\\hspace*{#2\\stepsize}%\n" |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4479 "\\labelcmd{#1}\\hspace*{.2cm}" |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4480 "\\headlinecmd{#3}\\\\[" |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4481 outline-line-skip |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4482 "]\n}\n")) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4483 (onebodyline (format "%s%s%s%s%s%s" |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4484 "\\newcommand{\\OneBodyLine}[2]{%\n" |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4485 "\\noindent%\n" |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4486 "\\hspace*{#1\\stepsize}%\n" |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4487 "\\bodylinecmd{#2}\\\\[" |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4488 outline-line-skip |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4489 "]\n}\n")) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4490 (begindoc "\\begin{document}\n\\begin{center}\n") |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4491 (title (format "%s%s%s%s" |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4492 "\\titlecmd{" |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4493 (outline-latex-verb-quote (if outline-title |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4494 (condition-case err |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4495 (eval outline-title) |
29490 | 4496 ('error "<unnamed buffer>")) |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4497 "Unnamed Outline")) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4498 "}\n" |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4499 "\\end{center}\n\n")) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4500 (hsize "\\hsize = 7.5 true in\n") |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4501 (hoffset "\\hoffset = -1.5 true in\n") |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4502 (vspace "\\vspace{.1cm}\n\n")) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4503 (insert (concat doc-style |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4504 page-numbering |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4505 titlecmd |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4506 labelcmd |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4507 headlinecmd |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4508 bodylinecmd |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4509 setlength |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4510 oneheadline |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4511 onebodyline |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4512 begindoc |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4513 title |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4514 hsize |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4515 hoffset |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4516 vspace) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4517 ))) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4518 ;;;_ > outline-insert-latex-trailer (buf) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4519 (defun outline-insert-latex-trailer (buf) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4520 "Insert concluding latex commands at point in BUFFER." |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4521 (set-buffer buf) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4522 (insert "\n\\end{document}\n")) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4523 ;;;_ > outline-latexify-one-item (depth prefix bullet text) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4524 (defun outline-latexify-one-item (depth prefix bullet text) |
7416
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
4525 "Insert LaTeX commands for formatting one outline item. |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
4526 |
29490 | 4527 Args are the topics numeric DEPTH, the header PREFIX lead string, the |
7416
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
4528 BULLET string, and a list of TEXT strings for the body." |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4529 (let* ((head-line (if text (car text))) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4530 (body-lines (cdr text)) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4531 (curr-line) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4532 body-content bop) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4533 ; Do the head line: |
29490 | 4534 (insert-string (concat "\\OneHeadLine{\\verb\1 " |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4535 (outline-latex-verb-quote bullet) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4536 "\1}{" |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4537 depth |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4538 "}{\\verb\1 " |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4539 (if head-line |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4540 (outline-latex-verb-quote head-line) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4541 "") |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4542 "\1}\n")) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4543 (if (not body-lines) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4544 nil |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4545 ;;(insert-string "\\beginlines\n") |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4546 (insert-string "\\begin{verbatim}\n") |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4547 (while body-lines |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4548 (setq curr-line (car body-lines)) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4549 (if (and (not body-content) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4550 (not (string-match "^\\s-*$" curr-line))) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4551 (setq body-content t)) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4552 ; Mangle any occurrences of |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4553 ; "\end{verbatim}" in text, |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4554 ; it's special: |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4555 (if (and body-content |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4556 (setq bop (string-match "\\end{verbatim}" curr-line))) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4557 (setq curr-line (concat (substring curr-line 0 bop) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4558 ">" |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4559 (substring curr-line bop)))) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4560 ;;(insert-string "|" (car body-lines) "|") |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4561 (insert-string curr-line) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4562 (outline-latex-verbatim-quote-curr-line) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4563 (insert-string "\n") |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4564 (setq body-lines (cdr body-lines))) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4565 (if body-content |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4566 (setq body-content nil) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4567 (forward-char -1) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4568 (insert-string "\\ ") |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4569 (forward-char 1)) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4570 ;;(insert-string "\\endlines\n") |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4571 (insert-string "\\end{verbatim}\n") |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4572 ))) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4573 ;;;_ > outline-latexify-exposed (arg &optional tobuf) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4574 (defun outline-latexify-exposed (arg &optional tobuf) |
29490 | 4575 "Format current topics exposed portions to TOBUF for latex processing. |
7416
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
4576 TOBUF defaults to a buffer named the same as the current buffer, but |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
4577 with \"*\" prepended and \" latex-formed*\" appended. |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4578 |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4579 With repeat count, copy the exposed portions of entire buffer." |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4580 |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4581 (interactive "P") |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4582 (if (not tobuf) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4583 (setq tobuf |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4584 (get-buffer-create (concat "*" (buffer-name) " latexified*")))) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4585 (let* ((start-pt (point)) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4586 (beg (if arg (point-min) (outline-back-to-current-heading))) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4587 (end (if arg (point-max) (outline-end-of-current-subtree))) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4588 (buf (current-buffer))) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4589 (set-buffer tobuf) |
3430 | 4590 (erase-buffer) |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4591 (outline-insert-latex-header tobuf) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4592 (goto-char (point-max)) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4593 (outline-process-exposed 'outline-latexify-one-item |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4594 beg |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4595 end |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4596 buf |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4597 tobuf) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4598 (goto-char (point-max)) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4599 (outline-insert-latex-trailer tobuf) |
3430 | 4600 (goto-char (point-min)) |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4601 (pop-to-buffer buf) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4602 (goto-char start-pt))) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4603 |
29490 | 4604 ;;;_ #8 miscellaneous |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4605 ;;;_ > outline-mark-topic () |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4606 (defun outline-mark-topic () |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4607 "Put the region around topic currently containing point." |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4608 (interactive) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4609 (beginning-of-line) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4610 (outline-goto-prefix) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4611 (push-mark (point)) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4612 (outline-end-of-current-subtree) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4613 (exchange-point-and-mark)) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4614 ;;;_ > outlineify-sticky () |
7416
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
4615 ;; outlinify-sticky is correct spelling; provide this alias for sticklers: |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
4616 (defalias 'outlinify-sticky 'outlineify-sticky) |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4617 (defun outlineify-sticky (&optional arg) |
13964
4de229297f1f
(outline-primary-bullet, outline-numbered-bullet,
Karl Heuer <kwzh@gnu.org>
parents:
13337
diff
changeset
|
4618 "Activate outline mode and establish file var so it is started subsequently. |
7416
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
4619 |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
4620 See doc-string for `outline-layout' and `outline-init' for details on |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
4621 setup for auto-startup." |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
4622 |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
4623 (interactive "P") |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
4624 |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
4625 (outline-mode t) |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
4626 |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
4627 (save-excursion |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
4628 (goto-char (point-min)) |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
4629 (if (looking-at outline-regexp) |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
4630 t |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
4631 (outline-open-topic 2) |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
4632 (insert-string (concat "Dummy outline topic header - see" |
29490 | 4633 "`outline-mode' docstring: `^Hm'.")) |
4634 (forward-line 1) | |
3430 | 4635 (goto-char (point-max)) |
29490 | 4636 (open-line 1) |
7416
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
4637 (outline-open-topic 0) |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
4638 (insert-string "Local emacs vars.\n") |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
4639 (outline-open-topic 1) |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
4640 (insert-string "(`outline-layout' is for allout.el outline-mode)\n") |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
4641 (outline-open-topic 0) |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
4642 (insert-string "Local variables:\n") |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
4643 (outline-open-topic 0) |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
4644 (insert-string (format "outline-layout: %s\n" |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
4645 (or outline-layout |
29490 | 4646 '(-1 : 0)))) |
7416
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
4647 (outline-open-topic 0) |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
4648 (insert-string "End:\n")))) |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4649 ;;;_ > solicit-char-in-string (prompt string &optional do-defaulting) |
3430 | 4650 (defun solicit-char-in-string (prompt string &optional do-defaulting) |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4651 "Solicit (with first arg PROMPT) choice of a character from string STRING. |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4652 |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4653 Optional arg DO-DEFAULTING indicates to accept empty input (CR)." |
3430 | 4654 |
4655 (let ((new-prompt prompt) | |
4656 got) | |
4657 | |
4658 (while (not got) | |
4659 (message "%s" new-prompt) | |
4660 | |
4661 ;; We do our own reading here, so we can circumvent, eg, special | |
29490 | 4662 ;; treatment for `?' character. (Oughta use minibuffer keymap instead.) |
3430 | 4663 (setq got |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4664 (char-to-string (let ((cursor-in-echo-area nil)) (read-char)))) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4665 |
29490 | 4666 (setq got |
4667 (cond ((string-match (regexp-quote got) string) got) | |
4668 ((and do-defaulting (string= got "\r")) | |
4669 ;; Return empty string to default: | |
4670 "") | |
4671 ((string= got "\C-g") (signal 'quit nil)) | |
4672 (t | |
4673 (setq new-prompt (concat prompt | |
4674 got | |
4675 " ...pick from: " | |
4676 string | |
4677 "")) | |
4678 nil)))) | |
4679 ;; got something out of loop - return it: | |
4680 got) | |
3430 | 4681 ) |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4682 ;;;_ > regexp-sans-escapes (string) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4683 (defun regexp-sans-escapes (regexp &optional successive-backslashes) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4684 "Return a copy of REGEXP with all character escapes stripped out. |
7416
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
4685 |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4686 Representations of actual backslashes - '\\\\\\\\' - are left as a |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4687 single backslash. |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4688 |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4689 Optional arg SUCCESSIVE-BACKSLASHES is used internally for recursion." |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4690 |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4691 (if (string= regexp "") |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4692 "" |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4693 ;; Set successive-backslashes to number if current char is |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4694 ;; backslash, or else to nil: |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4695 (setq successive-backslashes |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4696 (if (= (aref regexp 0) ?\\) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4697 (if successive-backslashes (1+ successive-backslashes) 1) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4698 nil)) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4699 (if (or (not successive-backslashes) (= 2 successive-backslashes)) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4700 ;; Include first char: |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4701 (concat (substring regexp 0 1) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4702 (regexp-sans-escapes (substring regexp 1))) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4703 ;; Exclude first char, but maintain count: |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4704 (regexp-sans-escapes (substring regexp 1) successive-backslashes)))) |
29490 | 4705 ;;;_ > my-region-active-p () |
4706 (defmacro my-region-active-p () | |
4707 (if (fboundp 'region-active-p) | |
4708 '(region-active-p) | |
4709 'mark-active)) | |
7416
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
4710 ;;;_ - add-hook definition for divergent emacsen |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4711 ;;;_ > add-hook (hook function &optional append) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4712 (if (not (fboundp 'add-hook)) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4713 (defun add-hook (hook function &optional append) |
7416
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
4714 "Add to the value of HOOK the function FUNCTION unless already present. |
15664
a50ebf4ac764
(outline-auto-activation, outline-layout)
Karl Heuer <kwzh@gnu.org>
parents:
15663
diff
changeset
|
4715 \(It becomes the first hook on the list unless optional APPEND is non-nil, in |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4716 which case it becomes the last). HOOK should be a symbol, and FUNCTION may be |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4717 any valid function. HOOK's value should be a list of functions, not a single |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4718 function. If HOOK is void, it is first set to nil." |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4719 (or (boundp hook) (set hook nil)) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4720 (or (if (consp function) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4721 ;; Clever way to tell whether a given lambda-expression |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4722 ;; is equal to anything in the hook. |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4723 (let ((tail (assoc (cdr function) (symbol-value hook)))) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4724 (equal function tail)) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4725 (memq function (symbol-value hook))) |
15664
a50ebf4ac764
(outline-auto-activation, outline-layout)
Karl Heuer <kwzh@gnu.org>
parents:
15663
diff
changeset
|
4726 (set hook |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4727 (if append |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4728 (nconc (symbol-value hook) (list function)) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4729 (cons function (symbol-value hook))))))) |
29490 | 4730 ;;;_ : my-mark-marker to accomodate divergent emacsen: |
4731 (defun my-mark-marker (&optional force buffer) | |
4732 "Accomodate the different signature for mark-marker across emacsen. | |
4733 | |
4734 GNU XEmacs takes two optional args, while mainline GNU Emacs does not, | |
4735 so pass them along when appropriate." | |
4736 (if (string-match " XEmacs " emacs-version) | |
4737 (mark-marker force buffer) | |
4738 (mark-marker))) | |
4739 | |
4740 ;;;_ #9 Under development | |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4741 ;;;_ > outline-bullet-isearch (&optional bullet) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4742 (defun outline-bullet-isearch (&optional bullet) |
29490 | 4743 "Isearch \(regexp) for topic with bullet BULLET." |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4744 (interactive) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4745 (if (not bullet) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4746 (setq bullet (solicit-char-in-string |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4747 "ISearch for topic with bullet: " |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4748 (regexp-sans-escapes outline-bullets-string)))) |
15664
a50ebf4ac764
(outline-auto-activation, outline-layout)
Karl Heuer <kwzh@gnu.org>
parents:
15663
diff
changeset
|
4749 |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4750 (let ((isearch-regexp t) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4751 (isearch-string (concat "^" |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4752 outline-header-prefix |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4753 "[ \t]*" |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4754 bullet))) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4755 (isearch-repeat 'forward) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4756 (isearch-mode t))) |
7416
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
4757 ;;;_ ? Re hooking up with isearch - use isearch-op-fun rather than |
15664
a50ebf4ac764
(outline-auto-activation, outline-layout)
Karl Heuer <kwzh@gnu.org>
parents:
15663
diff
changeset
|
4758 ;;; wrapping the isearch functions. |
3430 | 4759 |
4760 ;;;_* Local emacs vars. | |
7416
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
4761 ;;; The following `outline-layout' local variable setting: |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
4762 ;;; - closes all topics from the first topic to just before the third-to-last, |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
4763 ;;; - shows the children of the third to last (config vars) |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
4764 ;;; - and the second to last (code section), |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
4765 ;;; - and closes the last topic (this local-variables section). |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
4766 ;;;Local variables: |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
4767 ;;;outline-layout: (0 : -1 -1 0) |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
4768 ;;;End: |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
4769 |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
4770 ;; allout.el ends here |