Mercurial > emacs
annotate lisp/allout.el @ 21691:2a33987c0f02
Explain trouble with link farms in `make install'.
author | Richard M. Stallman <rms@gnu.org> |
---|---|
date | Tue, 21 Apr 1998 06:13:36 +0000 |
parents | 79a284372cfb |
children | eb628ee6aa2b |
rev | line source |
---|---|
13337 | 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 |
7527
1f09079e18c4
(outline-mode): Use outline-this-or-next-heading.
Richard M. Stallman <rms@gnu.org>
parents:
7476
diff
changeset
|
3 ;; Copyright (C) 1992, 1993, 1994 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 |
7527
1f09079e18c4
(outline-mode): Use outline-this-or-next-heading.
Richard M. Stallman <rms@gnu.org>
parents:
7476
diff
changeset
|
8 ;; Version: Id: allout.el,v 4.3 1994/05/12 17:43:08 klm Exp || |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
9 ;; Keywords: outline mode |
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 |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
31 ;; manipulation capabilities, subsuming and well beyond that of |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
32 ;; standard emacs outline mode. It is specifically aimed at |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
33 ;; supporting outline structuring and manipulation of syntax- |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
34 ;; sensitive text, eg programming languages. (For an example, see the |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
35 ;; allout code itself, which is organized in outline structure.) |
15664
a50ebf4ac764
(outline-auto-activation, outline-layout)
Karl Heuer <kwzh@gnu.org>
parents:
15663
diff
changeset
|
36 ;; |
7416
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
37 ;; It also includes such things as topic-oriented repositioning, cut, and |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
38 ;; paste; integral outline exposure-layout; incremental search with |
13964
4de229297f1f
(outline-primary-bullet, outline-numbered-bullet,
Karl Heuer <kwzh@gnu.org>
parents:
13337
diff
changeset
|
39 ;; dynamic exposure/concealment of concealed text; automatic topic-number |
7416
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
40 ;; maintenance; and many other features. |
15664
a50ebf4ac764
(outline-auto-activation, outline-layout)
Karl Heuer <kwzh@gnu.org>
parents:
15663
diff
changeset
|
41 ;; |
7416
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
42 ;; 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
|
43 ;; `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
|
44 ;; 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
|
45 ;; 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
|
46 ;; |
15664
a50ebf4ac764
(outline-auto-activation, outline-layout)
Karl Heuer <kwzh@gnu.org>
parents:
15663
diff
changeset
|
47 ;; Note - the lines beginning with `;;;_' are outline topic headers. |
a50ebf4ac764
(outline-auto-activation, outline-layout)
Karl Heuer <kwzh@gnu.org>
parents:
15663
diff
changeset
|
48 ;; 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
|
49 |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
50 ;;Ken Manheimer 301 975-3539 |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
51 ;;ken.manheimer@nist.gov FAX: 301 963-9137 |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
52 ;; |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
53 ;;Computer Systems and Communications Division |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
54 ;; |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
55 ;; Nat'l Institute of Standards and Technology |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
56 ;; Technology A151 |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
57 ;; Gaithersburg, MD 20899 |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
58 |
7416
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
59 ;;;_* Provide |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
60 (provide 'outline) |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
61 (provide 'allout) |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
62 |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
63 ;;;_* USER CUSTOMIZATION VARIABLES: |
21088 | 64 (defgroup allout nil |
65 "Extensive outline mode for use alone and with other modes." | |
66 :prefix "outline-" | |
67 :group 'outlines) | |
7416
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
68 |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
69 ;;;_ + 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
|
70 |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
71 ;;;_ = outline-auto-activation |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
72 (defvar outline-auto-activation nil |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
73 "*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
|
74 |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
75 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
|
76 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
|
77 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
|
78 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
|
79 |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
80 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
|
81 \(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
|
82 `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
|
83 |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
84 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
|
85 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
|
86 |
15664
a50ebf4ac764
(outline-auto-activation, outline-layout)
Karl Heuer <kwzh@gnu.org>
parents:
15663
diff
changeset
|
87 With value `activate', only auto-mode-activation is enabled, |
a50ebf4ac764
(outline-auto-activation, outline-layout)
Karl Heuer <kwzh@gnu.org>
parents:
15663
diff
changeset
|
88 auto-layout is not. |
7416
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
89 |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
90 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
|
91 enabled. |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
92 |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
93 See the docstring for `outline-init' for the proper interface to |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
94 this variable.") |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
95 ;;;_ = outline-layout |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
96 (defvar outline-layout nil |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
97 "*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
|
98 |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
99 Buffer-specific. |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
100 |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
101 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
|
102 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
|
103 automatically trigger allout outline-mode, provided `outline-init' |
a50ebf4ac764
(outline-auto-activation, outline-layout)
Karl Heuer <kwzh@gnu.org>
parents:
15663
diff
changeset
|
104 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
|
105 |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
106 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
|
107 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
|
108 the layout specification. |
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 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
|
111 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
|
112 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
|
113 |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
114 ;;;Local variables: |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
115 ;;;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
|
116 ;;;End: |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
117 |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
118 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
|
119 activated when the file is visited, followed by the equivalent of |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
120 `\(outline-expose-topic 0 : -1 -1 0\)'. \(This is the layout used for |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
121 the allout.el, itself.) |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
122 |
15664
a50ebf4ac764
(outline-auto-activation, outline-layout)
Karl Heuer <kwzh@gnu.org>
parents:
15663
diff
changeset
|
123 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
|
124 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
|
125 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
|
126 (make-variable-buffer-local 'outline-layout) |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
127 |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
128 ;;;_ = outline-header-prefix |
21088 | 129 (defcustom outline-header-prefix "." |
7416
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
130 "*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
|
131 |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
132 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
|
133 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
|
134 \(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
|
135 character, which is typically set to the outline-primary-bullet. Many |
21088 | 136 outlines start at level 2 to avoid this discrepancy." |
137 :type 'string | |
138 :group 'allout) | |
3430 | 139 (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
|
140 ;;;_ = outline-primary-bullet |
21088 | 141 (defcustom outline-primary-bullet "*" |
7416
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
142 "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
|
143 |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
144 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
|
145 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
|
146 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
|
147 |
15664
a50ebf4ac764
(outline-auto-activation, outline-layout)
Karl Heuer <kwzh@gnu.org>
parents:
15663
diff
changeset
|
148 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
|
149 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
|
150 and outline-distinctive-bullets-string for the range of available |
21088 | 151 bullets." |
152 :type 'string | |
153 :group 'allout) | |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
154 (make-variable-buffer-local 'outline-primary-bullet) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
155 ;;;_ = outline-plain-bullets-string |
21088 | 156 (defcustom outline-plain-bullets-string (concat outline-primary-bullet |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
157 "+-:.;,") |
7416
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
158 "*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
|
159 |
15664
a50ebf4ac764
(outline-auto-activation, outline-layout)
Karl Heuer <kwzh@gnu.org>
parents:
15663
diff
changeset
|
160 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
|
161 bullets. |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
162 |
15664
a50ebf4ac764
(outline-auto-activation, outline-layout)
Karl Heuer <kwzh@gnu.org>
parents:
15663
diff
changeset
|
163 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
|
164 |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
165 Outline mode has to be reactivated in order for changes to the value |
21088 | 166 of this var to take effect." |
167 :type 'string | |
168 :group 'allout) | |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
169 (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
|
170 ;;;_ = outline-distinctive-bullets-string |
21088 | 171 (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
|
172 "*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
|
173 |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
174 These bullets are not offered among the regular, level-specific |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
175 rotation, and are not altered by automatic rebulleting, as when |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
176 shifting the level of a topic. See `outline-plain-bullets-string' for |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
177 the selection of alternating bullets. |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
178 |
15664
a50ebf4ac764
(outline-auto-activation, outline-layout)
Karl Heuer <kwzh@gnu.org>
parents:
15663
diff
changeset
|
179 You must run `set-outline-regexp' in order for changes |
7416
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
180 to the value of this var to effect outline-mode operation. |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
181 |
15664
a50ebf4ac764
(outline-auto-activation, outline-layout)
Karl Heuer <kwzh@gnu.org>
parents:
15663
diff
changeset
|
182 DO NOT include the close-square-bracket, `]', on either of the bullet |
21088 | 183 strings." |
184 :type 'string | |
185 :group 'allout) | |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
186 (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
|
187 |
7416
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
188 ;;;_ = outline-use-mode-specific-leader |
21088 | 189 (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
|
190 "*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
|
191 |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
192 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
|
193 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
|
194 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
|
195 |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
196 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
|
197 |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
198 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
|
199 alist, then use comment-start string, if any, then use default \(`.'). |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
200 \(See note about use of comment-start strings, below.\) |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
201 |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
202 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
|
203 `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
|
204 |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
205 Value `nil' means to always use the default \(`.'\). |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
206 |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
207 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
|
208 `_' 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
|
209 comment strings. comment-start strings that do end in spaces are not |
15664
a50ebf4ac764
(outline-auto-activation, outline-layout)
Karl Heuer <kwzh@gnu.org>
parents:
15663
diff
changeset
|
210 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
|
211 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
|
212 can use `outline-mode-leaders' to override this behavior, when |
21088 | 213 incorrect.]" |
214 :type '(choice (const t) (const nil) string | |
215 (const outline-mode-leaders) | |
216 (const comment-start)) | |
217 :group 'allout) | |
7416
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
218 ;;;_ = outline-mode-leaders |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
219 (defvar outline-mode-leaders '() |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
220 "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
|
221 |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
222 Entries will be used in the stead (or lieu) of mode-specific |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
223 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
|
224 |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
225 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
|
226 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
|
227 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
|
228 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
|
229 |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
230 ;;;_ = outline-old-style-prefixes |
21088 | 231 (defcustom outline-old-style-prefixes nil |
15664
a50ebf4ac764
(outline-auto-activation, outline-layout)
Karl Heuer <kwzh@gnu.org>
parents:
15663
diff
changeset
|
232 "*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
|
233 |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
234 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
|
235 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
|
236 like the original emacs-outline style prefixes. |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
237 |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
238 Whatever the setting of this variable, both old and new style prefixes |
21088 | 239 are always respected by the topic maneuvering functions." |
240 :type 'boolean | |
241 :group 'allout) | |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
242 (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
|
243 ;;;_ = outline-stylish-prefixes - alternating bullets |
21088 | 244 (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
|
245 "*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
|
246 |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
247 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
|
248 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
|
249 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
|
250 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
|
251 |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
252 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
|
253 prefixes: |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
254 |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
255 * Top level |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
256 .* A topic |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
257 . + One level 3 subtopic |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
258 . . One level 4 subtopic |
7416
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
259 . . A second 4 subtopic |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
260 . + Another level 3 subtopic |
7416
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
261 . #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
|
262 . #2 Another |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
263 . ! 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
|
264 . #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
|
265 |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
266 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
|
267 numbered and other distinctive bullets retained): |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
268 |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
269 * Top level |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
270 .* A topic |
7416
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
271 . * One level 3 subtopic |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
272 . * One level 4 subtopic |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
273 . * A second 4 subtopic |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
274 . * Another level 3 subtopic |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
275 . #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
|
276 . #2 Another |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
277 . ! 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
|
278 . #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
|
279 |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
280 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
|
281 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
|
282 this variable setting. |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
283 |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
284 The setting of this var is not relevant when outline-old-style-prefixes |
21088 | 285 is non-nil." |
286 :type 'boolean | |
287 :group 'allout) | |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
288 (make-variable-buffer-local 'outline-stylish-prefixes) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
289 |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
290 ;;;_ = outline-numbered-bullet |
21088 | 291 (defcustom outline-numbered-bullet "#" |
7416
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
292 "*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
|
293 |
13964
4de229297f1f
(outline-primary-bullet, outline-numbered-bullet,
Karl Heuer <kwzh@gnu.org>
parents:
13337
diff
changeset
|
294 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
|
295 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
|
296 to \"#\", you can set it to a bullet of your choice. A nil value |
21088 | 297 disables numbering maintenance." |
298 :type '(choice (const nil) string) | |
299 :group 'allout) | |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
300 (make-variable-buffer-local 'outline-numbered-bullet) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
301 ;;;_ = outline-file-xref-bullet |
21088 | 302 (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
|
303 "*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
|
304 |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
305 Set this var to the bullet you want to use for file cross-references. |
21088 | 306 Set it to nil if you want to inhibit this capability." |
307 :type '(choice (const nil) string) | |
308 :group 'allout) | |
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 ;;;_ + LaTeX formatting |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
311 ;;;_ - outline-number-pages |
21088 | 312 (defcustom outline-number-pages nil |
313 "*Non-nil turns on page numbering for LaTeX formatting of an outline." | |
314 :type 'boolean | |
315 :group 'allout) | |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
316 ;;;_ - outline-label-style |
21088 | 317 (defcustom outline-label-style "\\large\\bf" |
318 "*Font and size of labels for LaTeX formatting of an outline." | |
319 :type 'string | |
320 :group 'allout) | |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
321 ;;;_ - outline-head-line-style |
21088 | 322 (defcustom outline-head-line-style "\\large\\sl " |
323 "*Font and size of entries for LaTeX formatting of an outline." | |
324 :type 'string | |
325 :group 'allout) | |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
326 ;;;_ - outline-body-line-style |
21088 | 327 (defcustom outline-body-line-style " " |
328 "*Font and size of entries for LaTeX formatting of an outline." | |
329 :type 'string | |
330 :group 'allout) | |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
331 ;;;_ - outline-title-style |
21088 | 332 (defcustom outline-title-style "\\Large\\bf" |
333 "*Font and size of titles for LaTeX formatting of an outline." | |
334 :type 'string | |
335 :group 'allout) | |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
336 ;;;_ - outline-title |
21088 | 337 (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
|
338 "*Expression to be evaluated to determine the title for LaTeX |
21088 | 339 formatted copy." |
340 :type 'sexp | |
341 :group 'allout) | |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
342 ;;;_ - outline-line-skip |
21088 | 343 (defcustom outline-line-skip ".05cm" |
344 "*Space between lines for LaTeX formatting of an outline." | |
345 :type 'string | |
346 :group 'allout) | |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
347 ;;;_ - outline-indent |
21088 | 348 (defcustom outline-indent ".3cm" |
349 "*LaTeX formatted depth-indent spacing." | |
350 :type 'string | |
351 :group 'allout) | |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
352 |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
353 ;;;_ + Miscellaneous customization |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
354 |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
355 ;;;_ = outline-keybindings-list |
15664
a50ebf4ac764
(outline-auto-activation, outline-layout)
Karl Heuer <kwzh@gnu.org>
parents:
15663
diff
changeset
|
356 ;;; 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
|
357 ;;; institute changes to this var. |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
358 (defvar outline-keybindings-list () |
7416
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
359 "*List of outline-mode key / function bindings. |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
360 |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
361 These bindings will be locally bound on the outline-mode-map. The |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
362 keys will be prefixed by outline-command-prefix, unless the cell |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
363 contains a third, no-nil element, in which case the initial string |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
364 will be used as is.") |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
365 (setq outline-keybindings-list |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
366 '( |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
367 ; Motion commands: |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
368 ("?t" outline-latexify-exposed) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
369 ("\C-n" outline-next-visible-heading) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
370 ("\C-p" outline-previous-visible-heading) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
371 ("\C-u" outline-up-current-level) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
372 ("\C-f" outline-forward-current-level) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
373 ("\C-b" outline-backward-current-level) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
374 ("\C-a" outline-beginning-of-current-entry) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
375 ("\C-e" outline-end-of-current-entry) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
376 ;;("\C-n" outline-next-line-or-topic) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
377 ;;("\C-p" outline-previous-line-or-topic) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
378 ; Exposure commands: |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
379 ("\C-i" outline-show-children) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
380 ("\C-s" outline-show-current-subtree) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
381 ("\C-h" outline-hide-current-subtree) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
382 ("\C-o" outline-show-current-entry) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
383 ("!" outline-show-all) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
384 ; Alteration commands: |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
385 (" " outline-open-sibtopic) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
386 ("." outline-open-subtopic) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
387 ("," outline-open-supertopic) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
388 ("'" outline-shift-in) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
389 (">" outline-shift-in) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
390 ("<" outline-shift-out) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
391 ("\C-m" outline-rebullet-topic) |
11661
9ac485495712
(outline-rebullet-current-heading): Change to C-c *.
Karl Heuer <kwzh@gnu.org>
parents:
11034
diff
changeset
|
392 ("*" outline-rebullet-current-heading) |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
393 ("#" outline-number-siblings) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
394 ("\C-k" outline-kill-line t) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
395 ("\C-y" outline-yank t) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
396 ("\M-y" outline-yank-pop t) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
397 ("\C-k" outline-kill-topic) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
398 ; Miscellaneous commands: |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
399 ("\C-@" outline-mark-topic) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
400 ("@" outline-resolve-xref) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
401 ("?c" outline-copy-exposed))) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
402 |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
403 ;;;_ = outline-command-prefix |
21088 | 404 (defcustom outline-command-prefix "\C-c" |
405 "*Key sequence to be used as prefix for outline mode command key bindings." | |
406 :type 'string | |
407 :group 'allout) | |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
408 |
7416
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
409 ;;;_ = outline-enwrap-isearch-mode |
21088 | 410 (defcustom outline-enwrap-isearch-mode t |
7416
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
411 "*Set non-nil to enable automatic exposure of concealed isearch targets. |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
412 |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
413 If non-nil, isearch will expose hidden text encountered in the course |
21088 | 414 of a search, and to reconceal it if the search is continued past it." |
415 :type 'boolean | |
416 :group 'allout) | |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
417 |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
418 ;;;_ = outline-use-hanging-indents |
21088 | 419 (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
|
420 "*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
|
421 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
|
422 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
|
423 where auto-fill occurs. |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
424 |
15664
a50ebf4ac764
(outline-auto-activation, outline-layout)
Karl Heuer <kwzh@gnu.org>
parents:
15663
diff
changeset
|
425 \[This feature no longer depends in any way on the `filladapt.el' |
21088 | 426 lisp-archive package.\]" |
427 :type 'boolean | |
428 :group 'allout) | |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
429 (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
|
430 |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
431 ;;;_ = outline-reindent-bodies |
21088 | 432 (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
|
433 'text) |
7416
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
434 "*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
|
435 |
7527
1f09079e18c4
(outline-mode): Use outline-this-or-next-heading.
Richard M. Stallman <rms@gnu.org>
parents:
7476
diff
changeset
|
436 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
|
437 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
|
438 the header. |
1f09079e18c4
(outline-mode): Use outline-this-or-next-heading.
Richard M. Stallman <rms@gnu.org>
parents:
7476
diff
changeset
|
439 |
1f09079e18c4
(outline-mode): Use outline-this-or-next-heading.
Richard M. Stallman <rms@gnu.org>
parents:
7476
diff
changeset
|
440 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
|
441 those that do not have the variable `comment-start' set. A value of |
21088 | 442 `force' enables reindent whether or not `comment-start' is set." |
443 :type '(choice (const nil) (const t) (const text) (const force)) | |
444 :group 'allout) | |
7527
1f09079e18c4
(outline-mode): Use outline-this-or-next-heading.
Richard M. Stallman <rms@gnu.org>
parents:
7476
diff
changeset
|
445 |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
446 (make-variable-buffer-local 'outline-reindent-bodies) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
447 |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
448 ;;;_ = outline-inhibit-protection |
21088 | 449 (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
|
450 "*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
|
451 |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
452 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
|
453 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
|
454 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
|
455 |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
456 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
|
457 deactivate and then reactivate the mode if you want to toggle the |
21088 | 458 behavior." |
459 :type 'boolean | |
460 :group 'allout) | |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
461 |
7416
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
462 ;;;_* CODE - no user customizations below. |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
463 |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
464 ;;;_ #1 Internal Outline Formatting and Configuration |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
465 ;;;_ - Version |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
466 ;;;_ = outline-version |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
467 (defvar outline-version |
7527
1f09079e18c4
(outline-mode): Use outline-this-or-next-heading.
Richard M. Stallman <rms@gnu.org>
parents:
7476
diff
changeset
|
468 (let ((rcs-rev "Revision: 4.3")) |
7416
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
469 (condition-case err |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
470 (save-match-data |
7527
1f09079e18c4
(outline-mode): Use outline-this-or-next-heading.
Richard M. Stallman <rms@gnu.org>
parents:
7476
diff
changeset
|
471 (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
|
472 (substring rcs-rev (match-beginning 1) (match-end 1))) |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
473 (error rcs-rev))) |
7527
1f09079e18c4
(outline-mode): Use outline-this-or-next-heading.
Richard M. Stallman <rms@gnu.org>
parents:
7476
diff
changeset
|
474 "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
|
475 ;;;_ > outline-version |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
476 (defun outline-version (&optional here) |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
477 "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
|
478 (interactive "P") |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
479 (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
|
480 (if here (insert-string msg)) |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
481 (message "%s" msg) |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
482 msg)) |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
483 ;;;_ - Topic header format |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
484 ;;;_ = outline-regexp |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
485 (defvar outline-regexp "" |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
486 "*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
|
487 |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
488 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
|
489 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
|
490 by set-outline-regexp.") |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
491 (make-variable-buffer-local 'outline-regexp) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
492 ;;;_ = outline-bullets-string |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
493 (defvar outline-bullets-string "" |
7416
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
494 "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
|
495 |
15664
a50ebf4ac764
(outline-auto-activation, outline-layout)
Karl Heuer <kwzh@gnu.org>
parents:
15663
diff
changeset
|
496 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
|
497 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
|
498 and `outline-distinctive-bullets-string'.") |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
499 (make-variable-buffer-local 'outline-bullets-string) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
500 ;;;_ = outline-bullets-string-len |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
501 (defvar outline-bullets-string-len 0 |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
502 "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
|
503 (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
|
504 ;;;_ = outline-line-boundary-regexp |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
505 (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
|
506 "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
|
507 |
7639 | 508 \(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
|
509 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
|
510 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
|
511 (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
|
512 ;;;_ = outline-bob-regexp |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
513 (defvar outline-bob-regexp () |
7416
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
514 "Like outline-line-boundary-regexp, for headers at beginning of buffer. |
7639 | 515 \(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
|
516 (make-variable-buffer-local 'outline-bob-regexp) |
3430 | 517 ;;;_ = outline-header-subtraction |
518 (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
|
519 "Outline-header prefix length to subtract when computing topic depth.") |
3430 | 520 (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
|
521 ;;;_ = outline-plain-bullets-string-len |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
522 (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
|
523 "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
|
524 (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
|
525 |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
526 |
7527
1f09079e18c4
(outline-mode): Use outline-this-or-next-heading.
Richard M. Stallman <rms@gnu.org>
parents:
7476
diff
changeset
|
527 ;;;_ X outline-reset-header-lead (header-lead) |
3430 | 528 (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
|
529 "*Reset the leading string used to identify topic headers." |
3430 | 530 (interactive "sNew lead string: ") |
531 (setq outline-header-prefix header-lead) | |
532 (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
|
533 (set-outline-regexp)) |
7527
1f09079e18c4
(outline-mode): Use outline-this-or-next-heading.
Richard M. Stallman <rms@gnu.org>
parents:
7476
diff
changeset
|
534 ;;;_ X outline-lead-with-comment-string (header-lead) |
3430 | 535 (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
|
536 "*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
|
537 |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
538 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
|
539 language comments. Returns the leading string." |
3430 | 540 |
541 (interactive "P") | |
542 (if (not (stringp header-lead)) | |
543 (setq header-lead (read-string | |
544 "String prefix for topic headers: "))) | |
545 (setq outline-reindent-bodies nil) | |
546 (outline-reset-header-lead header-lead) | |
547 header-lead) | |
7527
1f09079e18c4
(outline-mode): Use outline-this-or-next-heading.
Richard M. Stallman <rms@gnu.org>
parents:
7476
diff
changeset
|
548 ;;;_ > outline-infer-header-lead () |
1f09079e18c4
(outline-mode): Use outline-this-or-next-heading.
Richard M. Stallman <rms@gnu.org>
parents:
7476
diff
changeset
|
549 (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
|
550 "Determine appropriate `outline-header-prefix'. |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
551 |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
552 Works according to settings of: |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
553 |
7527
1f09079e18c4
(outline-mode): Use outline-this-or-next-heading.
Richard M. Stallman <rms@gnu.org>
parents:
7476
diff
changeset
|
554 `comment-start' |
7416
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
555 `outline-header-prefix' (default) |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
556 `outline-use-mode-specific-leader' |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
557 and `outline-mode-leaders'. |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
558 |
7527
1f09079e18c4
(outline-mode): Use outline-this-or-next-heading.
Richard M. Stallman <rms@gnu.org>
parents:
7476
diff
changeset
|
559 Apply this via \(re\)activation of `outline-mode', rather than |
1f09079e18c4
(outline-mode): Use outline-this-or-next-heading.
Richard M. Stallman <rms@gnu.org>
parents:
7476
diff
changeset
|
560 invoking it directly." |
7416
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
561 (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
|
562 (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
|
563 (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
|
564 '(outline-mode-leaders |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
565 comment-start |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
566 t))) |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
567 outline-use-mode-specific-leader |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
568 ;; 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
|
569 t))) |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
570 (leader |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
571 (cond |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
572 ((not use-leader) nil) |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
573 ;; Use the explicitly designated leader: |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
574 ((stringp use-leader) use-leader) |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
575 (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
|
576 ;; 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
|
577 (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
|
578 ;; ... 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
|
579 (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
|
580 comment-start |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
581 ;; Use comment-start, maybe tripled, and with |
15664
a50ebf4ac764
(outline-auto-activation, outline-layout)
Karl Heuer <kwzh@gnu.org>
parents:
15663
diff
changeset
|
582 ;; underscore: |
7416
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
583 (concat |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
584 (if (string= " " |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
585 (substring comment-start |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
586 (1- (length comment-start)))) |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
587 ;; 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
|
588 (substring comment-start 0 -1) |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
589 (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
|
590 ;; ... and append underscore, whichever: |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
591 "_"))))))) |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
592 (if (not leader) |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
593 nil |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
594 (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
|
595 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
|
596 (setq outline-header-prefix leader) |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
597 outline-header-prefix)))) |
7527
1f09079e18c4
(outline-mode): Use outline-this-or-next-heading.
Richard M. Stallman <rms@gnu.org>
parents:
7476
diff
changeset
|
598 ;;;_ > outline-infer-body-reindent () |
1f09079e18c4
(outline-mode): Use outline-this-or-next-heading.
Richard M. Stallman <rms@gnu.org>
parents:
7476
diff
changeset
|
599 (defun outline-infer-body-reindent () |
1f09079e18c4
(outline-mode): Use outline-this-or-next-heading.
Richard M. Stallman <rms@gnu.org>
parents:
7476
diff
changeset
|
600 "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
|
601 |
1f09079e18c4
(outline-mode): Use outline-this-or-next-heading.
Richard M. Stallman <rms@gnu.org>
parents:
7476
diff
changeset
|
602 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
|
603 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
|
604 file is programming code." |
1f09079e18c4
(outline-mode): Use outline-this-or-next-heading.
Richard M. Stallman <rms@gnu.org>
parents:
7476
diff
changeset
|
605 (if (and outline-reindent-bodies |
1f09079e18c4
(outline-mode): Use outline-this-or-next-heading.
Richard M. Stallman <rms@gnu.org>
parents:
7476
diff
changeset
|
606 comment-start |
1f09079e18c4
(outline-mode): Use outline-this-or-next-heading.
Richard M. Stallman <rms@gnu.org>
parents:
7476
diff
changeset
|
607 (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
|
608 (setq outline-reindent-bodies nil))) |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
609 ;;;_ > set-outline-regexp () |
3430 | 610 (defun set-outline-regexp () |
7416
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
611 "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
|
612 |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
613 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
|
614 `outline-distinctive-bullets-string'." |
3430 | 615 |
616 (interactive) | |
617 ;; Derive outline-bullets-string from user configured components: | |
618 (setq outline-bullets-string "") | |
619 (let ((strings (list 'outline-plain-bullets-string | |
620 'outline-distinctive-bullets-string)) | |
621 cur-string | |
622 cur-len | |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
623 cur-char |
3430 | 624 cur-char-string |
625 index | |
626 new-string) | |
627 (while strings | |
628 (setq new-string "") (setq index 0) | |
629 (setq cur-len (length (setq cur-string (symbol-value (car strings))))) | |
630 (while (< index cur-len) | |
631 (setq cur-char (aref cur-string index)) | |
632 (setq outline-bullets-string | |
633 (concat outline-bullets-string | |
634 (cond | |
635 ; Single dash would denote a | |
636 ; sequence, repeated denotes | |
637 ; a dash: | |
638 ((eq cur-char ?-) "--") | |
639 ; literal close-square-bracket | |
640 ; doesn't work right in the | |
641 ; expr, exclude it: | |
642 ((eq cur-char ?\]) "") | |
643 (t (regexp-quote (char-to-string cur-char)))))) | |
644 (setq index (1+ index))) | |
645 (setq strings (cdr strings))) | |
646 ) | |
647 ;; Derive next for repeated use in outline-pending-bullet: | |
648 (setq outline-plain-bullets-string-len (length outline-plain-bullets-string)) | |
649 (setq outline-header-subtraction (1- (length outline-header-prefix))) | |
650 ;; Produce the new outline-regexp: | |
651 (setq outline-regexp (concat "\\(\\" | |
652 outline-header-prefix | |
653 "[ \t]*[" | |
654 outline-bullets-string | |
655 "]\\)\\|\\" | |
656 outline-primary-bullet | |
657 "+\\|\^l")) | |
658 (setq outline-line-boundary-regexp | |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
659 (concat "\\([\n\r]\\)\\(" outline-regexp "\\)")) |
3430 | 660 (setq outline-bob-regexp |
661 (concat "\\(\\`\\)\\(" outline-regexp "\\)")) | |
662 ) | |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
663 ;;;_ - Key bindings |
7416
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
664 ;;;_ = outline-mode-map |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
665 (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
|
666 ;;;_ > 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
|
667 (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
|
668 "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
|
669 |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
670 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
|
671 See doc string for outline-keybindings-list for format of binding list." |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
672 (let ((map (or base-map (make-sparse-keymap)))) |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
673 (mapcar (lambda (cell) |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
674 (apply 'define-key map (if (null (cdr (cdr cell))) |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
675 (cons (concat outline-command-prefix |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
676 (car cell)) |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
677 (cdr cell)) |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
678 (list (car cell) (car (cdr cell)))))) |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
679 keymap-list) |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
680 map)) |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
681 ;;;_ = outline-prior-bindings - being deprecated. |
15664
a50ebf4ac764
(outline-auto-activation, outline-layout)
Karl Heuer <kwzh@gnu.org>
parents:
15663
diff
changeset
|
682 (defvar outline-prior-bindings nil |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
683 "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
|
684 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
|
685 activation. Being deprecated.") |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
686 ;;;_ = outline-added-bindings - being deprecated |
15664
a50ebf4ac764
(outline-auto-activation, outline-layout)
Karl Heuer <kwzh@gnu.org>
parents:
15663
diff
changeset
|
687 (defvar outline-added-bindings nil |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
688 "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
|
689 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
|
690 activation. Being deprecated.") |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
691 ;;;_ - Mode-Specific Variable Maintenance Utilities |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
692 ;;;_ = outline-mode-prior-settings |
3430 | 693 (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
|
694 "Internal outline mode use; settings to be resumed on mode deactivation.") |
3430 | 695 (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
|
696 ;;;_ > outline-resumptions (name &optional value) |
3430 | 697 (defun outline-resumptions (name &optional value) |
698 | |
7416
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
699 "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
|
700 |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
701 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
|
702 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
|
703 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
|
704 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
|
705 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
|
706 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
|
707 from the list." |
3430 | 708 |
709 (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
|
710 prior-capsule ; By `capsule' i mean a list |
3430 | 711 ; containing a value, so we can |
712 ; distinguish nil from no value. | |
713 ) | |
714 | |
715 (if value | |
716 | |
717 ;; Registering: | |
718 (progn | |
719 (if on-list | |
720 nil ; Already preserved prior value - don't mess with it. | |
721 ;; Register the old value, or nil if previously unbound: | |
722 (setq outline-mode-prior-settings | |
723 (cons (list name | |
724 (if (boundp name) (list (symbol-value name)))) | |
725 outline-mode-prior-settings))) | |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
726 ; And impose the new value, locally: |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
727 (progn (make-local-variable name) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
728 (set name (car value)))) |
3430 | 729 |
730 ;; Relinquishing: | |
731 (if (not on-list) | |
732 | |
733 ;; Oops, not registered - leave it be: | |
734 nil | |
735 | |
736 ;; Some registration: | |
737 ; reestablish it: | |
738 (setq prior-capsule (car (cdr on-list))) | |
739 (if prior-capsule | |
740 (set name (car prior-capsule)) ; Some prior value - reestablish it. | |
741 (makunbound name)) ; Previously unbound - demolish var. | |
742 ; Remove registration: | |
743 (let (rebuild) | |
744 (while outline-mode-prior-settings | |
745 (if (not (eq (car outline-mode-prior-settings) | |
746 on-list)) | |
747 (setq rebuild | |
748 (cons (car outline-mode-prior-settings) | |
749 rebuild))) | |
750 (setq outline-mode-prior-settings | |
751 (cdr outline-mode-prior-settings))) | |
752 (setq outline-mode-prior-settings rebuild))))) | |
753 ) | |
7416
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
754 ;;;_ - Mode-specific incidentals |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
755 ;;;_ = outline-during-write-cue nil |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
756 (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
|
757 "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
|
758 |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
759 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
|
760 `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
|
761 functions.") |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
762 ;;;_ = outline-override-protect nil |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
763 (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
|
764 "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
|
765 |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
766 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
|
767 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
|
768 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
|
769 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
|
770 (make-variable-buffer-local 'outline-override-protect) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
771 ;;;_ > outline-unprotected (expr) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
772 (defmacro outline-unprotected (expr) |
15664
a50ebf4ac764
(outline-auto-activation, outline-layout)
Karl Heuer <kwzh@gnu.org>
parents:
15663
diff
changeset
|
773 "Evaluate EXPRESSION with `outline-override-protect' let-bound to t." |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
774 (` (let ((outline-override-protect t)) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
775 (, expr)))) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
776 ;;;_ = outline-undo-aggregation |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
777 (defvar outline-undo-aggregation 30 |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
778 "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
|
779 |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
780 This is purely a kludge variable, regulating the compensation for a bug in |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
781 the way that before-change-function and undo interact.") |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
782 (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
|
783 ;;;_ = file-var-bug hack |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
784 (defvar outline-v18/9-file-var-hack nil |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
785 "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
|
786 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
|
787 to track repeats.") |
7416
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
788 ;;;_ > outline-write-file-hook () |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
789 (defun outline-write-file-hook () |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
790 "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
|
791 |
15664
a50ebf4ac764
(outline-auto-activation, outline-layout)
Karl Heuer <kwzh@gnu.org>
parents:
15663
diff
changeset
|
792 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
|
793 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
|
794 (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
|
795 nil) |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
796 |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
797 ;;;_ #2 Mode activation |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
798 ;;;_ = outline-mode |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
799 (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
|
800 (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
|
801 ;;;_ > outline-mode-p () |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
802 (defmacro outline-mode-p () |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
803 "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
|
804 'outline-mode) |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
805 ;;;_ = outline-explicitly-deactivated |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
806 (defvar outline-explicitly-deactivated nil |
13964
4de229297f1f
(outline-primary-bullet, outline-numbered-bullet,
Karl Heuer <kwzh@gnu.org>
parents:
13337
diff
changeset
|
807 "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
|
808 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
|
809 (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
|
810 ;;;_ > outline-init (&optional mode) |
1f09079e18c4
(outline-mode): Use outline-this-or-next-heading.
Richard M. Stallman <rms@gnu.org>
parents:
7476
diff
changeset
|
811 (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
|
812 "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
|
813 |
7527
1f09079e18c4
(outline-mode): Use outline-this-or-next-heading.
Richard M. Stallman <rms@gnu.org>
parents:
7476
diff
changeset
|
814 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
|
815 |
15664
a50ebf4ac764
(outline-auto-activation, outline-layout)
Karl Heuer <kwzh@gnu.org>
parents:
15663
diff
changeset
|
816 - nil \(or no argument) deactivate auto-activation/layout; |
a50ebf4ac764
(outline-auto-activation, outline-layout)
Karl Heuer <kwzh@gnu.org>
parents:
15663
diff
changeset
|
817 - `activate', enable auto-activation only; |
a50ebf4ac764
(outline-auto-activation, outline-layout)
Karl Heuer <kwzh@gnu.org>
parents:
15663
diff
changeset
|
818 - `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
|
819 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
|
820 - `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
|
821 - 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
|
822 any confirmation check. |
7416
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
823 |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
824 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
|
825 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
|
826 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
|
827 `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
|
828 |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
829 `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
|
830 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
|
831 setting. |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
832 |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
833 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
|
834 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
|
835 |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
836 \(require 'allout) |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
837 \(outline-init t)" |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
838 |
7527
1f09079e18c4
(outline-mode): Use outline-this-or-next-heading.
Richard M. Stallman <rms@gnu.org>
parents:
7476
diff
changeset
|
839 (interactive) |
1f09079e18c4
(outline-mode): Use outline-this-or-next-heading.
Richard M. Stallman <rms@gnu.org>
parents:
7476
diff
changeset
|
840 (if (interactive-p) |
7416
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
841 (progn |
7527
1f09079e18c4
(outline-mode): Use outline-this-or-next-heading.
Richard M. Stallman <rms@gnu.org>
parents:
7476
diff
changeset
|
842 (setq mode |
1f09079e18c4
(outline-mode): Use outline-this-or-next-heading.
Richard M. Stallman <rms@gnu.org>
parents:
7476
diff
changeset
|
843 (completing-read |
1f09079e18c4
(outline-mode): Use outline-this-or-next-heading.
Richard M. Stallman <rms@gnu.org>
parents:
7476
diff
changeset
|
844 (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
|
845 "(empty for report, ? for options) ") |
1f09079e18c4
(outline-mode): Use outline-this-or-next-heading.
Richard M. Stallman <rms@gnu.org>
parents:
7476
diff
changeset
|
846 '(("nil")("full")("activate")("deactivate") |
1f09079e18c4
(outline-mode): Use outline-this-or-next-heading.
Richard M. Stallman <rms@gnu.org>
parents:
7476
diff
changeset
|
847 ("ask") ("report") ("")) |
1f09079e18c4
(outline-mode): Use outline-this-or-next-heading.
Richard M. Stallman <rms@gnu.org>
parents:
7476
diff
changeset
|
848 nil |
1f09079e18c4
(outline-mode): Use outline-this-or-next-heading.
Richard M. Stallman <rms@gnu.org>
parents:
7476
diff
changeset
|
849 t)) |
1f09079e18c4
(outline-mode): Use outline-this-or-next-heading.
Richard M. Stallman <rms@gnu.org>
parents:
7476
diff
changeset
|
850 (if (string= mode "") |
1f09079e18c4
(outline-mode): Use outline-this-or-next-heading.
Richard M. Stallman <rms@gnu.org>
parents:
7476
diff
changeset
|
851 (setq mode 'report) |
1f09079e18c4
(outline-mode): Use outline-this-or-next-heading.
Richard M. Stallman <rms@gnu.org>
parents:
7476
diff
changeset
|
852 (setq mode (intern-soft mode))))) |
1f09079e18c4
(outline-mode): Use outline-this-or-next-heading.
Richard M. Stallman <rms@gnu.org>
parents:
7476
diff
changeset
|
853 (let |
1f09079e18c4
(outline-mode): Use outline-this-or-next-heading.
Richard M. Stallman <rms@gnu.org>
parents:
7476
diff
changeset
|
854 ;; 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
|
855 ((hook 'outline-find-file-hook) |
1f09079e18c4
(outline-mode): Use outline-this-or-next-heading.
Richard M. Stallman <rms@gnu.org>
parents:
7476
diff
changeset
|
856 (curr-mode 'outline-auto-activation)) |
15664
a50ebf4ac764
(outline-auto-activation, outline-layout)
Karl Heuer <kwzh@gnu.org>
parents:
15663
diff
changeset
|
857 |
7527
1f09079e18c4
(outline-mode): Use outline-this-or-next-heading.
Richard M. Stallman <rms@gnu.org>
parents:
7476
diff
changeset
|
858 (cond ((not mode) |
1f09079e18c4
(outline-mode): Use outline-this-or-next-heading.
Richard M. Stallman <rms@gnu.org>
parents:
7476
diff
changeset
|
859 (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
|
860 (if (interactive-p) |
1f09079e18c4
(outline-mode): Use outline-this-or-next-heading.
Richard M. Stallman <rms@gnu.org>
parents:
7476
diff
changeset
|
861 (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
|
862 ((eq mode 'report) |
1f09079e18c4
(outline-mode): Use outline-this-or-next-heading.
Richard M. Stallman <rms@gnu.org>
parents:
7476
diff
changeset
|
863 (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
|
864 (outline-init nil) |
1f09079e18c4
(outline-mode): Use outline-this-or-next-heading.
Richard M. Stallman <rms@gnu.org>
parents:
7476
diff
changeset
|
865 ;; 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
|
866 (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
|
867 (t (add-hook 'find-file-hooks hook) |
15664
a50ebf4ac764
(outline-auto-activation, outline-layout)
Karl Heuer <kwzh@gnu.org>
parents:
15663
diff
changeset
|
868 (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
|
869 (cond ((eq mode 'activate) |
1f09079e18c4
(outline-mode): Use outline-this-or-next-heading.
Richard M. Stallman <rms@gnu.org>
parents:
7476
diff
changeset
|
870 (message |
1f09079e18c4
(outline-mode): Use outline-this-or-next-heading.
Richard M. Stallman <rms@gnu.org>
parents:
7476
diff
changeset
|
871 "Outline mode auto-activation enabled.") |
1f09079e18c4
(outline-mode): Use outline-this-or-next-heading.
Richard M. Stallman <rms@gnu.org>
parents:
7476
diff
changeset
|
872 'activate) |
1f09079e18c4
(outline-mode): Use outline-this-or-next-heading.
Richard M. Stallman <rms@gnu.org>
parents:
7476
diff
changeset
|
873 ((eq mode 'report) |
1f09079e18c4
(outline-mode): Use outline-this-or-next-heading.
Richard M. Stallman <rms@gnu.org>
parents:
7476
diff
changeset
|
874 ;; Return the current mode setting: |
1f09079e18c4
(outline-mode): Use outline-this-or-next-heading.
Richard M. Stallman <rms@gnu.org>
parents:
7476
diff
changeset
|
875 (outline-init mode)) |
1f09079e18c4
(outline-mode): Use outline-this-or-next-heading.
Richard M. Stallman <rms@gnu.org>
parents:
7476
diff
changeset
|
876 ((eq mode 'ask) |
1f09079e18c4
(outline-mode): Use outline-this-or-next-heading.
Richard M. Stallman <rms@gnu.org>
parents:
7476
diff
changeset
|
877 (message |
1f09079e18c4
(outline-mode): Use outline-this-or-next-heading.
Richard M. Stallman <rms@gnu.org>
parents:
7476
diff
changeset
|
878 (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
|
879 "-layout \(upon confirmation) enabled.")) |
1f09079e18c4
(outline-mode): Use outline-this-or-next-heading.
Richard M. Stallman <rms@gnu.org>
parents:
7476
diff
changeset
|
880 'ask) |
1f09079e18c4
(outline-mode): Use outline-this-or-next-heading.
Richard M. Stallman <rms@gnu.org>
parents:
7476
diff
changeset
|
881 ((message |
1f09079e18c4
(outline-mode): Use outline-this-or-next-heading.
Richard M. Stallman <rms@gnu.org>
parents:
7476
diff
changeset
|
882 "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
|
883 'full))))))) |
15664
a50ebf4ac764
(outline-auto-activation, outline-layout)
Karl Heuer <kwzh@gnu.org>
parents:
15663
diff
changeset
|
884 |
7416
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
885 ;;;_ > outline-mode (&optional toggle) |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
886 ;;;_ : Defun: |
3430 | 887 (defun outline-mode (&optional toggle) |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
888 ;;;_ . Doc string: |
7416
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
889 "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
|
890 |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
891 Optional arg forces mode reactivation iff arg is positive num or symbol. |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
892 |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
893 Allout outline mode provides extensive outline formatting and |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
894 manipulation capabilities. It is specifically aimed at supporting |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
895 outline structuring and manipulation of syntax-sensitive text, eg |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
896 programming languages. \(For an example, see the allout code itself, |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
897 which is organized in outline structure.\) |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
898 |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
899 It also includes such things as topic-oriented repositioning, cut, and |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
900 paste; integral outline exposure-layout; incremental search with |
13964
4de229297f1f
(outline-primary-bullet, outline-numbered-bullet,
Karl Heuer <kwzh@gnu.org>
parents:
13337
diff
changeset
|
901 dynamic exposure/concealment of concealed text; automatic topic-number |
7416
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
902 maintenance; and many other features. |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
903 |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
904 See the docstring of the variable `outline-init' for instructions on |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
905 priming your emacs session for automatic activation of outline-mode, |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
906 according to file-var settings of the `outline-layout' variable. |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
907 |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
908 Below is a description of the bindings, and then explanation of |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
909 special outline-mode features and terminology. |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
910 |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
911 The bindings themselves are established according to the values of |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
912 variables `outline-keybindings-list' and `outline-command-prefix', |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
913 each time the mode is invoked. Prior bindings are resurrected when |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
914 the mode is revoked. |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
915 |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
916 Navigation: Exposure Control: |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
917 ---------- ---------------- |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
918 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
|
919 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
|
920 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
|
921 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
|
922 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
|
923 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
|
924 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
|
925 |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
926 Topic Header Production: |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
927 ----------------------- |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
928 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
|
929 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
|
930 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
|
931 |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
932 Topic Level and Prefix Adjustment: |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
933 --------------------------------- |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
934 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
|
935 C-c < outline-shift-out ... less deep. |
15664
a50ebf4ac764
(outline-auto-activation, outline-layout)
Karl Heuer <kwzh@gnu.org>
parents:
15663
diff
changeset
|
936 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
|
937 - 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
|
938 alternated according to nesting depth. |
11661
9ac485495712
(outline-rebullet-current-heading): Change to C-c *.
Karl Heuer <kwzh@gnu.org>
parents:
11034
diff
changeset
|
939 C-c * 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
|
940 current topic. |
3430 | 941 C-c # outline-number-siblings Number bullets of topic and siblings - the |
942 offspring are not affected. With repeat | |
943 count, revoke numbering. | |
944 | |
7416
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
945 Topic-oriented Killing and Yanking: |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
946 ---------------------------------- |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
947 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
|
948 C-k outline-kill-line Like kill-line, but reconciles numbering, etc. |
3430 | 949 C-y outline-yank Yank, adjusting depth of yanked topic to |
950 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
|
951 heading (ie, prefix sans text). |
3430 | 952 M-y outline-yank-pop Is to outline-yank as yank-pop is to yank |
953 | |
7416
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
954 Misc commands: |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
955 ------------- |
3430 | 956 C-c @ outline-resolve-xref pop-to-buffer named by xref (cf |
7416
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
957 outline-file-xref-bullet) |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
958 C-c c outline-copy-exposed Copy current topic outline sans concealed |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
959 text, to buffer with name derived from |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
960 current buffer - \"XXX exposed\" |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
961 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
|
962 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
|
963 for `outline-layout'. |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
964 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
|
965 auto-activation. |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
966 |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
967 HOT-SPOT Operation |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
968 |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
969 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
|
970 navigation and exposure control. |
3430 | 971 |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
972 \\<outline-mode-map> |
7416
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
973 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
|
974 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
|
975 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
|
976 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
|
977 \(\\[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
|
978 |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
979 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
|
980 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
|
981 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
|
982 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
|
983 operation. |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
984 |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
985 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
|
986 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
|
987 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
|
988 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
|
989 |
7416
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
990 Terminology |
3430 | 991 |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
992 Topic hierarchy constituents - TOPICS and SUBTOPICS: |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
993 |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
994 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
|
995 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
|
996 CURRENT topic: |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
997 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
|
998 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
|
999 containment. Also called the: |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1000 LEVEL: The same as DEPTH. |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1001 |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1002 ANCESTORS: |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1003 The topics that contain a topic. |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1004 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
|
1005 the topic. |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1006 OFFSPRING: |
7416
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1007 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
|
1008 SUBTOPIC: |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1009 An immediate offspring of a topic; |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1010 CHILDREN: |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1011 The immediate offspring of a topic. |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1012 SIBLINGS: |
7416
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1013 Topics having the same parent and depth. |
15664
a50ebf4ac764
(outline-auto-activation, outline-layout)
Karl Heuer <kwzh@gnu.org>
parents:
15663
diff
changeset
|
1014 |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1015 Topic text constituents: |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1016 |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1017 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
|
1018 text. |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1019 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
|
1020 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
|
1021 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
|
1022 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
|
1023 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
|
1024 |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1025 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
|
1026 of the topic. |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1027 PREFIX-LEAD: |
15664
a50ebf4ac764
(outline-auto-activation, outline-layout)
Karl Heuer <kwzh@gnu.org>
parents:
15663
diff
changeset
|
1028 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
|
1029 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
|
1030 `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
|
1031 |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1032 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
|
1033 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
|
1034 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
|
1035 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
|
1036 docstring for more detail. |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1037 PREFIX-PADDING: |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1038 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
|
1039 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
|
1040 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
|
1041 the characters listed on `outline-plain-bullets-string' or |
a50ebf4ac764
(outline-auto-activation, outline-layout)
Karl Heuer <kwzh@gnu.org>
parents:
15663
diff
changeset
|
1042 `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
|
1043 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
|
1044 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
|
1045 topic. |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1046 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
|
1047 BODY: Same as ENTRY. |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1048 |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1049 |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1050 EXPOSURE: |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1051 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
|
1052 of its offspring and contained text. |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1053 CONCEALED: |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1054 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
|
1055 units of concealed text is represented by `...' ellipses. |
a50ebf4ac764
(outline-auto-activation, outline-layout)
Karl Heuer <kwzh@gnu.org>
parents:
15663
diff
changeset
|
1056 (Ref the `selective-display' var.) |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1057 |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1058 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
|
1059 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
|
1060 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
|
1061 ;;;_ . Code |
3430 | 1062 (interactive "P") |
1063 | |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1064 (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
|
1065 (outline-mode-p))) |
15664
a50ebf4ac764
(outline-auto-activation, outline-layout)
Karl Heuer <kwzh@gnu.org>
parents:
15663
diff
changeset
|
1066 ; Massage universal-arg `toggle' val: |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1067 (toggle (and toggle |
7416
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1068 (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
|
1069 toggle))) |
13964
4de229297f1f
(outline-primary-bullet, outline-numbered-bullet,
Karl Heuer <kwzh@gnu.org>
parents:
13337
diff
changeset
|
1070 ; Activation specifically demanded? |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1071 (explicit-activation (or |
7416
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1072 ;; |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1073 (and toggle |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1074 (or (symbolp toggle) |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1075 (and (natnump toggle) |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1076 (not (zerop toggle))))))) |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1077 ;; outline-mode already called once during this complex command? |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1078 (same-complex-command (eq outline-v18/9-file-var-hack |
7416
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1079 (car command-history))) |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1080 do-layout |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1081 ) |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1082 |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1083 ; See comments below re v19.18,.19 bug. |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1084 (setq outline-v18/9-file-var-hack (car command-history)) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1085 |
3430 | 1086 (cond |
1087 | |
7416
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1088 ;; 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
|
1089 ;; 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
|
1090 ;; 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
|
1091 ;; 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
|
1092 ;; skip everything. |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1093 ((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
|
1094 ; 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
|
1095 active ; Already activated. |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1096 (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
|
1097 (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
|
1098 emacs-version)); 19.19. |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1099 t) |
15664
a50ebf4ac764
(outline-auto-activation, outline-layout)
Karl Heuer <kwzh@gnu.org>
parents:
15663
diff
changeset
|
1100 |
7416
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1101 ;; Deactivation: |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1102 ((and (not explicit-activation) |
7416
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1103 (or active toggle)) |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1104 ; Activation not explicitly |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1105 ; requested, and either in |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1106 ; active state or *de*activation |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1107 ; specifically requested: |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1108 (setq outline-explicitly-deactivated t) |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1109 (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
|
1110 ; Revoke those keys that remain |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1111 ; as we set them: |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1112 (let ((curr-loc (current-local-map))) |
7416
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1113 (mapcar '(lambda (cell) |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1114 (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
|
1115 (car (cdr cell))) |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1116 (define-key curr-loc (car cell) |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1117 (assq (car cell) outline-prior-bindings)))) |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1118 outline-added-bindings) |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1119 (outline-resumptions 'outline-added-bindings) |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1120 (outline-resumptions 'outline-prior-bindings))) |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1121 |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1122 (if outline-old-style-prefixes |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1123 (progn |
7416
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1124 (outline-resumptions 'outline-primary-bullet) |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1125 (outline-resumptions 'outline-old-style-prefixes))) |
3430 | 1126 (outline-resumptions 'selective-display) |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1127 (if (and (boundp 'before-change-function) before-change-function) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1128 (outline-resumptions 'before-change-function)) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1129 (setq pre-command-hook (delq 'outline-pre-command-business |
7416
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1130 pre-command-hook)) |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1131 (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
|
1132 (delq 'outline-write-file-hook |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1133 local-write-file-hooks)) |
3430 | 1134 (outline-resumptions 'paragraph-start) |
1135 (outline-resumptions 'paragraph-separate) | |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1136 (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
|
1137 'auto-fill-hook |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1138 'auto-fill-function)) |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1139 (outline-resumptions 'outline-former-auto-filler) |
3430 | 1140 (setq outline-mode nil)) |
1141 | |
7416
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1142 ;; Activation: |
3430 | 1143 ((not active) |
7416
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1144 (setq outline-explicitly-deactivated nil) |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1145 (if outline-old-style-prefixes |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1146 (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
|
1147 (outline-resumptions 'outline-primary-bullet '("*")) |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1148 (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
|
1149 |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1150 (outline-infer-header-lead) |
7527
1f09079e18c4
(outline-mode): Use outline-this-or-next-heading.
Richard M. Stallman <rms@gnu.org>
parents:
7476
diff
changeset
|
1151 (outline-infer-body-reindent) |
7416
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1152 |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1153 (set-outline-regexp) |
7416
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1154 |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1155 ; Produce map from current version |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1156 ; of outline-keybindings-list: |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1157 (if (boundp 'minor-mode-map-alist) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1158 |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1159 (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
|
1160 ; epoch, minor-mode key bindings: |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1161 (setq outline-mode-map |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1162 (produce-outline-mode-map outline-keybindings-list)) |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1163 (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
|
1164 ; 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
|
1165 ; if not already there: |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1166 (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
|
1167 minor-mode-map-alist)) |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1168 (setq minor-mode-map-alist |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1169 (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
|
1170 minor-mode-map-alist)))) |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1171 |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1172 ; V18 minor-mode key bindings: |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1173 ; Stash record of added bindings |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1174 ; for later revocation: |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1175 (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
|
1176 (list outline-keybindings-list)) |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1177 (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
|
1178 (list (current-local-map))) |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1179 ; and add them: |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1180 (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
|
1181 (current-local-map))) |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1182 ) |
15664
a50ebf4ac764
(outline-auto-activation, outline-layout)
Karl Heuer <kwzh@gnu.org>
parents:
15663
diff
changeset
|
1183 |
7416
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1184 ; selective-display is the |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1185 ; emacs conditional exposure |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1186 ; mechanism: |
3430 | 1187 (outline-resumptions 'selective-display '(t)) |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1188 (if outline-inhibit-protection |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1189 t |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1190 (outline-resumptions 'before-change-function |
7416
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1191 '(outline-before-change-protect))) |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1192 ; Temporarily set by any outline |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1193 ; 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
|
1194 ; deal properly with concealed text. |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1195 (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
|
1196 ; 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
|
1197 ; respect for topic headline, |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1198 ; hanging-indents, etc: |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1199 (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
|
1200 'auto-fill-hook |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1201 'auto-fill-function)) |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1202 (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
|
1203 ;; 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
|
1204 (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
|
1205 ;; 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
|
1206 (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
|
1207 ;; Paragraphs are broken by topic headlines. |
3430 | 1208 (make-local-variable 'paragraph-start) |
1209 (outline-resumptions 'paragraph-start | |
10867
bbfb197435e3
(outline-mode): Remove ^ from paragraph-start & -separate.
Boris Goldowsky <boris@gnu.org>
parents:
7676
diff
changeset
|
1210 (list (concat paragraph-start "\\|\\(" |
7416
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1211 outline-regexp "\\)"))) |
3430 | 1212 (make-local-variable 'paragraph-separate) |
1213 (outline-resumptions 'paragraph-separate | |
10867
bbfb197435e3
(outline-mode): Remove ^ from paragraph-start & -separate.
Boris Goldowsky <boris@gnu.org>
parents:
7676
diff
changeset
|
1214 (list (concat paragraph-separate "\\|\\(" |
7416
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1215 outline-regexp "\\)"))) |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1216 |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1217 (or (assq 'outline-mode minor-mode-alist) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1218 (setq minor-mode-alist |
7416
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1219 (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
|
1220 |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1221 (if outline-layout |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1222 (setq do-layout t)) |
3430 | 1223 |
1224 (if outline-enwrap-isearch-mode | |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1225 (outline-enwrap-isearch)) |
7416
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1226 |
3430 | 1227 (run-hooks 'outline-mode-hook) |
1228 (setq outline-mode t)) | |
7416
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1229 |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1230 ;; Reactivation: |
7527
1f09079e18c4
(outline-mode): Use outline-this-or-next-heading.
Richard M. Stallman <rms@gnu.org>
parents:
7476
diff
changeset
|
1231 ((setq do-layout t) |
1f09079e18c4
(outline-mode): Use outline-this-or-next-heading.
Richard M. Stallman <rms@gnu.org>
parents:
7476
diff
changeset
|
1232 (outline-infer-body-reindent)) |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1233 ) ; cond |
7416
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1234 |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1235 (if (and do-layout |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1236 outline-auto-activation |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1237 (listp outline-layout) |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1238 (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
|
1239 (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
|
1240 (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
|
1241 (buffer-name) |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1242 outline-layout)) |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1243 t |
7527
1f09079e18c4
(outline-mode): Use outline-this-or-next-heading.
Richard M. Stallman <rms@gnu.org>
parents:
7476
diff
changeset
|
1244 (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
|
1245 nil) |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1246 t))) |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1247 (save-excursion |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1248 (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
|
1249 (goto-char 0) |
7527
1f09079e18c4
(outline-mode): Use outline-this-or-next-heading.
Richard M. Stallman <rms@gnu.org>
parents:
7476
diff
changeset
|
1250 (outline-this-or-next-heading) |
1f09079e18c4
(outline-mode): Use outline-this-or-next-heading.
Richard M. Stallman <rms@gnu.org>
parents:
7476
diff
changeset
|
1251 (condition-case err |
15664
a50ebf4ac764
(outline-auto-activation, outline-layout)
Karl Heuer <kwzh@gnu.org>
parents:
15663
diff
changeset
|
1252 (progn |
7527
1f09079e18c4
(outline-mode): Use outline-this-or-next-heading.
Richard M. Stallman <rms@gnu.org>
parents:
7476
diff
changeset
|
1253 (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
|
1254 (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
|
1255 ;; 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
|
1256 ;; interrupt, eg, file visit: |
1f09079e18c4
(outline-mode): Use outline-this-or-next-heading.
Richard M. Stallman <rms@gnu.org>
parents:
7476
diff
changeset
|
1257 (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
|
1258 (sit-for 1))))) |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1259 outline-mode |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1260 ) ; let* |
7416
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1261 ) ; defun |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1262 |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1263 ;;;_ #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
|
1264 ;;; All the basic outline functions that directly do string matches to |
3430 | 1265 ;;; 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
|
1266 ;;; `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
|
1267 ;;; 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
|
1268 ;;; 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
|
1269 ;;; 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
|
1270 ;;; 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
|
1271 ;;;_ = outline-recent-prefix-beginning |
3430 | 1272 (defvar outline-recent-prefix-beginning 0 |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1273 "Buffer point of the start of the last topic prefix encountered.") |
3430 | 1274 (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
|
1275 ;;;_ = outline-recent-prefix-end |
3430 | 1276 (defvar outline-recent-prefix-end 0 |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1277 "Buffer point of the end of the last topic prefix encountered.") |
3430 | 1278 (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
|
1279 ;;;_ = outline-recent-end-of-subtree |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1280 (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
|
1281 "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
|
1282 (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
|
1283 ;;;_ > outline-prefix-data (beg end) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1284 (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
|
1285 "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
|
1286 |
15664
a50ebf4ac764
(outline-auto-activation, outline-layout)
Karl Heuer <kwzh@gnu.org>
parents:
15663
diff
changeset
|
1287 For reference by `outline-recent' funcs. Returns BEGINNING." |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1288 (` (setq outline-recent-prefix-end (, end) |
7416
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1289 outline-recent-prefix-beginning (, beg)))) |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1290 ;;;_ > outline-recent-depth () |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1291 (defmacro outline-recent-depth () |
7416
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1292 "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
|
1293 |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1294 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
|
1295 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
|
1296 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
|
1297 to return the current depth." |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1298 |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1299 '(max 1 (- outline-recent-prefix-end |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1300 outline-recent-prefix-beginning |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1301 outline-header-subtraction))) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1302 ;;;_ > outline-recent-prefix () |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1303 (defmacro outline-recent-prefix () |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1304 "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
|
1305 |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1306 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
|
1307 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
|
1308 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
|
1309 to return the current depth." |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1310 '(buffer-substring outline-recent-prefix-beginning |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1311 outline-recent-prefix-end)) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1312 ;;;_ > outline-recent-bullet () |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1313 (defmacro outline-recent-bullet () |
7416
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1314 "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
|
1315 |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1316 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
|
1317 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
|
1318 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
|
1319 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
|
1320 '(buffer-substring (1- outline-recent-prefix-end) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1321 outline-recent-prefix-end)) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1322 |
7416
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1323 ;;;_ #4 Navigation |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1324 |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1325 ;;;_ - Position Assessment |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1326 ;;;_ : Location Predicates |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1327 ;;;_ > outline-on-current-heading-p () |
3430 | 1328 (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
|
1329 "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
|
1330 |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1331 Actually, returns prefix beginning point." |
3430 | 1332 (save-excursion |
1333 (beginning-of-line) | |
1334 (and (looking-at outline-regexp) | |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1335 (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
|
1336 ;;;_ > outline-e-o-prefix-p () |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1337 (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
|
1338 "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
|
1339 (and (save-excursion (beginning-of-line) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1340 (looking-at outline-regexp)) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1341 (= (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
|
1342 ;;;_ > outline-hidden-p () |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1343 (defmacro outline-hidden-p () |
3430 | 1344 "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
|
1345 '(save-excursion |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1346 (and (re-search-backward "[\n\r]" () t) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1347 (= ?\r (following-char))))) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1348 ;;;_ > outline-visible-p () |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1349 (defmacro outline-visible-p () |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1350 "True if point is not in hidden text." |
3430 | 1351 (interactive) |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1352 '(not (outline-hidden-p))) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1353 ;;;_ : Location attributes |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1354 ;;;_ > outline-depth () |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1355 (defmacro outline-depth () |
7416
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1356 "Like outline-current-depth, but respects hidden as well as visible topics." |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1357 '(save-excursion |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1358 (if (outline-goto-prefix) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1359 (outline-recent-depth) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1360 (progn |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1361 ;; Oops, no prefix, zero prefix data: |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1362 (outline-prefix-data (point)(point)) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1363 ;; ... and return 0: |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1364 0)))) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1365 ;;;_ > outline-current-depth () |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1366 (defmacro outline-current-depth () |
7416
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1367 "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
|
1368 '(save-excursion |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1369 (if (outline-back-to-current-heading) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1370 (max 1 |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1371 (- outline-recent-prefix-end |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1372 outline-recent-prefix-beginning |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1373 outline-header-subtraction)) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1374 0))) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1375 ;;;_ > outline-get-current-prefix () |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1376 (defun outline-get-current-prefix () |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1377 "Topic prefix of the current topic." |
3430 | 1378 (save-excursion |
1379 (if (outline-goto-prefix) | |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1380 (outline-recent-prefix)))) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1381 ;;;_ > outline-get-bullet () |
3430 | 1382 (defun outline-get-bullet () |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1383 "Return bullet of containing topic (visible or not)." |
3430 | 1384 (save-excursion |
1385 (and (outline-goto-prefix) | |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1386 (outline-recent-bullet)))) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1387 ;;;_ > outline-current-bullet () |
3430 | 1388 (defun outline-current-bullet () |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1389 "Return bullet of current (visible) topic heading, or none if none found." |
3430 | 1390 (condition-case err |
1391 (save-excursion | |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1392 (outline-back-to-current-heading) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1393 (buffer-substring (- outline-recent-prefix-end 1) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1394 outline-recent-prefix-end)) |
3430 | 1395 ;; Quick and dirty provision, ostensibly for missing bullet: |
1396 (args-out-of-range nil)) | |
1397 ) | |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1398 ;;;_ > outline-get-prefix-bullet (prefix) |
3430 | 1399 (defun outline-get-prefix-bullet (prefix) |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1400 "Return the bullet of the header prefix string PREFIX." |
3430 | 1401 ;; Doesn't make sense if we're old-style prefixes, but this just |
1402 ;; oughtn't be called then, so forget about it... | |
1403 (if (string-match outline-regexp prefix) | |
1404 (substring prefix (1- (match-end 0)) (match-end 0)))) | |
1405 | |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1406 ;;;_ - Navigation macros |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1407 ;;;_ > outline-next-heading () |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1408 (defmacro outline-next-heading () |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1409 "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
|
1410 |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1411 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
|
1412 |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1413 '(if (and (bobp) (not (eobp))) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1414 (forward-char 1)) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1415 |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1416 '(if (re-search-forward outline-line-boundary-regexp nil 0) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1417 (progn ; Got valid location state - set vars: |
15664
a50ebf4ac764
(outline-auto-activation, outline-layout)
Karl Heuer <kwzh@gnu.org>
parents:
15663
diff
changeset
|
1418 (outline-prefix-data |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1419 (goto-char (or (match-beginning 2) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1420 outline-recent-prefix-beginning)) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1421 (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
|
1422 ;;;_ : outline-this-or-next-heading |
1f09079e18c4
(outline-mode): Use outline-this-or-next-heading.
Richard M. Stallman <rms@gnu.org>
parents:
7476
diff
changeset
|
1423 (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
|
1424 "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
|
1425 ;; 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
|
1426 ;; and usable by outline-mode. |
1f09079e18c4
(outline-mode): Use outline-this-or-next-heading.
Richard M. Stallman <rms@gnu.org>
parents:
7476
diff
changeset
|
1427 (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
|
1428 ;;;_ > outline-previous-heading () |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1429 (defmacro outline-previous-heading () |
7416
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1430 "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
|
1431 |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1432 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
|
1433 |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1434 '(if (bobp) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1435 nil |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1436 (outline-goto-prefix) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1437 (if |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1438 ;; 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
|
1439 (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
|
1440 (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
|
1441 (progn ; Got valid location state - set vars: |
15664
a50ebf4ac764
(outline-auto-activation, outline-layout)
Karl Heuer <kwzh@gnu.org>
parents:
15663
diff
changeset
|
1442 (outline-prefix-data |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1443 (goto-char (or (match-beginning 2) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1444 outline-recent-prefix-beginning)) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1445 (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
|
1446 |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1447 ;;;_ - Subtree Charting |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1448 ;;;_ " 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
|
1449 ;;; 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
|
1450 ;;; |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1451 ;;; 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
|
1452 ;;; 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
|
1453 ;;; out the subtopic locations. The chart then serves as the basis |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1454 ;;; for whatever assessment or adjustment of the subtree that is |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1455 ;;; required, without requiring redundant topic-traversal procedures. |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1456 |
7416
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1457 ;;;_ > 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
|
1458 (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
|
1459 "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
|
1460 |
13964
4de229297f1f
(outline-primary-bullet, outline-numbered-bullet,
Karl Heuer <kwzh@gnu.org>
parents:
13337
diff
changeset
|
1461 Optional argument LEVELS specifies the depth \(relative to start |
7416
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1462 depth\) for the chart. Subsequent optional args are not for public |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1463 use. |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1464 |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1465 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
|
1466 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
|
1467 for their elaborate manipulations. |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1468 |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1469 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
|
1470 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
|
1471 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
|
1472 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
|
1473 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
|
1474 itself. |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1475 |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1476 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
|
1477 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
|
1478 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
|
1479 |
15664
a50ebf4ac764
(outline-auto-activation, outline-layout)
Karl Heuer <kwzh@gnu.org>
parents:
15663
diff
changeset
|
1480 (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
|
1481 chart curr-depth) |
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 (if original ; Just starting? |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1484 ; Register initial settings and |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1485 ; position to first offspring: |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1486 (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
|
1487 (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
|
1488 (outline-next-heading))) |
7416
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1489 |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1490 ;; 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
|
1491 ;; 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
|
1492 ;; the typically quite constrained emacs max-lisp-eval-depth. |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1493 ;; 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
|
1494 ;; operation rather than recursing for lower levels. Bah. |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1495 (while (and (not (eobp)) |
7416
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1496 ; Still within original topic? |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1497 (< 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
|
1498 (cond ((= prev-depth curr-depth) |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1499 ;; 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
|
1500 (setq chart (cons (point) chart)) |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1501 (if (and levels (<= levels 1)) |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1502 ;; At depth limit - skip sublevels: |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1503 (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
|
1504 ;; 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
|
1505 ;; 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
|
1506 (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
|
1507 (outline-recent-depth)) |
5b8a573e9f69
(outline-chart-subtree): Include outline-next-heading in loop conditions
Richard M. Stallman <rms@gnu.org>
parents:
7639
diff
changeset
|
1508 (outline-next-heading)))) |
7416
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1509 (outline-next-heading))) |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1510 |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1511 ((and (< prev-depth curr-depth) |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1512 (or (not levels) |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1513 (> levels 0))) |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1514 ;; 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
|
1515 (setq chart |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1516 (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
|
1517 (1- levels)) |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1518 orig-depth |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1519 curr-depth) |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1520 chart)) |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1521 ;; ... then continue with this one. |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1522 ) |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1523 |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1524 ;; ... 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
|
1525 |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1526 ))) |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1527 |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1528 (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
|
1529 ; the original level. Position |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1530 ; to the end of it: |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1531 (progn (and (not (eobp)) (forward-char -1)) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1532 (and (memq (preceding-char) '(?\n ?\^M)) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1533 (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
|
1534 (point)) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1535 1) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1536 '(?\n ?\^M)) |
7416
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1537 (forward-char -1)) |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1538 (setq outline-recent-end-of-subtree (point)))) |
15664
a50ebf4ac764
(outline-auto-activation, outline-layout)
Karl Heuer <kwzh@gnu.org>
parents:
15663
diff
changeset
|
1539 |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1540 chart ; (nreverse chart) not necessary, |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1541 ; and maybe not preferable. |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1542 )) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1543 ;;;_ > outline-chart-siblings (&optional start end) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1544 (defun outline-chart-siblings (&optional start end) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1545 "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
|
1546 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
|
1547 for an explanation of charts." |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1548 (save-excursion |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1549 (if (outline-goto-prefix) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1550 (let ((chart (list (point)))) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1551 (while (outline-next-sibling) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1552 (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
|
1553 (if chart (setq chart (nreverse chart))))))) |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1554 ;;;_ > outline-chart-to-reveal (chart depth) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1555 (defun outline-chart-to-reveal (chart depth) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1556 |
7416
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1557 "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
|
1558 |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1559 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
|
1560 start point." |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1561 |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1562 (let (result here) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1563 (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
|
1564 chart) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1565 (setq here (car chart)) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1566 (if (listp here) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1567 (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
|
1568 (1- depth))))) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1569 ;; 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
|
1570 ;; more depth to go: |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1571 (if further (setq result (append further result))) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1572 (setq chart (cdr chart))) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1573 (goto-char here) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1574 (if (= (preceding-char) ?\r) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1575 (setq result (cons here result))) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1576 (setq chart (cdr chart)))) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1577 result)) |
7416
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1578 ;;;_ 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
|
1579 (defun outline-chart-spec (chart spec &optional exposing) |
7416
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1580 "Not yet \(if ever\) implemented. |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1581 |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1582 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
|
1583 |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1584 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
|
1585 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
|
1586 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
|
1587 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
|
1588 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
|
1589 bodies should be exposed. |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1590 |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1591 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
|
1592 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
|
1593 exposed reside. |
7416
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1594 |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1595 - 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
|
1596 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
|
1597 including their entries. |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1598 - 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
|
1599 opened. |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1600 - 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
|
1601 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
|
1602 exposure:" |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1603 (while spec |
15664
a50ebf4ac764
(outline-auto-activation, outline-layout)
Karl Heuer <kwzh@gnu.org>
parents:
15663
diff
changeset
|
1604 (cond ((listp spec) |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1605 ) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1606 ) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1607 (setq spec (cdr spec))) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1608 ) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1609 |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1610 ;;;_ - Within Topic |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1611 ;;;_ > outline-goto-prefix () |
3430 | 1612 (defun outline-goto-prefix () |
7416
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1613 "Put point at beginning of outline prefix for immediately containing topic. |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1614 |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1615 Goes to first subsequent topic if none immediately containing. |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1616 |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1617 Not sensitive to topic visibility. |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1618 |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1619 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
|
1620 |
7416
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1621 (let (done) |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1622 (while (and (not done) |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1623 (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
|
1624 (forward-char 1) |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1625 (if (looking-at outline-regexp) |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1626 (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
|
1627 (match-end 0))) |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1628 (forward-char -1))) |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1629 (if (bobp) |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1630 (cond ((looking-at outline-regexp) |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1631 (outline-prefix-data (match-beginning 0)(match-end 0))) |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1632 ((outline-next-heading) |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1633 (outline-prefix-data (match-beginning 0)(match-end 0))) |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1634 (done)) |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1635 done))) |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1636 ;;;_ > outline-end-of-prefix () |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1637 (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
|
1638 "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
|
1639 |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1640 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
|
1641 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
|
1642 |
3430 | 1643 (if (not (outline-goto-prefix)) |
1644 nil | |
1645 (let ((match-data (match-data))) | |
1646 (goto-char (match-end 0)) | |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1647 (if ignore-decorations |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1648 t |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1649 (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
|
1650 (if (and (not (eolp)) (looking-at "\\s-")) (forward-char 1))) |
21151
79a284372cfb
(outline-end-of-prefix): store-match-data => set-match-data.
Richard M. Stallman <rms@gnu.org>
parents:
21088
diff
changeset
|
1651 (set-match-data match-data)) |
3430 | 1652 ;; Reestablish where we are: |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1653 (outline-current-depth))) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1654 ;;;_ > outline-current-bullet-pos () |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1655 (defun outline-current-bullet-pos () |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1656 "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
|
1657 |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1658 (if (not (outline-current-depth)) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1659 nil |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1660 (1- (match-end 0)))) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1661 ;;;_ > outline-back-to-current-heading () |
3430 | 1662 (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
|
1663 "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
|
1664 |
3430 | 1665 (beginning-of-line) |
1666 (prog1 (or (outline-on-current-heading-p) | |
1667 (and (re-search-backward (concat "^\\(" outline-regexp "\\)") | |
1668 nil | |
1669 'move) | |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1670 (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
|
1671 (if (interactive-p) (outline-end-of-prefix)))) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1672 ;;;_ > outline-pre-next-preface () |
3430 | 1673 (defun outline-pre-next-preface () |
1674 "Skip forward to just before the next heading line. | |
1675 | |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1676 Returns that character position." |
3430 | 1677 |
1678 (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
|
1679 (prog1 (goto-char (match-beginning 0)) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1680 (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
|
1681 ;;;_ > outline-end-of-current-subtree () |
3430 | 1682 (defun outline-end-of-current-subtree () |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1683 "Put point at the end of the last leaf in the currently visible topic." |
3430 | 1684 (interactive) |
1685 (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
|
1686 (let ((level (outline-recent-depth))) |
3430 | 1687 (outline-next-heading) |
1688 (while (and (not (eobp)) | |
1689 (> (outline-recent-depth) level)) | |
1690 (outline-next-heading)) | |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1691 (and (not (eobp)) (forward-char -1)) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1692 (and (memq (preceding-char) '(?\n ?\^M)) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1693 (memq (aref (buffer-substring (max 1 (- (point) 3)) (point)) 1) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1694 '(?\n ?\^M)) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1695 (forward-char -1)) |
7416
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1696 (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
|
1697 ;;;_ > outline-beginning-of-current-entry () |
3430 | 1698 (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
|
1699 "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
|
1700 |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1701 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
|
1702 \(See outline-mode doc string for details on hot-spot operation.)" |
3430 | 1703 (interactive) |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1704 (let ((start-point (point))) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1705 (outline-end-of-prefix) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1706 (if (and (interactive-p) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1707 (= (point) start-point)) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1708 (goto-char (outline-current-bullet-pos))))) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1709 ;;;_ > outline-end-of-current-entry () |
3430 | 1710 (defun outline-end-of-current-entry () |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1711 "Position the point at the end of the current topics' entry." |
3430 | 1712 (interactive) |
1713 (outline-show-entry) | |
1714 (prog1 (outline-pre-next-preface) | |
1715 (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
|
1716 (forward-char -1)))) |
3430 | 1717 |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1718 ;;;_ - Depth-wise |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1719 ;;;_ > outline-ascend-to-depth (depth) |
3430 | 1720 (defun outline-ascend-to-depth (depth) |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1721 "Ascend to depth DEPTH, returning depth if successful, nil if not." |
3430 | 1722 (if (and (> depth 0)(<= depth (outline-depth))) |
1723 (let ((last-good (point))) | |
1724 (while (and (< depth (outline-depth)) | |
1725 (setq last-good (point)) | |
1726 (outline-beginning-of-level) | |
1727 (outline-previous-heading))) | |
1728 (if (= (outline-recent-depth) depth) | |
1729 (progn (goto-char outline-recent-prefix-beginning) | |
1730 depth) | |
1731 (goto-char last-good) | |
1732 nil)) | |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1733 (if (interactive-p) (outline-end-of-prefix)))) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1734 ;;;_ > outline-descend-to-depth (depth) |
3430 | 1735 (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
|
1736 "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
|
1737 |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1738 Returning depth if successful, nil if not." |
3430 | 1739 (let ((start-point (point)) |
1740 (start-depth (outline-depth))) | |
1741 (while | |
1742 (and (> (outline-depth) 0) | |
1743 (not (= depth (outline-recent-depth))) ; ... not there yet | |
1744 (outline-next-heading) ; ... go further | |
1745 (< start-depth (outline-recent-depth)))) ; ... still in topic | |
1746 (if (and (> (outline-depth) 0) | |
1747 (= (outline-recent-depth) depth)) | |
1748 depth | |
1749 (goto-char start-point) | |
1750 nil)) | |
1751 ) | |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1752 ;;;_ > outline-up-current-level (arg &optional dont-complain) |
3430 | 1753 (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
|
1754 "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
|
1755 |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1756 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
|
1757 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
|
1758 DONT-COMPLAIN is non-nil." |
3430 | 1759 (interactive "p") |
1760 (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
|
1761 (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
|
1762 (last-good (point)) |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1763 failed |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1764 return) |
3430 | 1765 ;; Loop for iterating arg: |
1766 (while (and (> (outline-recent-depth) 1) | |
1767 (> arg 0) | |
7416
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1768 (not (bobp)) |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1769 (not failed)) |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1770 (setq last-good (point)) |
3430 | 1771 ;; Loop for going back over current or greater depth: |
1772 (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
|
1773 (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
|
1774 (not (setq failed present-level))))) |
3430 | 1775 (setq present-level (outline-current-depth)) |
1776 (setq arg (- arg 1))) | |
7416
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1777 (if (or failed |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1778 (> arg 0)) |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1779 (progn (goto-char last-good) |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1780 (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
|
1781 (if (not dont-complain) |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1782 (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
|
1783 (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
|
1784 nil)) |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1785 (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
|
1786 outline-recent-prefix-beginning))) |
3430 | 1787 |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1788 ;;;_ - Linear |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1789 ;;;_ > outline-next-sibling (&optional depth backward) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1790 (defun outline-next-sibling (&optional depth backward) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1791 "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
|
1792 |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1793 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
|
1794 |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1795 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
|
1796 |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1797 Return depth if successful, nil otherwise." |
3430 | 1798 |
1799 (if (and backward (bobp)) | |
1800 nil | |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1801 (let ((start-depth (or depth (outline-depth))) |
3430 | 1802 (start-point (point)) |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1803 last-depth) |
3430 | 1804 (while (and (not (if backward (bobp) (eobp))) |
1805 (if backward (outline-previous-heading) | |
1806 (outline-next-heading)) | |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1807 (> (setq last-depth (outline-recent-depth)) start-depth))) |
3430 | 1808 (if (and (not (eobp)) |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1809 (and (> (or last-depth (outline-depth)) 0) |
3430 | 1810 (= (outline-recent-depth) start-depth))) |
1811 outline-recent-prefix-beginning | |
1812 (goto-char start-point) | |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1813 (if depth (outline-depth) start-depth) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1814 nil)))) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1815 ;;;_ > outline-previous-sibling (&optional depth backward) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1816 (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
|
1817 "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
|
1818 |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1819 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
|
1820 |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1821 Optional BACKWARD reverses direction. |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1822 |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1823 Return depth if successful, nil otherwise." |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1824 (outline-next-sibling depth (not backward)) |
3430 | 1825 ) |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1826 ;;;_ > outline-snug-back () |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1827 (defun outline-snug-back () |
7416
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1828 "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
|
1829 |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1830 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
|
1831 (if (or (bobp) (eobp)) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1832 nil |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1833 (forward-char -1)) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1834 (if (or (bobp) (not (memq (preceding-char) '(?\n ?\^M)))) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1835 nil |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1836 (forward-char -1) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1837 (if (or (bobp) (not (memq (preceding-char) '(?\n ?\^M)))) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1838 (forward-char -1))) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1839 (point)) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1840 ;;;_ > outline-beginning-of-level () |
3430 | 1841 (defun outline-beginning-of-level () |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1842 "Go back to the first sibling at this level, visible or not." |
3430 | 1843 (outline-end-of-level 'backward)) |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1844 ;;;_ > outline-end-of-level (&optional backward) |
3430 | 1845 (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
|
1846 "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
|
1847 |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1848 (let ((depth (outline-depth))) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1849 (while (outline-previous-sibling depth nil)) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1850 (prog1 (outline-recent-depth) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1851 (if (interactive-p) (outline-end-of-prefix))))) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1852 ;;;_ > outline-next-visible-heading (arg) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1853 (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
|
1854 "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
|
1855 |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1856 Move as far as possible in indicated direction \(beginning or end of |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1857 buffer\) if headings are exhausted." |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1858 |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1859 (interactive "p") |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1860 (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
|
1861 (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
|
1862 (start-point (point)) |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1863 prev got) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1864 |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1865 (while (> arg 0) ; limit condition |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1866 (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
|
1867 ;; 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
|
1868 (< -1 (forward-line step)) |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1869 (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
|
1870 ;; 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
|
1871 (if got (setq prev got)) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1872 (setq arg (1- arg))) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1873 (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
|
1874 (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
|
1875 (outline-end-of-prefix)) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1876 (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
|
1877 (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
|
1878 ((not backward) (end-of-line) nil)))) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1879 ;;;_ > outline-previous-visible-heading (arg) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1880 (defun outline-previous-visible-heading (arg) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1881 "Move to the previous heading line. |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1882 |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1883 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
|
1884 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
|
1885 matches)." |
3430 | 1886 (interactive "p") |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1887 (outline-next-visible-heading (- arg))) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1888 ;;;_ > outline-forward-current-level (arg) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1889 (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
|
1890 "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
|
1891 |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1892 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
|
1893 |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1894 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
|
1895 (interactive "p") |
7416
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1896 (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
|
1897 (start-point (point)) |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1898 (start-arg arg) |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1899 (backward (> 0 arg)) |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1900 last-depth |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1901 (last-good (point)) |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1902 at-boundary) |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1903 (if (= 0 start-depth) |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1904 (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
|
1905 (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
|
1906 (while (not (or (zerop arg) |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1907 at-boundary)) |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1908 (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
|
1909 (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
|
1910 (outline-next-visible-heading 1)) |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1911 (> (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
|
1912 (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
|
1913 (not (if backward (bobp) (eobp)))) |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1914 (setq last-good (point) |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1915 arg (1- arg)) |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1916 (setq at-boundary t))) |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1917 (if (and (not (eobp)) |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1918 (= arg 0) |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1919 (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
|
1920 (= (outline-recent-depth) start-depth))) |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1921 outline-recent-prefix-beginning |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1922 (goto-char last-good) |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1923 (if (not (interactive-p)) |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1924 nil |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1925 (outline-end-of-prefix) |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1926 (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
|
1927 (if backward "first" "last") |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1928 (outline-recent-depth) |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1929 (- (abs start-arg) arg) |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1930 (abs start-arg)))))) |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1931 ;;;_ > outline-backward-current-level (arg) |
3430 | 1932 (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
|
1933 "Inverse of `outline-forward-current-level'." |
3430 | 1934 (interactive "p") |
7416
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1935 (if (interactive-p) |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1936 (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
|
1937 (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
|
1938 (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
|
1939 |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1940 ;;;_ #5 Alteration |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1941 |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1942 ;;;_ - Fundamental |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1943 ;;;_ > outline-before-change-protect (beg end) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1944 (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
|
1945 "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
|
1946 |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1947 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
|
1948 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
|
1949 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
|
1950 |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1951 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
|
1952 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
|
1953 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
|
1954 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
|
1955 |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1956 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
|
1957 \(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
|
1958 writes, like crypt and zip modes.) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1959 |
15664
a50ebf4ac764
(outline-auto-activation, outline-layout)
Karl Heuer <kwzh@gnu.org>
parents:
15663
diff
changeset
|
1960 Locally bound in outline buffers to `before-change-function', which |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1961 in emacs 19 is run before any change to the buffer. (Has no effect |
15664
a50ebf4ac764
(outline-auto-activation, outline-layout)
Karl Heuer <kwzh@gnu.org>
parents:
15663
diff
changeset
|
1962 in Emacs 18, which doesn't support before-change-function.) |
a50ebf4ac764
(outline-auto-activation, outline-layout)
Karl Heuer <kwzh@gnu.org>
parents:
15663
diff
changeset
|
1963 |
a50ebf4ac764
(outline-auto-activation, outline-layout)
Karl Heuer <kwzh@gnu.org>
parents:
15663
diff
changeset
|
1964 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
|
1965 `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
|
1966 are exempt from this restriction." |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1967 (if (and (outline-mode-p) |
15664
a50ebf4ac764
(outline-auto-activation, outline-layout)
Karl Heuer <kwzh@gnu.org>
parents:
15663
diff
changeset
|
1968 ; outline-override-protect |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1969 ; set by functions that know what |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1970 ; they're doing, eg outline internals: |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1971 (not outline-override-protect) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1972 (not outline-during-write-cue) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1973 (save-match-data ; Preserve operation position state. |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1974 ; Both beginning and end chars must |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1975 ; be exposed: |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1976 (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
|
1977 ;; Compensate for stupid emacs {new, |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1978 ;; open-}line display optimization: |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1979 (setq beg (1+ beg) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1980 end (1+ end))) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1981 (goto-char beg) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1982 (or (outline-hidden-p) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1983 (and (not (= beg end)) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1984 (goto-char end) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1985 (outline-hidden-p)))))) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1986 (save-match-data |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1987 (if (equal this-command 'undo) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1988 ;; Allow undo without inhibition. |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1989 ;; - 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
|
1990 ;; optimization (em 19 cmds.c, ~ line 200). |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1991 ;; - Presumably, undoing what was properly protected when |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1992 ;; done. |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1993 ;; - 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
|
1994 ;; So, expose what getting changed: |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1995 (progn (message "Undo! - exposing concealed target...") |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1996 (if (outline-hidden-p) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1997 (outline-show-children)) |
7416
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
1998 (message "Undo!")) |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
1999 (let (response |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2000 (rehide-completely (save-excursion (outline-goto-prefix) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2001 (outline-hidden-p))) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2002 rehide-place) |
15664
a50ebf4ac764
(outline-auto-activation, outline-layout)
Karl Heuer <kwzh@gnu.org>
parents:
15663
diff
changeset
|
2003 |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2004 (save-excursion |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2005 (if (condition-case err |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2006 ;; 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
|
2007 (progn |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2008 ; Give them a peek where |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2009 (save-excursion |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2010 (if (eolp) (setq rehide-place |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2011 (outline-goto-prefix))) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2012 (outline-show-entry)) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2013 ; Present the message, but... |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2014 ; leave the cursor at the location |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2015 ; until they respond: |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2016 ; Then interpret the response: |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2017 (while |
15664
a50ebf4ac764
(outline-auto-activation, outline-layout)
Karl Heuer <kwzh@gnu.org>
parents:
15663
diff
changeset
|
2018 (progn |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2019 (message (concat "Change inside concealed" |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2020 " region - do it? " |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2021 "(n or 'y'/'r'eclose)")) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2022 (setq response (read-char)) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2023 (not |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2024 (cond ((memq response '(?r ?R)) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2025 (setq response 'reclose)) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2026 ((memq response '(?y ?Y ? )) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2027 (setq response t)) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2028 ((memq response '(?n ?N 127)) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2029 (setq response nil) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2030 t) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2031 ((eq response ??) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2032 (message |
15664
a50ebf4ac764
(outline-auto-activation, outline-layout)
Karl Heuer <kwzh@gnu.org>
parents:
15663
diff
changeset
|
2033 "`r' means `yes, then reclose'") |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2034 nil) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2035 (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
|
2036 (sit-for 1) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2037 nil))))) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2038 response) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2039 (quit nil)) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2040 ; Continue: |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2041 (if (eq response 'reclose) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2042 (save-excursion |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2043 (if rehide-place (goto-char rehide-place)) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2044 (if rehide-completely |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2045 (outline-hide-current-entry-completely) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2046 (outline-hide-current-entry))) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2047 (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
|
2048 (outline-show-children) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2049 (outline-show-to-offshoot))) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2050 ; Prevent: |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2051 (if rehide-completely |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2052 (save-excursion |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2053 (if rehide-place (goto-char rehide-place)) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2054 (outline-hide-current-entry-completely)) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2055 (outline-hide-current-entry)) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2056 (error (concat |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2057 "Change within concealed region prevented."))))))) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2058 ) ; if |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2059 ) ; defun |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2060 ;;;_ = outline-post-goto-bullet |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2061 (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
|
2062 "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
|
2063 |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
2064 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
|
2065 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
|
2066 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
|
2067 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
|
2068 outline-mode-map.") |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2069 (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
|
2070 ;;;_ > outline-post-command-business () |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2071 (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
|
2072 "Outline post-command-hook function. |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
2073 |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
2074 - 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
|
2075 |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
2076 - 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
|
2077 outline commands. |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2078 |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2079 - 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
|
2080 aggregated. This kludge compensates for lack of undo bunching when |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2081 before-change-function is used." |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2082 |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2083 ; 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
|
2084 (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
|
2085 nil |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
2086 (setq outline-override-protect nil) |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
2087 (if outline-during-write-cue |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
2088 ;; 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
|
2089 (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
|
2090 ;; Undo bunching business: |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
2091 (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
|
2092 (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
|
2093 (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
|
2094 (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
|
2095 (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
|
2096 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
|
2097 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
|
2098 (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
|
2099 (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
|
2100 (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
|
2101 (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
|
2102 (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
|
2103 |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
2104 ;; 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
|
2105 (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
|
2106 (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
|
2107 (= 1 (- cur-to cur-from)) |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
2108 |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
2109 ;; 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
|
2110 ;; insertions: |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
2111 (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
|
2112 (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
|
2113 ; Below threshold: |
7416
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
2114 (> 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
|
2115 (setq buffer-undo-list |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
2116 (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
|
2117 (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
|
2118 ;; 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
|
2119 (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
|
2120 (outline-current-bullet-pos)) |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
2121 (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
|
2122 (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
|
2123 )) |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2124 ;;;_ > outline-pre-command-business () |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2125 (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
|
2126 "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
|
2127 |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
2128 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
|
2129 |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2130 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
|
2131 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
|
2132 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
|
2133 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
|
2134 |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2135 The upshot is that you can get easy, single (unmodified) key outline |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2136 maneuvering and general operations by positioning the cursor on the |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2137 bullet char, and it continues until you deliberately some non-outline |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2138 motion command to relocate the cursor off of a bullet char." |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2139 |
7416
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
2140 (if (and (boundp 'outline-mode) |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
2141 outline-mode |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
2142 (eq this-command 'self-insert-command) |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2143 (eq (point)(outline-current-bullet-pos))) |
15664
a50ebf4ac764
(outline-auto-activation, outline-layout)
Karl Heuer <kwzh@gnu.org>
parents:
15663
diff
changeset
|
2144 |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2145 (let* ((this-key-num (if (numberp last-command-event) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2146 last-command-event)) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2147 mapped-binding) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2148 |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2149 ; Map upper-register literals |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2150 ; to lower register: |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2151 (if (<= 96 this-key-num) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2152 (setq this-key-num (- this-key-num 32))) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2153 ; Check if we have a literal: |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2154 (if (and (<= 64 this-key-num) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2155 (>= 96 this-key-num)) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2156 (setq mapped-binding |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2157 (lookup-key 'outline-mode-map |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2158 (concat outline-command-prefix |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2159 (char-to-string (- this-key-num 64)))))) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2160 (if mapped-binding |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2161 (setq outline-post-goto-bullet t |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2162 this-command mapped-binding))))) |
7416
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
2163 ;;;_ > outline-find-file-hook () |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
2164 (defun outline-find-file-hook () |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
2165 "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
|
2166 |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
2167 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
|
2168 (if (and outline-auto-activation |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
2169 (not (outline-mode-p)) |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
2170 outline-layout) |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
2171 (outline-mode t))) |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
2172 ;;;_ : Establish the hooks |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
2173 (add-hook 'post-command-hook 'outline-post-command-business) |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
2174 (add-hook 'pre-command-hook 'outline-pre-command-business) |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2175 |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2176 ;;;_ - Topic Format Assessment |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2177 ;;;_ > outline-solicit-alternate-bullet (depth &optional current-bullet) |
3430 | 2178 (defun outline-solicit-alternate-bullet (depth &optional current-bullet) |
2179 | |
7416
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
2180 "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
|
2181 |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
2182 Offer one suitable for current depth DEPTH as default." |
3430 | 2183 |
2184 (let* ((default-bullet (or current-bullet | |
2185 (outline-bullet-for-depth depth))) | |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2186 (sans-escapes (regexp-sans-escapes outline-bullets-string)) |
3430 | 2187 (choice (solicit-char-in-string |
2188 (format "Select bullet: %s ('%s' default): " | |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2189 sans-escapes |
3430 | 2190 default-bullet) |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2191 sans-escapes |
3430 | 2192 t))) |
2193 (if (string= choice "") default-bullet choice)) | |
2194 ) | |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2195 ;;;_ > outline-sibling-index (&optional depth) |
3430 | 2196 (defun outline-sibling-index (&optional depth) |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2197 "Item number of this prospective topic among its siblings. |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2198 |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2199 If optional arg depth is greater than current depth, then we're |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2200 opening a new level, and return 0. |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2201 |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2202 If less than this depth, ascend to that depth and count..." |
3430 | 2203 |
2204 (save-excursion | |
2205 (cond ((and depth (<= depth 0) 0)) | |
2206 ((or (not depth) (= depth (outline-depth))) | |
2207 (let ((index 1)) | |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2208 (while (outline-previous-sibling (outline-recent-depth) nil) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2209 (setq index (1+ index))) |
3430 | 2210 index)) |
2211 ((< depth (outline-recent-depth)) | |
2212 (outline-ascend-to-depth depth) | |
2213 (outline-sibling-index)) | |
2214 (0)))) | |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2215 ;;;_ > outline-distinctive-bullet (bullet) |
3430 | 2216 (defun outline-distinctive-bullet (bullet) |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2217 "True if bullet is one of those on outline-distinctive-bullets-string." |
3430 | 2218 (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
|
2219 ;;;_ > outline-numbered-type-prefix (&optional prefix) |
3430 | 2220 (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
|
2221 "True if current header prefix bullet is numbered bullet." |
3430 | 2222 (and outline-numbered-bullet |
2223 (string= outline-numbered-bullet | |
2224 (if prefix | |
2225 (outline-get-prefix-bullet prefix) | |
2226 (outline-get-bullet))))) | |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2227 ;;;_ > outline-bullet-for-depth (&optional depth) |
3430 | 2228 (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
|
2229 "Return outline topic bullet suited to optional DEPTH, or current depth." |
3430 | 2230 ;; Find bullet in plain-bullets-string modulo DEPTH. |
2231 (if outline-stylish-prefixes | |
2232 (char-to-string (aref outline-plain-bullets-string | |
2233 (% (max 0 (- depth 2)) | |
2234 outline-plain-bullets-string-len))) | |
2235 outline-primary-bullet) | |
2236 ) | |
2237 | |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2238 ;;;_ - Topic Production |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2239 ;;;_ > outline-make-topic-prefix (&optional prior-bullet |
3430 | 2240 (defun outline-make-topic-prefix (&optional prior-bullet |
2241 new | |
2242 depth | |
2243 solicit | |
2244 number-control | |
2245 index) | |
2246 ;; Depth null means use current depth, non-null means we're either | |
2247 ;; opening a new topic after current topic, lower or higher, or we're | |
2248 ;; changing level of current topic. | |
2249 ;; Solicit dominates specified bullet-char. | |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2250 ;;;_ . Doc string: |
7416
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
2251 "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
|
2252 |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2253 All the arguments are optional. |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2254 |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2255 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
|
2256 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
|
2257 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
|
2258 for instance. |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2259 |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2260 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
|
2261 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
|
2262 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
|
2263 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
|
2264 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
|
2265 bullet or previous sibling. |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2266 |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2267 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
|
2268 the current topics' depth. |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2269 |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2270 Fourth arg SOLICIT non-nil provokes solicitation from the user of a |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2271 choice among the valid bullets. (This overrides other all the |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2272 options, including, eg, a distinctive PRIOR-BULLET.) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2273 |
15664
a50ebf4ac764
(outline-auto-activation, outline-layout)
Karl Heuer <kwzh@gnu.org>
parents:
15663
diff
changeset
|
2274 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
|
2275 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
|
2276 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
|
2277 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
|
2278 |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2279 \(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
|
2280 |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2281 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
|
2282 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
|
2283 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
|
2284 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
|
2285 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
|
2286 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
|
2287 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
|
2288 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
|
2289 index for each successive sibling)." |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2290 ;;;_ . Code: |
3430 | 2291 ;; The options are ordered in likely frequence of use, most common |
2292 ;; highest, least lowest. Ie, more likely to be doing prefix | |
2293 ;; adjustments than soliciting, and yet more than numbering. | |
2294 ;; Current prefix is least dominant, but most likely to be commonly | |
2295 ;; specified... | |
2296 | |
2297 (let* (body | |
2298 numbering | |
2299 denumbering | |
2300 (depth (or depth (outline-depth))) | |
2301 (header-lead outline-header-prefix) | |
2302 (bullet-char | |
2303 | |
2304 ;; Getting value for bullet char is practically the whole job: | |
2305 | |
2306 (cond | |
2307 ; Simplest situation - level 1: | |
2308 ((<= depth 1) (setq header-lead "") outline-primary-bullet) | |
2309 ; Simple, too: all asterisks: | |
2310 (outline-old-style-prefixes | |
2311 ;; Cheat - make body the whole thing, null out header-lead and | |
2312 ;; bullet-char: | |
2313 (setq body (make-string depth | |
2314 (string-to-char outline-primary-bullet))) | |
2315 (setq header-lead "") | |
2316 "") | |
2317 | |
2318 ;; (Neither level 1 nor old-style, so we're space padding. | |
2319 ;; Sneak it in the condition of the next case, whatever it is.) | |
2320 | |
2321 ;; Solicitation overrides numbering and other cases: | |
2322 ((progn (setq body (make-string (- depth 2) ?\ )) | |
2323 ;; The actual condition: | |
2324 solicit) | |
2325 (let* ((got (outline-solicit-alternate-bullet depth))) | |
2326 ;; Gotta check whether we're numbering and got a numbered bullet: | |
2327 (setq numbering (and outline-numbered-bullet | |
2328 (not (and number-control (not index))) | |
2329 (string= got outline-numbered-bullet))) | |
2330 ;; Now return what we got, regardless: | |
2331 got)) | |
2332 | |
2333 ;; Numbering invoked through args: | |
2334 ((and outline-numbered-bullet number-control) | |
2335 (if (setq numbering (not (setq denumbering (not index)))) | |
2336 outline-numbered-bullet | |
7416
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
2337 (if (and prior-bullet |
3430 | 2338 (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
|
2339 prior-bullet))) |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
2340 prior-bullet |
3430 | 2341 (outline-bullet-for-depth depth)))) |
2342 | |
2343 ;;; Neither soliciting nor controlled numbering ;;; | |
2344 ;;; (may be controlled denumbering, tho) ;;; | |
2345 | |
2346 ;; Check wrt previous sibling: | |
2347 ((and new ; only check for new prefixes | |
2348 (<= depth (outline-depth)) | |
2349 outline-numbered-bullet ; ... & numbering enabled | |
2350 (not denumbering) | |
2351 (let ((sibling-bullet | |
2352 (save-excursion | |
2353 ;; Locate correct sibling: | |
2354 (or (>= depth (outline-depth)) | |
2355 (outline-ascend-to-depth depth)) | |
2356 (outline-get-bullet)))) | |
2357 (if (and sibling-bullet | |
2358 (string= outline-numbered-bullet sibling-bullet)) | |
2359 (setq numbering sibling-bullet))))) | |
2360 | |
2361 ;; Distinctive prior bullet? | |
2362 ((and prior-bullet | |
2363 (outline-distinctive-bullet prior-bullet) | |
2364 ;; Either non-numbered: | |
2365 (or (not (and outline-numbered-bullet | |
2366 (string= prior-bullet outline-numbered-bullet))) | |
2367 ;; or numbered, and not denumbering: | |
2368 (setq numbering (not denumbering))) | |
2369 ;; Here 'tis: | |
2370 prior-bullet)) | |
2371 | |
2372 ;; Else, standard bullet per depth: | |
2373 ((outline-bullet-for-depth depth))))) | |
2374 | |
2375 (concat header-lead | |
2376 body | |
2377 bullet-char | |
2378 (if numbering | |
2379 (format "%d" (cond ((and index (numberp index)) index) | |
2380 (new (1+ (outline-sibling-index depth))) | |
2381 ((outline-sibling-index)))))) | |
2382 ) | |
2383 ) | |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2384 ;;;_ > outline-open-topic (relative-depth &optional before) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2385 (defun outline-open-topic (relative-depth &optional before) |
7416
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
2386 "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
|
2387 |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
2388 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
|
2389 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
|
2390 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
|
2391 |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2392 Nuances: |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2393 |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2394 - 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
|
2395 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
|
2396 |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2397 - 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
|
2398 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
|
2399 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
|
2400 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
|
2401 deliberately dividing topic bodies. |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2402 |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2403 - 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
|
2404 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
|
2405 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
|
2406 single-spacing is used. |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2407 |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2408 - 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
|
2409 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
|
2410 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
|
2411 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
|
2412 from there." |
3430 | 2413 |
2414 (let* ((depth (+ (outline-current-depth) relative-depth)) | |
2415 (opening-on-blank (if (looking-at "^\$") | |
2416 (not (setq before nil)))) | |
2417 opening-numbered ; Will get while computing ref-topic, below | |
2418 ref-depth ; Will get while computing ref-topic, next | |
2419 (ref-topic (save-excursion | |
2420 (cond ((< relative-depth 0) | |
2421 (outline-ascend-to-depth depth)) | |
2422 ((>= relative-depth 1) nil) | |
2423 (t (outline-back-to-current-heading))) | |
2424 (setq ref-depth (outline-recent-depth)) | |
2425 (setq opening-numbered | |
2426 (save-excursion | |
2427 (and outline-numbered-bullet | |
2428 (or (<= relative-depth 0) | |
2429 (outline-descend-to-depth depth)) | |
2430 (if (outline-numbered-type-prefix) | |
2431 outline-numbered-bullet)))) | |
2432 (point))) | |
2433 dbl-space | |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2434 doing-beginning) |
3430 | 2435 |
2436 (if (not opening-on-blank) | |
2437 ; Positioning and vertical | |
2438 ; padding - only if not | |
2439 ; opening-on-blank: | |
15664
a50ebf4ac764
(outline-auto-activation, outline-layout)
Karl Heuer <kwzh@gnu.org>
parents:
15663
diff
changeset
|
2440 (progn |
3430 | 2441 (goto-char ref-topic) |
2442 (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
|
2443 (or (and (<= relative-depth 0) ; not descending; |
3430 | 2444 (save-excursion |
13964
4de229297f1f
(outline-primary-bullet, outline-numbered-bullet,
Karl Heuer <kwzh@gnu.org>
parents:
13337
diff
changeset
|
2445 ;; 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
|
2446 (or (> 0 (forward-line -1)) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2447 (looking-at "^\\s-*$") |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2448 (bobp))) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2449 (save-excursion |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2450 ;; succeeded by a blank line? |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2451 (outline-end-of-current-subtree) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2452 (bolp))) |
3430 | 2453 (and (= ref-depth 1) |
2454 (or before | |
2455 (= depth 1) | |
2456 (save-excursion | |
2457 ;; Don't already have following | |
2458 ;; vertical padding: | |
2459 (not (outline-pre-next-preface))))))) | |
2460 | |
2461 ; Position to prior heading, | |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2462 ; if inserting backwards, and |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2463 ; not going outwards: |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2464 (if (and before (>= relative-depth 0)) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2465 (progn (outline-back-to-current-heading) |
3430 | 2466 (setq doing-beginning (bobp)) |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2467 (if (not (bobp)) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2468 (outline-previous-heading))) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2469 (if (and before (bobp)) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2470 (outline-unprotected (open-line 1)))) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2471 |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2472 (if (<= relative-depth 0) |
3430 | 2473 ;; Not going inwards, don't snug up: |
2474 (if doing-beginning | |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2475 (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
|
2476 (if before |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2477 (progn (end-of-line) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2478 (outline-pre-next-preface) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2479 (while (= ?\r (following-char)) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2480 (forward-char 1)) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2481 (if (not (looking-at "^$")) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2482 (outline-unprotected (open-line 1)))) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2483 (outline-end-of-current-subtree))) |
3430 | 2484 ;; Going inwards - double-space if first offspring is, |
2485 ;; otherwise snug up. | |
2486 (end-of-line) ; So we skip any concealed progeny. | |
2487 (outline-pre-next-preface) | |
2488 (if (bolp) | |
2489 ;; Blank lines between current header body and next | |
2490 ;; header - get to last substantive (non-white-space) | |
2491 ;; line in body: | |
2492 (re-search-backward "[^ \t\n]" nil t)) | |
2493 (if (save-excursion | |
2494 (outline-next-heading) | |
2495 (if (> (outline-recent-depth) ref-depth) | |
2496 ;; This is an offspring. | |
2497 (progn (forward-line -1) | |
2498 (looking-at "^\\s-*$")))) | |
2499 (progn (forward-line 1) | |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2500 (outline-unprotected (open-line 1)))) |
3430 | 2501 (end-of-line)) |
2502 ;;(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
|
2503 (if (not (bobp)) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2504 (progn (if (and (not (> depth ref-depth)) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2505 (not before)) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2506 (outline-unprotected (open-line 1)) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2507 (if (> depth ref-depth) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2508 (outline-unprotected (newline 1)) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2509 (if dbl-space |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2510 (outline-unprotected (open-line 1)) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2511 (if (not before) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2512 (outline-unprotected (newline 1)))))) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2513 (if dbl-space |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2514 (outline-unprotected (newline 1))) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2515 (if (and (not (eobp)) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2516 (not (bolp))) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2517 (forward-char 1)))) |
3430 | 2518 )) |
2519 (insert-string (concat (outline-make-topic-prefix opening-numbered | |
2520 t | |
2521 depth) | |
2522 " ")) | |
2523 | |
2524 ;;(if doing-beginning (save-excursion (newline (if dbl-space 2 1)))) | |
2525 | |
2526 | |
2527 (outline-rebullet-heading nil ;;; solicit | |
2528 depth ;;; depth | |
2529 nil ;;; number-control | |
2530 nil ;;; index | |
2531 t) (end-of-line) | |
2532 ) | |
2533 ) | |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2534 ;;;_ . open-topic contingencies |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2535 ;;;_ ; 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
|
2536 ;;;_ , beginning char |
13964
4de229297f1f
(outline-primary-bullet, outline-numbered-bullet,
Karl Heuer <kwzh@gnu.org>
parents:
13337
diff
changeset
|
2537 ;;;_ , 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
|
2538 ;;;_ , 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
|
2539 ;;;_ ; absolute depth of new topic |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2540 ;;;_ ! insert in place - overrides most stuff |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2541 ;;;_ ; relative depth of new re base |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2542 ;;;_ ; before or after base topic |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2543 ;;;_ ; 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
|
2544 ;;;_ ; 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
|
2545 ;;;_ ; 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
|
2546 ;;;_ ; location of new topic |
15664
a50ebf4ac764
(outline-auto-activation, outline-layout)
Karl Heuer <kwzh@gnu.org>
parents:
15663
diff
changeset
|
2547 ;;;_ . |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2548 ;;;_ > outline-open-subtopic (arg) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2549 (defun outline-open-subtopic (arg) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2550 "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
|
2551 |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2552 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
|
2553 prior to the current one." |
3430 | 2554 (interactive "p") |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2555 (outline-open-topic 1 (> 0 arg))) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2556 ;;;_ > outline-open-sibtopic (arg) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2557 (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
|
2558 "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
|
2559 |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
2560 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
|
2561 one." |
3430 | 2562 (interactive "p") |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2563 (outline-open-topic 0 (> 0 arg))) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2564 ;;;_ > outline-open-supertopic (arg) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2565 (defun outline-open-supertopic (arg) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2566 "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
|
2567 |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2568 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
|
2569 topic prior to the current one." |
3430 | 2570 |
2571 (interactive "p") | |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2572 (outline-open-topic -1 (> 0 arg))) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2573 |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2574 ;;;_ - Outline Alteration |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2575 ;;;_ : Topic Modification |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2576 ;;;_ = outline-former-auto-filler |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2577 (defvar outline-former-auto-filler nil |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2578 "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
|
2579 ;;;_ > outline-auto-fill () |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2580 (defun outline-auto-fill () |
7416
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
2581 "Outline-mode autofill function. |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
2582 |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
2583 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
|
2584 `outline-use-hanging-indents' is set." |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2585 (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
|
2586 ;; Check for topic header indentation: |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2587 (save-excursion |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2588 (beginning-of-line) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2589 (if (looking-at outline-regexp) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2590 ;; ... construct indentation to account for |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2591 ;; length of topic prefix: |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2592 (make-string (progn (outline-end-of-prefix) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2593 (current-column)) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2594 ?\ )))))) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2595 (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
|
2596 (do-auto-fill)))) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2597 ;;;_ > 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
|
2598 (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
|
2599 "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
|
2600 |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2601 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
|
2602 be accommodated. |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2603 |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2604 Note that refill of indented paragraphs is not done." |
3430 | 2605 |
2606 (save-excursion | |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2607 (outline-end-of-prefix) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2608 (let* ((new-margin (current-column)) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2609 excess old-indent-begin old-indent-end |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2610 curr-ind |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2611 ;; 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
|
2612 ;; *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
|
2613 ;; 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
|
2614 (old-margin (+ old-depth (- new-margin new-depth)))) |
15664
a50ebf4ac764
(outline-auto-activation, outline-layout)
Karl Heuer <kwzh@gnu.org>
parents:
15663
diff
changeset
|
2615 |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2616 ;; 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
|
2617 (outline-unprotected |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2618 (save-match-data |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2619 (while |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2620 (and (re-search-forward "[\n\r]\\(\\s-*\\)" |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2621 nil |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2622 t) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2623 ;; Register the indent data, before we reset the |
15664
a50ebf4ac764
(outline-auto-activation, outline-layout)
Karl Heuer <kwzh@gnu.org>
parents:
15663
diff
changeset
|
2624 ;; 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
|
2625 (setq old-indent-begin (match-beginning 1) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2626 old-indent-end (match-end 1)) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2627 (not (looking-at outline-regexp))) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2628 (if (> 0 (setq excess (- (current-column) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2629 old-margin))) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2630 ;; 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
|
2631 nil |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2632 ;; 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
|
2633 ;; reindent it, preserving its existing indentation |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2634 ;; beyond the old margin: |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2635 (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
|
2636 (indent-to (+ new-margin excess))))))))) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2637 ;;;_ > outline-rebullet-current-heading (arg) |
3430 | 2638 (defun outline-rebullet-current-heading (arg) |
15664
a50ebf4ac764
(outline-auto-activation, outline-layout)
Karl Heuer <kwzh@gnu.org>
parents:
15663
diff
changeset
|
2639 "Like non-interactive version `outline-rebullet-heading'. |
7416
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
2640 |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
2641 But \(only\) affects visible heading containing point. |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2642 |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2643 With repeat count, solicit for bullet." |
3430 | 2644 (interactive "P") |
2645 (save-excursion (outline-back-to-current-heading) | |
2646 (outline-end-of-prefix) | |
2647 (outline-rebullet-heading (not arg) ;;; solicit | |
2648 nil ;;; depth | |
2649 nil ;;; number-control | |
2650 nil ;;; index | |
2651 t) ;;; do-successors | |
2652 ) | |
2653 ) | |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2654 ;;;_ > outline-rebullet-heading (&optional solicit ...) |
3430 | 2655 (defun outline-rebullet-heading (&optional solicit |
2656 new-depth | |
2657 number-control | |
2658 index | |
2659 do-successors) | |
2660 | |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2661 "Adjust bullet of current topic prefix. |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2662 |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2663 All args are optional. |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2664 |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2665 If SOLICIT is non-nil then the choice of bullet is solicited from |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2666 user. Otherwise the distinctiveness of the bullet or the topic |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2667 depth determines it. |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2668 |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2669 Second arg DEPTH forces the topic prefix to that depth, regardless |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2670 of the topics current depth. |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2671 |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2672 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
|
2673 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
|
2674 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
|
2675 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
|
2676 of the forth arg, INDEX. |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2677 |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2678 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
|
2679 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
|
2680 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
|
2681 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
|
2682 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
|
2683 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
|
2684 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
|
2685 |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2686 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
|
2687 siblings. |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2688 |
15664
a50ebf4ac764
(outline-auto-activation, outline-layout)
Karl Heuer <kwzh@gnu.org>
parents:
15663
diff
changeset
|
2689 Cf vars `outline-stylish-prefixes', `outline-old-style-prefixes', |
a50ebf4ac764
(outline-auto-activation, outline-layout)
Karl Heuer <kwzh@gnu.org>
parents:
15663
diff
changeset
|
2690 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
|
2691 this function." |
3430 | 2692 |
2693 (let* ((current-depth (outline-depth)) | |
2694 (new-depth (or new-depth current-depth)) | |
2695 (mb outline-recent-prefix-beginning) | |
2696 (me outline-recent-prefix-end) | |
2697 (current-bullet (buffer-substring (- me 1) me)) | |
2698 (new-prefix (outline-make-topic-prefix current-bullet | |
2699 nil | |
2700 new-depth | |
2701 solicit | |
2702 number-control | |
2703 index))) | |
2704 | |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2705 ;; Is new one is identical to old? |
3430 | 2706 (if (and (= current-depth new-depth) |
2707 (string= current-bullet | |
2708 (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
|
2709 ;; Nothing to do: |
3430 | 2710 t |
2711 | |
2712 ;; New prefix probably different from old: | |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2713 ; get rid of old one: |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2714 (outline-unprotected (delete-region mb me)) |
3430 | 2715 (goto-char mb) |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2716 ; Dispense with number if |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2717 ; numbered-bullet prefix: |
3430 | 2718 (if (and outline-numbered-bullet |
2719 (string= outline-numbered-bullet current-bullet) | |
2720 (looking-at "[0-9]+")) | |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2721 (outline-unprotected |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2722 (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
|
2723 |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2724 ; Put in new prefix: |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2725 (outline-unprotected (insert-string new-prefix)) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2726 |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2727 ;; 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
|
2728 (if (and outline-reindent-bodies |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2729 (not (= new-depth current-depth))) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2730 (outline-reindent-body current-depth new-depth)) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2731 |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2732 ;; 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
|
2733 ;; caller elected for it: |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2734 (if do-successors |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2735 (save-excursion |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2736 (while (outline-next-sibling new-depth nil) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2737 (setq index |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2738 (cond ((numberp index) (1+ index)) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2739 ((not number-control) (outline-sibling-index)))) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2740 (if (outline-numbered-type-prefix) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2741 (outline-rebullet-heading nil ;;; solicit |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2742 new-depth ;;; new-depth |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2743 number-control;;; number-control |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2744 index ;;; index |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2745 nil))))) ;;;(dont!)do-successors |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2746 ) ; (if (and (= current-depth new-depth)...)) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2747 ) ; let* ((current-depth (outline-depth))...) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2748 ) ; defun |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2749 ;;;_ > outline-rebullet-topic (arg) |
3430 | 2750 (defun outline-rebullet-topic (arg) |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2751 "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
|
2752 |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2753 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
|
2754 |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2755 With repeat count, shift topic depth by that amount." |
3430 | 2756 (interactive "P") |
2757 (let ((start-col (current-column)) | |
2758 (was-eol (eolp))) | |
2759 (save-excursion | |
2760 ;; Normalize arg: | |
2761 (cond ((null arg) (setq arg 0)) | |
2762 ((listp arg) (setq arg (car arg)))) | |
2763 ;; Fill the user in, in case we're shifting a big topic: | |
2764 (if (not (zerop arg)) (message "Shifting...")) | |
2765 (outline-back-to-current-heading) | |
2766 (if (<= (+ (outline-recent-depth) arg) 0) | |
2767 (error "Attempt to shift topic below level 1")) | |
2768 (outline-rebullet-topic-grunt arg) | |
2769 (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
|
2770 (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
|
2771 ;;;_ > outline-rebullet-topic-grunt (&optional relative-depth ...) |
3430 | 2772 (defun outline-rebullet-topic-grunt (&optional relative-depth |
2773 starting-depth | |
2774 starting-point | |
2775 index | |
2776 do-successors) | |
2777 | |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2778 "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
|
2779 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
|
2780 behavior. |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2781 |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2782 All arguments are optional. |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2783 |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2784 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
|
2785 topic that amount. |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2786 |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2787 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
|
2788 itself. The are STARTING-DEPTH, STARTING-POINT, and INDEX." |
3430 | 2789 |
2790 (let* ((relative-depth (or relative-depth 0)) | |
2791 (new-depth (outline-depth)) | |
2792 (starting-depth (or starting-depth new-depth)) | |
2793 (on-starting-call (null starting-point)) | |
2794 (index (or index | |
2795 ;; Leave index null on starting call, so rebullet-heading | |
2796 ;; calculates it at what might be new depth: | |
2797 (and (or (zerop relative-depth) | |
2798 (not on-starting-call)) | |
2799 (outline-sibling-index)))) | |
2800 (moving-outwards (< 0 relative-depth)) | |
2801 (starting-point (or starting-point (point)))) | |
2802 | |
2803 ;; Sanity check for excessive promotion done only on starting call: | |
2804 (and on-starting-call | |
2805 moving-outwards | |
2806 (> 0 (+ starting-depth relative-depth)) | |
2807 (error "Attempt to shift topic out beyond level 1.")) ;;; ====> | |
2808 | |
2809 (cond ((= starting-depth new-depth) | |
2810 ;; We're at depth to work on this one: | |
2811 (outline-rebullet-heading nil ;;; solicit | |
2812 (+ starting-depth ;;; starting-depth | |
2813 relative-depth) | |
2814 nil ;;; number | |
2815 index ;;; index | |
2816 ;; Every contained topic will get hit, | |
2817 ;; and we have to get to outside ones | |
2818 ;; deliberately: | |
2819 nil) ;;; do-successors | |
2820 ;; ... and work on subsequent ones which are at greater depth: | |
2821 (setq index 0) | |
2822 (outline-next-heading) | |
2823 (while (and (not (eobp)) | |
2824 (< starting-depth (outline-recent-depth))) | |
2825 (setq index (1+ index)) | |
2826 (outline-rebullet-topic-grunt relative-depth ;;; relative-depth | |
2827 (1+ starting-depth);;;starting-depth | |
2828 starting-point ;;; starting-point | |
2829 index))) ;;; index | |
2830 | |
2831 ((< starting-depth new-depth) | |
2832 ;; Rare case - subtopic more than one level deeper than parent. | |
2833 ;; Treat this one at an even deeper level: | |
2834 (outline-rebullet-topic-grunt relative-depth ;;; relative-depth | |
2835 new-depth ;;; starting-depth | |
2836 starting-point ;;; starting-point | |
2837 index))) ;;; index | |
2838 | |
2839 (if on-starting-call | |
2840 (progn | |
2841 ;; Rectify numbering of former siblings of the adjusted topic, | |
2842 ;; if topic has changed depth | |
2843 (if (or do-successors | |
2844 (and (not (zerop relative-depth)) | |
2845 (or (= (outline-recent-depth) starting-depth) | |
2846 (= (outline-recent-depth) (+ starting-depth | |
2847 relative-depth))))) | |
2848 (outline-rebullet-heading nil nil nil nil t)) | |
2849 ;; Now rectify numbering of new siblings of the adjusted topic, | |
2850 ;; if depth has been changed: | |
2851 (progn (goto-char starting-point) | |
2852 (if (not (zerop relative-depth)) | |
2853 (outline-rebullet-heading nil nil nil nil t))))) | |
2854 ) | |
2855 ) | |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2856 ;;;_ > outline-renumber-to-depth (&optional depth) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2857 (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
|
2858 "Renumber siblings at current depth. |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
2859 |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
2860 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
|
2861 |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2862 Returns final depth." |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2863 |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2864 ;; 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
|
2865 ;; 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
|
2866 |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2867 (let ((ascender (outline-depth))) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2868 (while (and (not (eobp)) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2869 (outline-depth) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2870 (>= (outline-recent-depth) depth) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2871 (>= ascender depth)) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2872 ; Skip over all topics at |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2873 ; lesser depths, which can not |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2874 ; have been disturbed: |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2875 (while (and (not (eobp)) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2876 (> (outline-recent-depth) ascender)) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2877 (outline-next-heading)) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2878 ; Prime ascender for ascension: |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2879 (setq ascender (1- (outline-recent-depth))) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2880 (if (>= (outline-recent-depth) depth) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2881 (outline-rebullet-heading nil ;;; solicit |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2882 nil ;;; depth |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2883 nil ;;; number-control |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2884 nil ;;; index |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2885 t))));;; do-successors |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2886 (outline-recent-depth)) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2887 ;;;_ > outline-number-siblings (&optional denumber) |
3430 | 2888 (defun outline-number-siblings (&optional denumber) |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2889 "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
|
2890 |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2891 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
|
2892 topic and its siblings. |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2893 |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2894 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
|
2895 rebulleting each topic at this level." |
3430 | 2896 |
2897 (interactive "P") | |
2898 | |
2899 (save-excursion | |
2900 (outline-back-to-current-heading) | |
2901 (outline-beginning-of-level) | |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2902 (let ((depth (outline-recent-depth)) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2903 (index (if (not denumber) 1)) |
3430 | 2904 (use-bullet (equal '(16) denumber)) |
2905 (more t)) | |
2906 (while more | |
2907 (outline-rebullet-heading use-bullet ;;; solicit | |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2908 depth ;;; depth |
3430 | 2909 t ;;; number-control |
2910 index ;;; index | |
2911 nil) ;;; do-successors | |
2912 (if index (setq index (1+ index))) | |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2913 (setq more (outline-next-sibling depth nil)))))) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2914 ;;;_ > outline-shift-in (arg) |
3430 | 2915 (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
|
2916 "Increase depth of current heading and any topics collapsed within it." |
3430 | 2917 (interactive "p") |
2918 (outline-rebullet-topic arg)) | |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2919 ;;;_ > outline-shift-out (arg) |
3430 | 2920 (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
|
2921 "Decrease depth of current heading and any topics collapsed within it." |
3430 | 2922 (interactive "p") |
2923 (outline-rebullet-topic (* arg -1))) | |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2924 ;;;_ : 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
|
2925 ;;;_ > outline-kill-line (&optional arg) |
3430 | 2926 (defun outline-kill-line (&optional arg) |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2927 "Kill line, adjusting subsequent lines suitably for outline mode." |
3430 | 2928 |
2929 (interactive "*P") | |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2930 (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
|
2931 outline-numbered-bullet ; numbers may need adjustment, |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2932 (bolp) ; may be clipping topic head, |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2933 (looking-at outline-regexp))) ; are clipping topic head. |
3430 | 2934 ;; Above conditions do not obtain - just do a regular kill: |
2935 (kill-line arg) | |
2936 ;; 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
|
2937 (let* ((depth (outline-depth))) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2938 ; Do the kill: |
3430 | 2939 (kill-line arg) |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2940 ; Provide some feedback: |
3430 | 2941 (sit-for 0) |
2942 (save-excursion | |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2943 ; Start with the topic |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2944 ; following killed line: |
3430 | 2945 (if (not (looking-at outline-regexp)) |
2946 (outline-next-heading)) | |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2947 (outline-renumber-to-depth depth))))) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2948 ;;;_ > outline-kill-topic () |
3430 | 2949 (defun outline-kill-topic () |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2950 "Kill topic together with subtopics. |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2951 |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2952 Leaves primary topic's trailing vertical whitespace, if any." |
3430 | 2953 |
2954 ;; Some finagling is done to make complex topic kills appear faster | |
2955 ;; than they actually are. A redisplay is performed immediately | |
2956 ;; after the region is disposed of, though the renumbering process | |
2957 ;; has yet to be performed. This means that there may appear to be | |
2958 ;; a lag *after* the kill has been performed. | |
2959 | |
2960 (interactive) | |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2961 (let* ((beg (prog1 (outline-back-to-current-heading)(beginning-of-line))) |
3430 | 2962 (depth (outline-recent-depth))) |
2963 (outline-end-of-current-subtree) | |
2964 (if (not (eobp)) | |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2965 (if (or (not (looking-at "^$")) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2966 ;; 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
|
2967 ;; 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
|
2968 ;; 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
|
2969 ;; containing topic: |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2970 (save-excursion |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2971 (and (outline-next-heading) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2972 (>= (outline-recent-depth) depth)))) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2973 (forward-char 1))) |
15664
a50ebf4ac764
(outline-auto-activation, outline-layout)
Karl Heuer <kwzh@gnu.org>
parents:
15663
diff
changeset
|
2974 |
3430 | 2975 (kill-region beg (point)) |
2976 (sit-for 0) | |
2977 (save-excursion | |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2978 (outline-renumber-to-depth depth)))) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2979 ;;;_ > outline-yank-processing () |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2980 (defun outline-yank-processing (&optional arg) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2981 |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2982 "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
|
2983 |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2984 Does depth adjustment of yanked topics, when: |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2985 |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2986 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
|
2987 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
|
2988 topic prefix. |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2989 |
13964
4de229297f1f
(outline-primary-bullet, outline-numbered-bullet,
Karl Heuer <kwzh@gnu.org>
parents:
13337
diff
changeset
|
2990 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
|
2991 |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2992 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
|
2993 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
|
2994 header into which it's being yanked. |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2995 |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
2996 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
|
2997 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
|
2998 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
|
2999 |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3000 (interactive "*P") |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3001 ; Get to beginning, leaving |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3002 ; region around subject: |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3003 (if (< (mark-marker) (point)) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3004 (exchange-point-and-mark)) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3005 (let* ((subj-beg (point)) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3006 (subj-end (mark-marker)) |
15664
a50ebf4ac764
(outline-auto-activation, outline-layout)
Karl Heuer <kwzh@gnu.org>
parents:
15663
diff
changeset
|
3007 ;; `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
|
3008 (resituate (and (outline-e-o-prefix-p) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3009 (looking-at (concat "\\(" outline-regexp "\\)")) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3010 (outline-prefix-data (match-beginning 1) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3011 (match-end 1)))) |
15664
a50ebf4ac764
(outline-auto-activation, outline-layout)
Karl Heuer <kwzh@gnu.org>
parents:
15663
diff
changeset
|
3012 ;; `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
|
3013 ;; 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
|
3014 (rectify-numbering (or resituate |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3015 (and (bolp) (looking-at outline-regexp))))) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3016 (if resituate |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3017 ; The yanked stuff is a topic: |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3018 (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
|
3019 (subj-depth (outline-recent-depth)) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3020 (prefix-bullet (outline-recent-bullet)) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3021 (adjust-to-depth |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3022 ;; 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
|
3023 ;; adjustment should be made: |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3024 (save-excursion |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3025 (and (goto-char subj-end) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3026 (eolp) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3027 (goto-char subj-beg) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3028 (and (looking-at outline-regexp) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3029 (progn |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3030 (beginning-of-line) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3031 (not (= (point) subj-beg))) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3032 (looking-at outline-regexp) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3033 (outline-prefix-data (match-beginning 0) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3034 (match-end 0))) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3035 (outline-recent-depth)))) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3036 done |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3037 (more t)) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3038 (setq rectify-numbering outline-numbered-bullet) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3039 (if adjust-to-depth |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3040 ; Do the adjustment: |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3041 (progn |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3042 (message "... yanking") (sit-for 0) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3043 (save-restriction |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3044 (narrow-to-region subj-beg subj-end) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3045 ; Trim off excessive blank |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3046 ; line at end, if any: |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3047 (goto-char (point-max)) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3048 (if (looking-at "^$") |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3049 (outline-unprotected (delete-char -1))) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3050 ; Work backwards, with each |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3051 ; shallowest level, |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3052 ; successively excluding the |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3053 ; last processed topic from |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3054 ; the narrow region: |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3055 (while more |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3056 (outline-back-to-current-heading) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3057 ; 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
|
3058 (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
|
3059 (save-excursion |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3060 (outline-rebullet-topic-grunt (- adjust-to-depth |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3061 subj-depth)) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3062 (outline-depth)) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3063 (if (setq more (not (bobp))) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3064 (progn (widen) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3065 (forward-char -1) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3066 (narrow-to-region subj-beg (point)))))) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3067 (message "") |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3068 ;; 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
|
3069 ;; use old one: |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3070 (if (string-match (regexp-quote prefix-bullet) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3071 outline-distinctive-bullets-string) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3072 ; Delete from bullet of old to |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3073 ; before bullet of new: |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3074 (progn |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3075 (beginning-of-line) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3076 (delete-region (point) subj-beg) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3077 (set-marker (mark-marker) subj-end) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3078 (goto-char subj-beg) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3079 (outline-end-of-prefix)) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3080 ; Delete base subj prefix, |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3081 ; leaving old one: |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3082 (delete-region (point) (+ (point) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3083 prefix-len |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3084 (- adjust-to-depth subj-depth))) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3085 ; and delete residual subj |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3086 ; prefix digits and space: |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3087 (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
|
3088 (if (looking-at " ") (delete-char 1)))) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3089 (exchange-point-and-mark)))) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3090 (if rectify-numbering |
15664
a50ebf4ac764
(outline-auto-activation, outline-layout)
Karl Heuer <kwzh@gnu.org>
parents:
15663
diff
changeset
|
3091 (progn |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3092 (save-excursion |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3093 ; Give some preliminary feedback: |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3094 (message "... reconciling numbers") (sit-for 0) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3095 ; ... and renumber, in case necessary: |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3096 (goto-char subj-beg) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3097 (if (outline-goto-prefix) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3098 (outline-rebullet-heading nil ;;; solicit |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3099 (outline-depth) ;;; depth |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3100 nil ;;; number-control |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3101 nil ;;; index |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3102 t)) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3103 (message "")))) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3104 (if (not resituate) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3105 (exchange-point-and-mark)))) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3106 ;;;_ > outline-yank (&optional arg) |
3430 | 3107 (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
|
3108 "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
|
3109 |
13964
4de229297f1f
(outline-primary-bullet, outline-numbered-bullet,
Karl Heuer <kwzh@gnu.org>
parents:
13337
diff
changeset
|
3110 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
|
3111 |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3112 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
|
3113 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
|
3114 |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3115 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
|
3116 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
|
3117 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
|
3118 topic prefix. |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3119 |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3120 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
|
3121 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
|
3122 header into which it's being yanked. |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3123 |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3124 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
|
3125 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
|
3126 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
|
3127 exactly like normal yanks. |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3128 |
13964
4de229297f1f
(outline-primary-bullet, outline-numbered-bullet,
Karl Heuer <kwzh@gnu.org>
parents:
13337
diff
changeset
|
3129 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
|
3130 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
|
3131 |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3132 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
|
3133 works with normal yank in non-outline buffers." |
3430 | 3134 |
3135 (interactive "*P") | |
3136 (setq this-command 'yank) | |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3137 (yank arg) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3138 (if (outline-mode-p) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3139 (outline-yank-processing))) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3140 ;;;_ > outline-yank-pop (&optional arg) |
3430 | 3141 (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
|
3142 "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
|
3143 |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
3144 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
|
3145 |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3146 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
|
3147 by pops to non-distinctive yanks. Bug..." |
3430 | 3148 |
3149 (interactive "*p") | |
3150 (setq this-command 'yank) | |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3151 (yank-pop arg) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3152 (if (outline-mode-p) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3153 (outline-yank-processing))) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3154 |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3155 ;;;_ - Specialty bullet functions |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3156 ;;;_ : File Cross references |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3157 ;;;_ > outline-resolve-xref () |
3430 | 3158 (defun outline-resolve-xref () |
7416
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
3159 "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
|
3160 |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
3161 \(Works according to setting of `outline-file-xref-bullet')." |
3430 | 3162 (interactive) |
3163 (if (not outline-file-xref-bullet) | |
3164 (error | |
15664
a50ebf4ac764
(outline-auto-activation, outline-layout)
Karl Heuer <kwzh@gnu.org>
parents:
15663
diff
changeset
|
3165 "outline cross references disabled - no `outline-file-xref-bullet'") |
3430 | 3166 (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
|
3167 (error "current heading lacks cross-reference bullet `%s'" |
3430 | 3168 outline-file-xref-bullet) |
3169 (let (file-name) | |
3170 (save-excursion | |
3171 (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
|
3172 (heading-end (progn (end-of-line) (point)))) |
3430 | 3173 (goto-char text-start) |
3174 (setq file-name | |
3175 (if (re-search-forward "\\s-\\(\\S-*\\)" heading-end t) | |
3176 (buffer-substring (match-beginning 1) (match-end 1)))))) | |
3177 (setq file-name | |
3178 (if (not (= (aref file-name 0) ?:)) | |
3179 (expand-file-name file-name) | |
15664
a50ebf4ac764
(outline-auto-activation, outline-layout)
Karl Heuer <kwzh@gnu.org>
parents:
15663
diff
changeset
|
3180 ; A registry-files ref, strip the `:' |
3430 | 3181 ; and try to follow it: |
3182 (let ((reg-ref (reference-registered-file | |
3183 (substring file-name 1) nil t))) | |
3184 (if reg-ref (car (cdr reg-ref)))))) | |
3185 (if (or (file-exists-p file-name) | |
3186 (if (file-writable-p file-name) | |
3187 (y-or-n-p (format "%s not there, create one? " | |
3188 file-name)) | |
3189 (error "%s not found and can't be created" file-name))) | |
3190 (condition-case failure | |
3191 (find-file-other-window file-name) | |
3192 (error failure)) | |
3193 (error "%s not found" file-name)) | |
3194 ) | |
3195 ) | |
3196 ) | |
3197 ) | |
7416
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 ;;;_ #6 Exposure Control and Processing |
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 ;;;_ - Fundamental |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3202 ;;;_ > outline-flag-region (from to flag) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3203 (defmacro outline-flag-region (from to flag) |
7416
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
3204 "Hide or show lines from FROM to TO, via emacs selective-display FLAG char. |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
3205 Ie, text following flag C-m \(carriage-return) is hidden until the |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
3206 next C-j (newline) char. |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
3207 |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
3208 Returns the endpoint of the region." |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3209 (` (let ((buffer-read-only nil) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3210 (outline-override-protect t)) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3211 (subst-char-in-region (, from) (, to) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3212 (if (= (, flag) ?\n) ?\r ?\n) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3213 (, flag) t)))) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3214 ;;;_ > outline-flag-current-subtree (flag) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3215 (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
|
3216 "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
|
3217 |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
3218 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
|
3219 |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3220 (save-excursion |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3221 (outline-back-to-current-heading) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3222 (outline-flag-region (point) |
7416
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
3223 (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
|
3224 flag))) |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3225 |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3226 ;;;_ - Mapping and processing of topics |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3227 ;;;_ " See also chart functions, in navigation |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3228 ;;;_ > outline-listify-exposed (&optional start end) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3229 (defun outline-listify-exposed (&optional start end) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3230 |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3231 "Produce a list representing exposed topics in current region. |
7416
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
3232 |
15664
a50ebf4ac764
(outline-auto-activation, outline-layout)
Karl Heuer <kwzh@gnu.org>
parents:
15663
diff
changeset
|
3233 This list can then be used by `outline-process-exposed' to manipulate |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3234 the subject region. |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3235 |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3236 List is composed of elements that may themselves be lists representing |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3237 exposed components in subtopic. |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3238 |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3239 Each component list contains: |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3240 - a number representing the depth of the topic, |
15664
a50ebf4ac764
(outline-auto-activation, outline-layout)
Karl Heuer <kwzh@gnu.org>
parents:
15663
diff
changeset
|
3241 - a string representing the header-prefix (ref. `outline-header-prefix'), |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3242 - a string representing the bullet character, |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3243 - and a series of strings, each containing one line of the exposed |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3244 portion of the topic entry." |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3245 |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3246 (interactive "r") |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3247 (save-excursion |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3248 (let* (strings pad result depth bullet beg next done) ; State vars. |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3249 (goto-char start) |
15664
a50ebf4ac764
(outline-auto-activation, outline-layout)
Karl Heuer <kwzh@gnu.org>
parents:
15663
diff
changeset
|
3250 (beginning-of-line) |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3251 (if (not (outline-goto-prefix)) ; Get initial position within a topic: |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3252 (outline-next-visible-heading 1)) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3253 (while (and (not done) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3254 (not (eobp)) ; Loop until we've covered the region. |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3255 (not (> (point) end))) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3256 (setq depth (outline-recent-depth) ; Current topics' depth, |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3257 bullet (outline-recent-bullet) ; ... bullet, |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3258 beg (progn (outline-end-of-prefix t) (point))) ; and beginning. |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3259 (setq done ; The boundary for the current topic: |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3260 (not (outline-next-visible-heading 1))) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3261 (beginning-of-line) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3262 (setq next (point)) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3263 (goto-char beg) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3264 (setq strings nil) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3265 (while (> next (point)) ; Get all the exposed text in |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3266 (setq strings |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3267 (cons (buffer-substring |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3268 beg |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3269 ;To hidden text or end of line: |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3270 (progn |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3271 (search-forward "\r" |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3272 (save-excursion (end-of-line) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3273 (point)) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3274 1) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3275 (if (= (preceding-char) ?\r) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3276 (1- (point)) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3277 (point)))) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3278 strings)) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3279 (if (< (point) next) ; Resume from after hid text, if any. |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3280 (forward-line 1)) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3281 (setq beg (point))) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3282 ;; Accumulate list for this topic: |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3283 (setq result |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3284 (cons (append (list depth |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3285 outline-header-prefix |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3286 bullet) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3287 (nreverse strings)) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3288 result))) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3289 ;; Put the list with first at front, to last at back: |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3290 (nreverse result)))) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3291 ;;;_ > outline-process-exposed (arg &optional tobuf) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3292 (defun outline-process-exposed (&optional func from to frombuf tobuf) |
7416
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
3293 "Map function on exposed parts of current topic; results to another buffer. |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
3294 |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
3295 Apply FUNCTION \(default 'outline-insert-listified) to exposed |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3296 portions FROM position TO position \(default region, or the entire |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3297 buffer if no region active) in buffer FROMBUF \(default current |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3298 buffer) to buffer TOBUF \(default is buffer named like frombuf but |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3299 with \"*\" prepended and \" exposed*\" appended). |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3300 |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3301 The function must as its arguments the elements of the list |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3302 representations of topic entries produced by outline-listify-exposed." |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3303 |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3304 ; Resolve arguments, |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3305 ; defaulting if necessary: |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3306 (if (not func) (setq func 'outline-insert-listified)) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3307 (if (not (and from to)) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3308 (if mark-active |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3309 (setq from (region-beginning) to (region-end)) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3310 (setq from (point-min) to (point-max)))) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3311 (if frombuf |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3312 (if (not (bufferp frombuf)) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3313 ;; Specified but not a buffer - get it: |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3314 (let ((got (get-buffer frombuf))) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3315 (if (not got) |
14416
3ec65c6789eb
(outline-process-exposed): Fix error format string.
Karl Heuer <kwzh@gnu.org>
parents:
14169
diff
changeset
|
3316 (error "outline-process-exposed: source buffer %s not found." |
3ec65c6789eb
(outline-process-exposed): Fix error format string.
Karl Heuer <kwzh@gnu.org>
parents:
14169
diff
changeset
|
3317 frombuf) |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3318 (setq frombuf got)))) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3319 ;; not specified - default it: |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3320 (setq frombuf (current-buffer))) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3321 (if tobuf |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3322 (if (not (bufferp tobuf)) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3323 (setq tobuf (get-buffer-create tobuf))) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3324 ;; not specified - default it: |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3325 (setq tobuf (concat "*" (buffer-name frombuf) " exposed*"))) |
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 (let* ((listified (progn (set-buffer frombuf) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3328 (outline-listify-exposed from to))) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3329 (prefix outline-header-prefix) ; ... as set in frombuf. |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3330 curr) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3331 (set-buffer tobuf) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3332 (while listified |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3333 (setq curr (car listified)) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3334 (setq listified (cdr listified)) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3335 (apply func (list (car curr) ; depth |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3336 (car (cdr curr)) ; header-prefix |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3337 (car (cdr (cdr curr))) ; bullet |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3338 (cdr (cdr (cdr curr)))))) ; list of text lines |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3339 (pop-to-buffer tobuf))) |
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 ;;;_ - Topic-specific |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3342 ;;;_ > outline-show-entry () |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3343 ; outline-show-entry basically for isearch dynamic exposure, as is... |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3344 (defun outline-show-entry () |
7416
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
3345 "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
|
3346 |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3347 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
|
3348 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
|
3349 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
|
3350 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
|
3351 |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3352 (interactive) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3353 (save-excursion |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3354 (outline-goto-prefix) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3355 (outline-flag-region (if (bobp) (point) (1- (point))) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3356 (or (outline-pre-next-preface) (point)) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3357 ?\n))) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3358 ;;;_ > outline-show-children (&optional level strict) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3359 (defun outline-show-children (&optional level strict) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3360 |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3361 "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
|
3362 |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3363 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
|
3364 |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3365 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
|
3366 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
|
3367 |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3368 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
|
3369 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
|
3370 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
|
3371 it. |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
3372 |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
3373 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
|
3374 point of non-opened subtree?)" |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3375 |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3376 (interactive "p") |
7416
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
3377 (let (max-pos) |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
3378 (if (and (not strict) |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
3379 (outline-hidden-p)) |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
3380 |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
3381 (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
|
3382 ; expose it. |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
3383 ;; 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
|
3384 ;; infinite regress: |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
3385 (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
|
3386 |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
3387 (save-excursion |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
3388 (save-restriction |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
3389 (let* ((start-pt (point)) |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
3390 (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
|
3391 (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
|
3392 (goto-char start-pt) |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
3393 (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
|
3394 ;; 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
|
3395 ;; unless strict was set. |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
3396 (outline-flag-region (point) (outline-snug-back) ?\n)) |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
3397 (while to-reveal |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
3398 (goto-char (car to-reveal)) |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
3399 (outline-flag-region (point) (outline-snug-back) ?\n) |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
3400 (setq to-reveal (cdr to-reveal))))))))) |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3401 ;;;_ x outline-show-current-children (&optional level strict) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3402 (defun outline-show-current-children (&optional level strict) |
7416
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
3403 "This command was misnamed, use `outline-show-children' instead. |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3404 |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3405 \(The \"current\" in the name is supposed to imply that it works on |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3406 the visible topic containing point, while it really works with respect |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3407 to the most immediate topic, concealed or not. I'll leave this old |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3408 name around for a bit, but i'll soon activate an annoying message to |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3409 warn people about the change, and then deprecate this alias." |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3410 |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3411 (interactive "p") |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3412 ;;(beep) |
15664
a50ebf4ac764
(outline-auto-activation, outline-layout)
Karl Heuer <kwzh@gnu.org>
parents:
15663
diff
changeset
|
3413 ;;(message (format "Use `%s' instead of `%s' (%s)." |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3414 ;; "outline-show-children" |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3415 ;; "outline-show-current-children" |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3416 ;; (buffer-name (current-buffer)))) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3417 (outline-show-children level strict)) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3418 ;;;_ > outline-hide-point-reconcile () |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3419 (defun outline-hide-reconcile () |
7416
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
3420 "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
|
3421 |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3422 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
|
3423 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
|
3424 (interactive) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3425 (save-excursion |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3426 (outline-goto-prefix) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3427 (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
|
3428 (progn (outline-pre-next-preface) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3429 (if (= ?\r (following-char)) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3430 (point) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3431 (1- (point)))) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3432 ?\r))) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3433 ;;;_ > outline-show-to-offshoot () |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3434 (defun outline-show-to-offshoot () |
7416
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
3435 "Like outline-show-entry, but reveals opens all concealed ancestors, as well. |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
3436 |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
3437 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
|
3438 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
|
3439 |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3440 (interactive) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3441 (save-excursion |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3442 (let ((orig-pt (point)) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3443 (orig-pref (outline-goto-prefix)) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3444 (last-at (point)) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3445 bag-it) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3446 (while (or bag-it (= (preceding-char) ?\r)) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3447 (beginning-of-line) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3448 (if (= last-at (setq last-at (point))) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3449 ;; 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
|
3450 ;; topic completely, and bag this try. |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3451 (progn (beginning-of-line) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3452 (outline-show-current-subtree) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3453 (goto-char orig-pt) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3454 (setq bag-it t) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3455 (beep) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3456 (message "%s: %s" |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3457 "outline-show-to-offshoot: " |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3458 "Aberrant nesting encountered."))) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3459 (outline-show-children) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3460 (goto-char orig-pref)) |
7416
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
3461 (goto-char orig-pt))) |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
3462 (if (outline-hidden-p) |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
3463 (outline-show-entry))) |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3464 ;;;_ > outline-hide-current-entry () |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3465 (defun outline-hide-current-entry () |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3466 "Hide the body directly following this heading." |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3467 (interactive) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3468 (outline-back-to-current-heading) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3469 (save-excursion |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3470 (outline-flag-region (point) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3471 (progn (outline-end-of-current-entry) (point)) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3472 ?\^M))) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3473 ;;;_ > outline-show-current-entry (&optional arg) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3474 (defun outline-show-current-entry (&optional arg) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3475 |
7416
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
3476 "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
|
3477 |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3478 (interactive "P") |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3479 (if arg |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3480 (outline-hide-current-entry) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3481 (save-excursion |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3482 (outline-flag-region (point) |
7416
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
3483 (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
|
3484 ?\n)))) |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3485 ;;;_ > outline-hide-current-entry-completely () |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3486 ; ... 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
|
3487 (defun outline-hide-current-entry-completely () |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3488 "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
|
3489 |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3490 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
|
3491 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
|
3492 (interactive) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3493 (save-excursion |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3494 (outline-goto-prefix) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3495 (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
|
3496 (progn (outline-pre-next-preface) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3497 (if (= ?\r (following-char)) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3498 (point) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3499 (1- (point)))) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3500 ?\r))) |
7416
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
3501 ;;;_ > 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
|
3502 (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
|
3503 "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
|
3504 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
|
3505 (interactive "P") |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
3506 (save-excursion |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
3507 (if (<= (outline-current-depth) 0) |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
3508 ;; 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
|
3509 (if (not (outline-next-heading)) |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
3510 (error "No topics.") |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
3511 ;; 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
|
3512 (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
|
3513 (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
|
3514 (if (not arg) |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
3515 (outline-flag-current-subtree ?\n) |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
3516 (outline-beginning-of-level) |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
3517 (outline-expose-topic '(* :)))))) |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3518 ;;;_ > outline-hide-current-subtree (&optional just-close) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3519 (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
|
3520 "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
|
3521 |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
3522 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
|
3523 and its siblings. |
7416
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
3524 |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
3525 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
|
3526 siblings, even if the target topic is already closed." |
3430 | 3527 |
3528 (interactive) | |
7416
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
3529 (let ((from (point)) |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
3530 (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
|
3531 (if (not (outline-goto-prefix)) |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
3532 (error "No topics found.") |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
3533 (end-of-line)(point))))) |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3534 (outline-flag-current-subtree ?\^M) |
7416
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
3535 (goto-char from) |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
3536 (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
|
3537 (end-of-line) |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
3538 (point))) |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
3539 (not just-close) |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3540 ;; 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
|
3541 (goto-char from) |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
3542 (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
|
3543 t |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
3544 (goto-char 0) |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
3545 (let ((msg |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
3546 "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
|
3547 (message msg) |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
3548 (outline-expose-topic '(0 :)) |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
3549 (message (concat msg " Done."))) |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
3550 nil) |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
3551 (/= (outline-recent-depth) 0)) |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
3552 (outline-hide-current-subtree)) |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
3553 (goto-char from))) |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3554 ;;;_ > outline-show-current-branches () |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3555 (defun outline-show-current-branches () |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3556 "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
|
3557 (interactive) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3558 (beginning-of-line) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3559 (outline-show-children t)) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3560 ;;;_ > outline-hide-current-leaves () |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3561 (defun outline-hide-current-leaves () |
15664
a50ebf4ac764
(outline-auto-activation, outline-layout)
Karl Heuer <kwzh@gnu.org>
parents:
15663
diff
changeset
|
3562 "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
|
3563 (interactive) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3564 (outline-back-to-current-heading) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3565 (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
|
3566 (point)))) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3567 |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3568 ;;;_ - Region and beyond |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3569 ;;;_ > outline-show-all () |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3570 (defun outline-show-all () |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3571 "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
|
3572 (interactive) |
7416
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
3573 (message "Exposing entire buffer...") |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
3574 (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
|
3575 (message "Exposing entire buffer... Done.")) |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3576 ;;;_ > outline-hide-bodies () |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3577 (defun outline-hide-bodies () |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3578 "Hide all of buffer except headings." |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3579 (interactive) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3580 (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
|
3581 ;;;_ > outline-hide-region-body (start end) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3582 (defun outline-hide-region-body (start end) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3583 "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
|
3584 (save-excursion |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3585 (save-restriction |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3586 (narrow-to-region start end) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3587 (goto-char (point-min)) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3588 (while (not (eobp)) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3589 (outline-flag-region (point) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3590 (progn (outline-pre-next-preface) (point)) ?\^M) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3591 (if (not (eobp)) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3592 (forward-char |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3593 (if (looking-at "[\n\r][\n\r]") |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3594 2 1))))))) |
7416
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
3595 |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
3596 ;;;_ > outline-expose-topic (spec) |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
3597 (defun outline-expose-topic (spec) |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
3598 "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
|
3599 |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
3600 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
|
3601 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
|
3602 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
|
3603 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
|
3604 |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3605 Cursor is left at start position. |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3606 |
7416
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
3607 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
|
3608 |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
3609 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
|
3610 |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3611 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
|
3612 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
|
3613 |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
3614 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
|
3615 subtopics of the current topic. |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
3616 |
15664
a50ebf4ac764
(outline-auto-activation, outline-layout)
Karl Heuer <kwzh@gnu.org>
parents:
15663
diff
changeset
|
3617 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
|
3618 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
|
3619 explicit specs following the `:'. |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3620 |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3621 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
|
3622 |
7416
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
3623 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
|
3624 - 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
|
3625 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
|
3626 that level. |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
3627 - 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
|
3628 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
|
3629 - 0 means to close topic - hide all offspring. |
15664
a50ebf4ac764
(outline-auto-activation, outline-layout)
Karl Heuer <kwzh@gnu.org>
parents:
15663
diff
changeset
|
3630 : - `repeat' |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3631 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
|
3632 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
|
3633 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
|
3634 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
|
3635 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
|
3636 * - 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
|
3637 + - 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
|
3638 - - 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
|
3639 |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3640 Examples: |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3641 \(outline-expose-topic '(-1 : 0)) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3642 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
|
3643 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
|
3644 at this current level completely. |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3645 \(outline-expose-topic '(-1 () : 1 0)) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3646 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
|
3647 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
|
3648 close the last one. |
7416
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
3649 \(outline-expose-topic '(-2 : -1 *)) |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3650 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
|
3651 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
|
3652 last and completely open the last one." |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3653 |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3654 (interactive "xExposure spec: ") |
7416
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
3655 (if (not (listp spec)) |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
3656 nil |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
3657 (let ((depth (outline-depth)) |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
3658 (max-pos 0) |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
3659 prev-elem curr-elem |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
3660 stay done |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
3661 snug-back |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
3662 ) |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
3663 (while spec |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
3664 (setq prev-elem curr-elem |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
3665 curr-elem (car spec) |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
3666 spec (cdr spec)) |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
3667 (cond ; Do current element: |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
3668 ((null curr-elem) nil) |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
3669 ((symbolp curr-elem) |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
3670 (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
|
3671 (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
|
3672 (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
|
3673 ((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
|
3674 (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
|
3675 (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
|
3676 ((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
|
3677 ((eq curr-elem ':) |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
3678 (setq stay t) |
15664
a50ebf4ac764
(outline-auto-activation, outline-layout)
Karl Heuer <kwzh@gnu.org>
parents:
15663
diff
changeset
|
3679 ;; 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
|
3680 ;; w.r.t. remaining siblings: |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
3681 (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
|
3682 ;; 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
|
3683 (- (length (outline-chart-siblings)) |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
3684 (length spec)))) |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
3685 (if (< 0 residue) |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
3686 ;; 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
|
3687 (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
|
3688 spec))))))) |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
3689 ((numberp curr-elem) |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
3690 (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
|
3691 (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
|
3692 (if (> 0 curr-elem) |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
3693 nil |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
3694 (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
|
3695 (setq max-pos |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
3696 outline-recent-end-of-subtree))))) |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
3697 (if (> (abs curr-elem) 0) |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
3698 (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
|
3699 (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
|
3700 (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
|
3701 ((listp curr-elem) |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
3702 (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
|
3703 (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
|
3704 (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
|
3705 (cond (stay (setq stay nil)) |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
3706 ((listp (car spec)) nil) |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
3707 ((> max-pos (point)) |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
3708 ;; 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
|
3709 (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
|
3710 (outline-next-heading))) |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
3711 ((outline-next-sibling depth)))) |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
3712 max-pos))) |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3713 ;;;_ > outline-old-expose-topic (spec &rest followers) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3714 (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
|
3715 |
7416
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
3716 "Deprecated. Use outline-expose-topic \(with different schema |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
3717 format\) instead. |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
3718 |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
3719 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
|
3720 |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3721 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
|
3722 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
|
3723 |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3724 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
|
3725 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
|
3726 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
|
3727 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
|
3728 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
|
3729 |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3730 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
|
3731 |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3732 - 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
|
3733 - 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
|
3734 absolute value of the number. |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3735 - 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
|
3736 - 0 just closes |
15664
a50ebf4ac764
(outline-auto-activation, outline-layout)
Karl Heuer <kwzh@gnu.org>
parents:
15663
diff
changeset
|
3737 - `*' completely opens the topic, including bodies. |
a50ebf4ac764
(outline-auto-activation, outline-layout)
Karl Heuer <kwzh@gnu.org>
parents:
15663
diff
changeset
|
3738 - `+' shows all the sub headers, but not the bodies |
a50ebf4ac764
(outline-auto-activation, outline-layout)
Karl Heuer <kwzh@gnu.org>
parents:
15663
diff
changeset
|
3739 - `-' 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
|
3740 |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3741 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
|
3742 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
|
3743 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
|
3744 for the corresponding offspring of the topic. |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3745 |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3746 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
|
3747 |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3748 (interactive "xExposure spec: ") |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3749 (let ((depth (outline-current-depth)) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3750 done |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3751 max-pos) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3752 (cond ((null spec) nil) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3753 ((symbolp spec) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3754 (if (eq spec '*) (outline-show-current-subtree)) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3755 (if (eq spec '+) (outline-show-current-branches)) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3756 (if (eq spec '-) (outline-show-current-entry))) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3757 ((numberp spec) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3758 (if (>= 0 spec) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3759 (save-excursion (outline-hide-current-subtree t) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3760 (end-of-line) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3761 (if (or (not max-pos) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3762 (> (point) max-pos)) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3763 (setq max-pos (point))) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3764 (if (> 0 spec) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3765 (setq spec (* -1 spec))))) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3766 (if (> spec 0) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3767 (outline-show-children spec))) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3768 ((listp spec) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3769 ;(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
|
3770 ; (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
|
3771 ; (setq max-pos got))) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3772 (let ((new-depth (+ (outline-current-depth) 1)) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3773 got) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3774 (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
|
3775 (setq spec (cdr spec)) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3776 (if (and spec |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3777 (outline-descend-to-depth new-depth) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3778 (not (outline-hidden-p))) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3779 (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
|
3780 (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
|
3781 (setq max-pos got))))))) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3782 (while (and followers |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3783 (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
|
3784 (progn (goto-char max-pos) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3785 (setq max-pos nil))) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3786 (end-of-line) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3787 (outline-next-sibling depth))) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3788 (outline-old-expose-topic (car followers)) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3789 (setq followers (cdr followers))) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3790 max-pos)) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3791 ;;;_ > outline-new-exposure '() |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3792 (defmacro outline-new-exposure (&rest spec) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3793 "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
|
3794 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
|
3795 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
|
3796 |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3797 Cursor is left at start position. |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3798 |
15664
a50ebf4ac764
(outline-auto-activation, outline-layout)
Karl Heuer <kwzh@gnu.org>
parents:
15663
diff
changeset
|
3799 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
|
3800 |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3801 Examples: |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3802 \(outline-exposure (-1 () () () 1) 0) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3803 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
|
3804 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
|
3805 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
|
3806 \(outline-exposure : -1 0) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3807 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
|
3808 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
|
3809 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
|
3810 \(outline-exposure -2 : -1 *) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3811 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
|
3812 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
|
3813 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
|
3814 (list 'save-excursion |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3815 '(if (not (or (outline-goto-prefix) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3816 (outline-next-heading))) |
7416
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
3817 (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
|
3818 (list 'outline-expose-topic (list 'quote spec)))) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3819 ;;;_ > outline-exposure '() |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3820 (defmacro outline-exposure (&rest spec) |
15664
a50ebf4ac764
(outline-auto-activation, outline-layout)
Karl Heuer <kwzh@gnu.org>
parents:
15663
diff
changeset
|
3821 "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
|
3822 |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3823 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
|
3824 and retains start position." |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3825 (list 'save-excursion |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3826 '(if (not (or (outline-goto-prefix) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3827 (outline-next-heading))) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3828 (error "Can't find any outline topics.")) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3829 (cons 'outline-old-expose-topic |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3830 (mapcar '(lambda (x) (list 'quote x)) spec)))) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3831 |
7416
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
3832 ;;;_ #7 ISearch with Dynamic Exposure |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3833 ;;;_ = outline-search-reconceal |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3834 (defvar outline-search-reconceal nil |
7416
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
3835 "Track whether current search match was concealed outside of search. |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
3836 |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
3837 The value is the location of the match, if it was concealed, regular |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
3838 if the entire topic was concealed, in a list if the entry was concealed.") |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3839 ;;;_ = outline-search-quitting |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3840 (defconst outline-search-quitting nil |
7416
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
3841 "Distinguishes isearch conclusion and cancellation. |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
3842 |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
3843 Used by isearch-terminate/outline-provisions and |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
3844 isearch-done/outline-provisions") |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3845 |
15664
a50ebf4ac764
(outline-auto-activation, outline-layout)
Karl Heuer <kwzh@gnu.org>
parents:
15663
diff
changeset
|
3846 |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3847 ;;;_ > outline-enwrap-isearch () |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3848 (defun outline-enwrap-isearch () |
7416
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
3849 "Impose outline-mode isearch-mode wrappers for dynamic exposure in isearch. |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
3850 |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
3851 Isearch progressively exposes and reconceals hidden topics when |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
3852 working in outline mode, but works normally elsewhere. |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3853 |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3854 The function checks to ensure that the rebindings are done only once." |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3855 |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3856 ; Should isearch-mode be employed, |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3857 (if (or (not outline-enwrap-isearch-mode) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3858 ; or are preparations already done? |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3859 (fboundp 'real-isearch-terminate)) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3860 |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3861 ;; ... no - skip this all: |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3862 nil |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3863 |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3864 ;; ... yes: |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3865 |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3866 ; Ensure load of isearch-mode: |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3867 (if (or (and (fboundp 'isearch-mode) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3868 (fboundp 'isearch-quote-char)) |
15664
a50ebf4ac764
(outline-auto-activation, outline-layout)
Karl Heuer <kwzh@gnu.org>
parents:
15663
diff
changeset
|
3869 (condition-case error |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3870 (load-library outline-enwrap-isearch-mode) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3871 (file-error (message "Skipping isearch-mode provisions - %s '%s'" |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3872 (car (cdr error)) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3873 (car (cdr (cdr error)))) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3874 (sit-for 1) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3875 ;; Inhibit subsequent tries and return nil: |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3876 (setq outline-enwrap-isearch-mode nil)))) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3877 ;; Isearch-mode loaded, encapsulate specific entry points for |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3878 ;; outline dynamic-exposure business: |
15664
a50ebf4ac764
(outline-auto-activation, outline-layout)
Karl Heuer <kwzh@gnu.org>
parents:
15663
diff
changeset
|
3879 (progn |
a50ebf4ac764
(outline-auto-activation, outline-layout)
Karl Heuer <kwzh@gnu.org>
parents:
15663
diff
changeset
|
3880 |
7416
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
3881 ;; stash crucial isearch-mode funcs under known, private |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
3882 ;; names, then register wrapper functions under the old |
15664
a50ebf4ac764
(outline-auto-activation, outline-layout)
Karl Heuer <kwzh@gnu.org>
parents:
15663
diff
changeset
|
3883 ;; names, in their stead: `isearch-quit' is pre isearch v 1.2. |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3884 (fset 'real-isearch-terminate |
15664
a50ebf4ac764
(outline-auto-activation, outline-layout)
Karl Heuer <kwzh@gnu.org>
parents:
15663
diff
changeset
|
3885 ; `isearch-quit' is pre v 1.2: |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3886 (or (if (fboundp 'isearch-quit) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3887 (symbol-function 'isearch-quit)) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3888 (if (fboundp 'isearch-abort) |
15664
a50ebf4ac764
(outline-auto-activation, outline-layout)
Karl Heuer <kwzh@gnu.org>
parents:
15663
diff
changeset
|
3889 ; `isearch-abort' is v 1.2 and on: |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3890 (symbol-function 'isearch-abort)))) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3891 (fset 'isearch-quit 'isearch-terminate/outline-provisions) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3892 (fset 'isearch-abort 'isearch-terminate/outline-provisions) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3893 (fset 'real-isearch-done (symbol-function 'isearch-done)) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3894 (fset 'isearch-done 'isearch-done/outline-provisions) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3895 (fset 'real-isearch-update (symbol-function 'isearch-update)) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3896 (fset 'isearch-update 'isearch-update/outline-provisions) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3897 (make-variable-buffer-local 'outline-search-reconceal))))) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3898 ;;;_ > outline-isearch-arrival-business () |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3899 (defun outline-isearch-arrival-business () |
7416
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
3900 "Do outline business like exposing current point, if necessary. |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
3901 |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
3902 Registers reconcealment requirements in outline-search-reconceal |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3903 accordingly. |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3904 |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3905 Set outline-search-reconceal to nil if current point is not |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3906 concealed, to value of point if entire topic is concealed, and a |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3907 list containing point if only the topic body is concealed. |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3908 |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3909 This will be used to determine whether outline-hide-current-entry |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3910 or outline-hide-current-entry-completely will be necessary to |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3911 restore the prior concealment state." |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3912 |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3913 (if (outline-mode-p) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3914 (setq outline-search-reconceal |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3915 (if (outline-hidden-p) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3916 (save-excursion |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3917 (if (re-search-backward outline-line-boundary-regexp nil 1) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3918 ;; Nil value means we got to b-o-b - wouldn't need |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3919 ;; to advance. |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3920 (forward-char 1)) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3921 ; We'll return point or list |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3922 ; containing point, depending |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3923 ; on concealment state of |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3924 ; topic prefix. |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3925 (prog1 (if (outline-hidden-p) (point) (list (point))) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3926 ; And reveal the current |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3927 ; search target: |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3928 (outline-show-entry))))))) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3929 ;;;_ > outline-isearch-advancing-business () |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3930 (defun outline-isearch-advancing-business () |
7416
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
3931 "Do outline business like deexposing current point, if necessary. |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
3932 |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
3933 Works according to reconceal state registration." |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3934 (if (and (outline-mode-p) outline-search-reconceal) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3935 (save-excursion |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3936 (if (listp outline-search-reconceal) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3937 ;; Leave the topic visible: |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3938 (progn (goto-char (car outline-search-reconceal)) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3939 (outline-hide-current-entry)) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3940 ;; Rehide the entire topic: |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3941 (goto-char outline-search-reconceal) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3942 (outline-hide-current-entry-completely))))) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3943 ;;;_ > isearch-terminate/outline-provisions () |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3944 (defun isearch-terminate/outline-provisions () |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3945 (interactive) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3946 (if (and (outline-mode-p) outline-enwrap-isearch-mode) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3947 (outline-isearch-advancing-business)) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3948 (let ((outline-search-quitting t) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3949 (outline-search-reconceal nil)) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3950 (real-isearch-terminate))) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3951 ;;;_ > isearch-done/outline-provisions () |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3952 (defun isearch-done/outline-provisions (&optional nopush) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3953 (interactive) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3954 (if (and (outline-mode-p) outline-enwrap-isearch-mode) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3955 (progn (if (and outline-search-reconceal |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3956 (not (listp outline-search-reconceal))) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3957 ;; The topic was concealed - reveal it, its siblings, |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3958 ;; and any ancestors that are still concealed: |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3959 (save-excursion |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3960 (message "(exposing destination)")(sit-for 0) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3961 (outline-goto-prefix) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3962 ; There may be a closed blank |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3963 ; line between prior and |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3964 ; current topic that would be |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3965 ; missed - provide for it: |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3966 (if (not (bobp)) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3967 (progn (forward-char -1) ; newline |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3968 (if (eq ?\r (preceding-char)) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3969 (outline-flag-region (1- (point)) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3970 (point) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3971 ?\n)) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3972 (forward-char 1))) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3973 ; Goto parent |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3974 (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
|
3975 (outline-show-children))) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3976 (if (and (boundp 'outline-search-quitting) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3977 outline-search-quitting) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3978 nil |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3979 ; We're concluding abort: |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3980 (outline-isearch-arrival-business) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3981 (outline-show-children)))) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3982 (if nopush |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3983 ;; isearch-done in newer version of isearch mode takes arg: |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3984 (real-isearch-done nopush) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3985 (real-isearch-done))) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3986 ;;;_ > isearch-update/outline-provisions () |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3987 (defun isearch-update/outline-provisions () |
7416
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
3988 "Wrapper dynamically adjusts isearch target exposure. |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
3989 |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
3990 Appropriately exposes and reconceals hidden outline portions, as |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
3991 necessary, in the course of searching." |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3992 (if (not (and (outline-mode-p) outline-enwrap-isearch-mode)) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3993 ;; Just do the plain business: |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3994 (real-isearch-update) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3995 |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3996 ;; Ah - provide for outline conditions: |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3997 (outline-isearch-advancing-business) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3998 (real-isearch-update) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
3999 (cond (isearch-success (outline-isearch-arrival-business)) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4000 ((not isearch-success) (outline-isearch-advancing-business))))) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4001 |
7416
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
4002 ;;;_ #8 Copying and printing |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4003 |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4004 ;;;_ - Copy exposed |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4005 ;;;_ > outline-insert-listified (depth prefix bullet text) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4006 (defun outline-insert-listified (depth prefix bullet text) |
7416
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
4007 "Insert contents of listified outline portion in current buffer." |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4008 (insert-string (concat (if (> depth 1) prefix "") |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4009 (make-string (1- depth) ?\ ) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4010 bullet)) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4011 (while text |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4012 (insert-string (car text)) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4013 (if (setq text (cdr text)) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4014 (insert-string "\n"))) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4015 (insert-string "\n")) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4016 ;;;_ > outline-copy-exposed (arg &optional tobuf) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4017 (defun outline-copy-exposed (arg &optional tobuf) |
7416
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
4018 "Duplicate exposed portions of current topic to another buffer. |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
4019 |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
4020 Other buffer has current buffers' name with \" exposed\" appended to it. |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4021 |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4022 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
|
4023 |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4024 (interactive "P") |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4025 (if (not tobuf) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4026 (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
|
4027 (let* ((start-pt (point)) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4028 (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
|
4029 (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
|
4030 (buf (current-buffer))) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4031 (save-excursion (set-buffer tobuf)(erase-buffer)) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4032 (outline-process-exposed 'outline-insert-listified |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4033 beg |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4034 end |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4035 (current-buffer) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4036 tobuf) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4037 (goto-char (point-min)) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4038 (pop-to-buffer buf) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4039 (goto-char start-pt))) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4040 |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4041 ;;;_ - LaTeX formatting |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4042 ;;;_ > outline-latex-verb-quote (str &optional flow) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4043 (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
|
4044 "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
|
4045 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
|
4046 string across latex processing." |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4047 (mapconcat '(lambda (char) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4048 ;;;mess: (cond ((memq char '(?"" ?$ ?% ?# ?& ?- ?" ?` ?^ ?- ?*));;;")))) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4049 (cond ((memq char '(?\\ ?$ ?% ?# ?& ?{ ?} ?_ ?^ ?- ?*)) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4050 (concat "\\char" (number-to-string char) "{}")) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4051 ((= char ?\n) "\\\\") |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4052 (t (char-to-string char)))) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4053 str |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4054 "")) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4055 ;;;_ > outline-latex-verbatim-quote-curr-line () |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4056 (defun outline-latex-verbatim-quote-curr-line () |
7416
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
4057 "Express line for exact \(literal\) representation across latex processing. |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
4058 |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
4059 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
|
4060 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
|
4061 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
|
4062 (beginning-of-line) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4063 (let ((beg (point)) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4064 (end (progn (end-of-line)(point)))) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4065 (goto-char beg) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4066 (while (re-search-forward "\\\\" |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4067 ;;"\\\\\\|\\{\\|\\}\\|\\_\\|\\$\\|\\\"\\|\\&\\|\\^\\|\\-\\|\\*\\|#" |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4068 end ; bounded by end-of-line |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4069 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
|
4070 (goto-char (match-beginning 0)) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4071 (insert-string "\\") |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4072 (setq end (1+ end)) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4073 (goto-char (1+ (match-end 0)))))) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4074 ;;;_ > outline-insert-latex-header (buf) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4075 (defun outline-insert-latex-header (buf) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4076 "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
|
4077 ;; 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
|
4078 ;; the TeXBook, pg 421. |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4079 (set-buffer buf) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4080 (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
|
4081 "report")) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4082 (page-numbering (if outline-number-pages |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4083 "\\pagestyle{empty}\n" |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4084 "")) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4085 (linesdef (concat "\\def\\beginlines{" |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4086 "\\par\\begingroup\\nobreak\\medskip" |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4087 "\\parindent=0pt\n" |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4088 " \\kern1pt\\nobreak \\obeylines \\obeyspaces " |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4089 "\\everypar{\\strut}}\n" |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4090 "\\def\\endlines{" |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4091 "\\kern1pt\\endgroup\\medbreak\\noindent}\n")) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4092 (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
|
4093 outline-title-style)) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4094 (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
|
4095 outline-label-style)) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4096 (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
|
4097 outline-head-line-style)) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4098 (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
|
4099 outline-body-line-style)) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4100 (setlength (format "%s%s%s%s" |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4101 "\\newlength{\\stepsize}\n" |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4102 "\\setlength{\\stepsize}{" |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4103 outline-indent |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4104 "}\n")) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4105 (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
|
4106 "\\newcommand{\\OneHeadLine}[3]{%\n" |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4107 "\\noindent%\n" |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4108 "\\hspace*{#2\\stepsize}%\n" |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4109 "\\labelcmd{#1}\\hspace*{.2cm}" |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4110 "\\headlinecmd{#3}\\\\[" |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4111 outline-line-skip |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4112 "]\n}\n")) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4113 (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
|
4114 "\\newcommand{\\OneBodyLine}[2]{%\n" |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4115 "\\noindent%\n" |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4116 "\\hspace*{#1\\stepsize}%\n" |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4117 "\\bodylinecmd{#2}\\\\[" |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4118 outline-line-skip |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4119 "]\n}\n")) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4120 (begindoc "\\begin{document}\n\\begin{center}\n") |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4121 (title (format "%s%s%s%s" |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4122 "\\titlecmd{" |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4123 (outline-latex-verb-quote (if outline-title |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4124 (condition-case err |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4125 (eval outline-title) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4126 (error "<unnamed buffer>")) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4127 "Unnamed Outline")) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4128 "}\n" |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4129 "\\end{center}\n\n")) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4130 (hsize "\\hsize = 7.5 true in\n") |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4131 (hoffset "\\hoffset = -1.5 true in\n") |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4132 (vspace "\\vspace{.1cm}\n\n")) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4133 (insert (concat doc-style |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4134 page-numbering |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4135 titlecmd |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4136 labelcmd |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4137 headlinecmd |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4138 bodylinecmd |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4139 setlength |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4140 oneheadline |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4141 onebodyline |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4142 begindoc |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4143 title |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4144 hsize |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4145 hoffset |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4146 vspace) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4147 ))) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4148 ;;;_ > outline-insert-latex-trailer (buf) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4149 (defun outline-insert-latex-trailer (buf) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4150 "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
|
4151 (set-buffer buf) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4152 (insert "\n\\end{document}\n")) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4153 ;;;_ > 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
|
4154 (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
|
4155 "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
|
4156 |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
4157 Args are the topics' numeric DEPTH, the header PREFIX lead string, the |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
4158 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
|
4159 (let* ((head-line (if text (car text))) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4160 (body-lines (cdr text)) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4161 (curr-line) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4162 body-content bop) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4163 ; Do the head line: |
15664
a50ebf4ac764
(outline-auto-activation, outline-layout)
Karl Heuer <kwzh@gnu.org>
parents:
15663
diff
changeset
|
4164 (insert-string (concat "\\OneHeadLine{\\verb\1 " |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4165 (outline-latex-verb-quote bullet) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4166 "\1}{" |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4167 depth |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4168 "}{\\verb\1 " |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4169 (if head-line |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4170 (outline-latex-verb-quote head-line) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4171 "") |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4172 "\1}\n")) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4173 (if (not body-lines) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4174 nil |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4175 ;;(insert-string "\\beginlines\n") |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4176 (insert-string "\\begin{verbatim}\n") |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4177 (while body-lines |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4178 (setq curr-line (car body-lines)) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4179 (if (and (not body-content) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4180 (not (string-match "^\\s-*$" curr-line))) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4181 (setq body-content t)) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4182 ; Mangle any occurrences of |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4183 ; "\end{verbatim}" in text, |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4184 ; it's special: |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4185 (if (and body-content |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4186 (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
|
4187 (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
|
4188 ">" |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4189 (substring curr-line bop)))) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4190 ;;(insert-string "|" (car body-lines) "|") |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4191 (insert-string curr-line) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4192 (outline-latex-verbatim-quote-curr-line) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4193 (insert-string "\n") |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4194 (setq body-lines (cdr body-lines))) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4195 (if body-content |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4196 (setq body-content nil) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4197 (forward-char -1) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4198 (insert-string "\\ ") |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4199 (forward-char 1)) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4200 ;;(insert-string "\\endlines\n") |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4201 (insert-string "\\end{verbatim}\n") |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4202 ))) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4203 ;;;_ > outline-latexify-exposed (arg &optional tobuf) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4204 (defun outline-latexify-exposed (arg &optional tobuf) |
7416
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
4205 "Format current topic's exposed portions to TOBUF for latex processing. |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
4206 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
|
4207 with \"*\" prepended and \" latex-formed*\" appended. |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4208 |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4209 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
|
4210 |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4211 (interactive "P") |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4212 (if (not tobuf) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4213 (setq tobuf |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4214 (get-buffer-create (concat "*" (buffer-name) " latexified*")))) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4215 (let* ((start-pt (point)) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4216 (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
|
4217 (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
|
4218 (buf (current-buffer))) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4219 (set-buffer tobuf) |
3430 | 4220 (erase-buffer) |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4221 (outline-insert-latex-header tobuf) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4222 (goto-char (point-max)) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4223 (outline-process-exposed 'outline-latexify-one-item |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4224 beg |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4225 end |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4226 buf |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4227 tobuf) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4228 (goto-char (point-max)) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4229 (outline-insert-latex-trailer tobuf) |
3430 | 4230 (goto-char (point-min)) |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4231 (pop-to-buffer buf) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4232 (goto-char start-pt))) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4233 |
7416
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
4234 ;;;_ #9 miscellaneous |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4235 ;;;_ > outline-mark-topic () |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4236 (defun outline-mark-topic () |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4237 "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
|
4238 (interactive) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4239 (beginning-of-line) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4240 (outline-goto-prefix) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4241 (push-mark (point)) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4242 (outline-end-of-current-subtree) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4243 (exchange-point-and-mark)) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4244 ;;;_ > outlineify-sticky () |
7416
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
4245 ;; 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
|
4246 (defalias 'outlinify-sticky 'outlineify-sticky) |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4247 (defun outlineify-sticky (&optional arg) |
13964
4de229297f1f
(outline-primary-bullet, outline-numbered-bullet,
Karl Heuer <kwzh@gnu.org>
parents:
13337
diff
changeset
|
4248 "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
|
4249 |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
4250 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
|
4251 setup for auto-startup." |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
4252 |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
4253 (interactive "P") |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
4254 |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
4255 (outline-mode t) |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
4256 |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
4257 (save-excursion |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
4258 (goto-char (point-min)) |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
4259 (if (looking-at outline-regexp) |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
4260 t |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
4261 (outline-open-topic 2) |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
4262 (insert-string (concat "Dummy outline topic header - see" |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
4263 "`outline-mode' docstring for info.")) |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
4264 (next-line 1) |
3430 | 4265 (goto-char (point-max)) |
7416
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
4266 (next-line 1) |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
4267 (outline-open-topic 0) |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
4268 (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
|
4269 (outline-open-topic 1) |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
4270 (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
|
4271 (outline-open-topic 0) |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
4272 (insert-string "Local variables:\n") |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
4273 (outline-open-topic 0) |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
4274 (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
|
4275 (or outline-layout |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
4276 '(1 : 0)))) |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
4277 (outline-open-topic 0) |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
4278 (insert-string "End:\n")))) |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4279 ;;;_ > solicit-char-in-string (prompt string &optional do-defaulting) |
3430 | 4280 (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
|
4281 "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
|
4282 |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4283 Optional arg DO-DEFAULTING indicates to accept empty input (CR)." |
3430 | 4284 |
4285 (let ((new-prompt prompt) | |
4286 got) | |
4287 | |
4288 (while (not got) | |
4289 (message "%s" new-prompt) | |
4290 | |
4291 ;; We do our own reading here, so we can circumvent, eg, special | |
15664
a50ebf4ac764
(outline-auto-activation, outline-layout)
Karl Heuer <kwzh@gnu.org>
parents:
15663
diff
changeset
|
4292 ;; treatment for `?' character. (Might oughta change minibuffer |
3430 | 4293 ;; keymap instead, oh well.) |
4294 (setq got | |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4295 (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
|
4296 |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4297 (if (null (string-match (regexp-quote got) string)) |
3430 | 4298 (if (and do-defaulting (string= got "\^M")) |
4299 ;; We're defaulting, return null string to indicate that: | |
4300 (setq got "") | |
4301 ;; Failed match and not defaulting, | |
4302 ;; set the prompt to give feedback, | |
4303 (setq new-prompt (concat prompt | |
4304 got | |
4305 " ...pick from: " | |
4306 string | |
4307 "")) | |
4308 ;; and set loop to try again: | |
4309 (setq got nil)) | |
4310 ;; Got a match - give feedback: | |
4311 (message ""))) | |
4312 ;; got something out of loop - return it: | |
4313 got) | |
4314 ) | |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4315 ;;;_ > regexp-sans-escapes (string) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4316 (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
|
4317 "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
|
4318 |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4319 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
|
4320 single backslash. |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4321 |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4322 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
|
4323 |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4324 (if (string= regexp "") |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4325 "" |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4326 ;; 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
|
4327 ;; backslash, or else to nil: |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4328 (setq successive-backslashes |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4329 (if (= (aref regexp 0) ?\\) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4330 (if successive-backslashes (1+ successive-backslashes) 1) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4331 nil)) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4332 (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
|
4333 ;; Include first char: |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4334 (concat (substring regexp 0 1) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4335 (regexp-sans-escapes (substring regexp 1))) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4336 ;; Exclude first char, but maintain count: |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4337 (regexp-sans-escapes (substring regexp 1) successive-backslashes)))) |
7416
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
4338 ;;;_ - add-hook definition for divergent emacsen |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4339 ;;;_ > add-hook (hook function &optional append) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4340 (if (not (fboundp 'add-hook)) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4341 (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
|
4342 "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
|
4343 \(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
|
4344 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
|
4345 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
|
4346 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
|
4347 (or (boundp hook) (set hook nil)) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4348 (or (if (consp function) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4349 ;; 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
|
4350 ;; is equal to anything in the hook. |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4351 (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
|
4352 (equal function tail)) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4353 (memq function (symbol-value hook))) |
15664
a50ebf4ac764
(outline-auto-activation, outline-layout)
Karl Heuer <kwzh@gnu.org>
parents:
15663
diff
changeset
|
4354 (set hook |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4355 (if append |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4356 (nconc (symbol-value hook) (list function)) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4357 (cons function (symbol-value hook))))))) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4358 |
7416
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
4359 ;;;_ #10 Under development |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4360 ;;;_ > outline-bullet-isearch (&optional bullet) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4361 (defun outline-bullet-isearch (&optional bullet) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4362 "Isearch \(regexp\) for topic with bullet BULLET." |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4363 (interactive) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4364 (if (not bullet) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4365 (setq bullet (solicit-char-in-string |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4366 "ISearch for topic with bullet: " |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4367 (regexp-sans-escapes outline-bullets-string)))) |
15664
a50ebf4ac764
(outline-auto-activation, outline-layout)
Karl Heuer <kwzh@gnu.org>
parents:
15663
diff
changeset
|
4368 |
7218
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4369 (let ((isearch-regexp t) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4370 (isearch-string (concat "^" |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4371 outline-header-prefix |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4372 "[ \t]*" |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4373 bullet))) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4374 (isearch-repeat 'forward) |
49f9f9a08b4c
major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
4375 (isearch-mode t))) |
7416
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
4376 ;;;_ ? 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
|
4377 ;;; wrapping the isearch functions. |
3430 | 4378 |
4379 ;;;_* Local emacs vars. | |
7416
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
4380 ;;; 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
|
4381 ;;; - 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
|
4382 ;;; - 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
|
4383 ;;; - 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
|
4384 ;;; - 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
|
4385 ;;;Local variables: |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
4386 ;;;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
|
4387 ;;;End: |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
4388 |
4996c50431de
(outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents:
7218
diff
changeset
|
4389 ;; allout.el ends here |