annotate lisp/allout.el @ 7481:b7d23c08750c

(child_setup): PRIO_PROCESS renamed to SET_EMACS_PRIORITY. Don't call nice if emacs_priority is positive.
author Richard M. Stallman <rms@gnu.org>
date Fri, 13 May 1994 07:18:18 +0000
parents d1cbb5dd3434
children 1f09079e18c4
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
7416
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1 ;;;_* allout.el - Extensive outline mode for use alone and with other modes.
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
2
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
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
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
5 ;; Author: Ken Manheimer <klm@nist.gov>
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
6 ;; Maintainer: Ken Manheimer <klm@nist.gov>
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
7476
d1cbb5dd3434 (outline-init): Delete junk at end.
Richard M. Stallman <rms@gnu.org>
parents: 7416
diff changeset
8 ;; Version: $Id: allout.el,v 1.7 1994/05/09 06:36:19 rms Exp rms $||
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
9 ;; Keywords: outline mode
3430
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11 ;; This file is part of GNU Emacs.
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
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
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
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
3e1323443b1a Fix copying conditions for current GPL version.
Richard M. Stallman <rms@gnu.org>
parents: 5310
diff changeset
24 ;; along with GNU Emacs; see the file COPYING. If not, write to
3e1323443b1a Fix copying conditions for current GPL version.
Richard M. Stallman <rms@gnu.org>
parents: 5310
diff changeset
25 ;; the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
3430
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
26
7416
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
27 ;;;_* Commentary:
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
28
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
29 ;; 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
30 ;; 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
31 ;; 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
32 ;; 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
33 ;; 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
34 ;; allout code itself, 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
35 ;;
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
36 ;; 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
37 ;; paste; integral outline exposure-layout; incremental search with
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
38 ;; dynamic exposure/conceament of concealed text; automatic topic-number
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
39 ;; maintenance; and many other features.
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
40 ;;
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
41 ;; 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
42 ;; `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
43 ;; 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
44 ;; 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
45 ;;
7416
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
46 ;; Note - the lines beginning with ';;;_' are outline topic headers.
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
47 ;; Just 'ESC-x eval-current-buffer' to give it a whirl.
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
48
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
49 ;;Ken Manheimer 301 975-3539
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
50 ;;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
51 ;;
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
52 ;;Computer Systems and Communications Division
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
53 ;;
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
54 ;; Nat'l Institute of Standards and Technology
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
55 ;; Technology A151
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
56 ;; Gaithersburg, MD 20899
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
57
7416
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
58 ;;;_* Provide
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
59 (provide 'outline)
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
60 (provide 'allout)
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
61
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
62 ;;;_* USER CUSTOMIZATION VARIABLES:
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
63
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
64 ;;;_ + 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
65
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
66 ;;;_ = outline-auto-activation
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
67 (defvar outline-auto-activation nil
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
68 "*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
69
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
70 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
71 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
72 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
73 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
74
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
75 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
76 \(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
77 `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
78
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
79 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
80 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
81
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
82 With value `activate', only auto-mode-activation is enabled, auto-
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
83 layout is not.
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
84
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
85 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
86 enabled.
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
87
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
88 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
89 this variable.")
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
90 ;;;_ = outline-layout
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
91 (defvar outline-layout nil
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
92 "*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
93
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
94 Buffer-specific.
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
95
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
96 A list value specifies a default layout for the current buffer, to be
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
97 applied upon activation of allout outline-mode. Any non-nil value
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
98 will automatically trigger allout outline-mode, provided `outline-
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
99 init' has been called to enable it.
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 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
102 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
103 the layout specification.
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
104
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
105 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
106 this var via the file's local variables. For example, the following
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
107 lines at the bottom of an elisp file:
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
108
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
109 ;;;Local variables:
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
110 ;;;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
111 ;;;End:
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
112
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
113 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
114 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
115 `\(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
116 the allout.el, itself.)
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 Also, allout's mode-specific provisions will make topic prefixes
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
119 default to the comment-start string, if any, of the language of the
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
120 file. This is modulo the setting of `outline-use-mode-specific-
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
121 leader', which see.")
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
122 (make-variable-buffer-local 'outline-layout)
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
123
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
124 ;;;_ = outline-header-prefix
3430
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
125 (defvar outline-header-prefix "."
7416
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
126 "*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
127
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
128 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
129 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
130 \(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
131 character, which is typically set to the outline-primary-bullet. Many
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
132 outlines start at level 2 to avoid this discrepancy.")
3430
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
133 (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
134 ;;;_ = outline-primary-bullet
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
135 (defvar outline-primary-bullet "*"
7416
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
136 "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
137
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
138 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
139 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
140 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
141
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
142 The value of an asterisk ('*') provides for backwards compatability
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
143 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
144 and outline-distinctive-bullets-string for the range of available
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
145 bullets.")
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
146 (make-variable-buffer-local 'outline-primary-bullet)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
147 ;;;_ = outline-plain-bullets-string
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
148 (defvar outline-plain-bullets-string (concat outline-primary-bullet
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
149 "+-:.;,")
7416
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
150 "*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
151
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
152 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
153 bullets.
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
154
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
155 DO NOT include the close-square-bracket, ']', as a bullet.
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
156
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
157 Outline mode has to be reactivated in order for changes to the value
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
158 of this var to take effect.")
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
159 (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
160 ;;;_ = outline-distinctive-bullets-string
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
161 (defvar 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
162 "*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
163
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
164 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
165 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
166 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
167 the selection of alternating bullets.
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
168
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
169 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
170 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
171
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
172 DO NOT include the close-square-bracket, ']', on either of the bullet
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
173 strings.")
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
174 (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
175
7416
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
176 ;;;_ = outline-use-mode-specific-leader
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
177 (defvar outline-use-mode-specific-leader t
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
178 "*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
179
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
180 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
181 and/or comment-start string, if any, to lead the topic prefix string,
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
182 so topic headers look like comments in the programming language.
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
183
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
184 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
185
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
186 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
187 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
188 \(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
189
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
190 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
191 `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
192
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
193 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
194
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
195 comment-start strings that do not end in spaces are tripled, and an
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
196 '_' underscore is tacked on the end, to distinguish them from regular
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
197 comment strings. comment-start strings that do end in spaces are not
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
198 tripled, but an underscore is substituted for the space. \[This
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
199 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
200 can use `outline-mode-leaders' to override this behavior, when
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
201 incorrect.\]")
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
202 ;;;_ = outline-mode-leaders
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
203 (defvar outline-mode-leaders '()
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
204 "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
205
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
206 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
207 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
208
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
209 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
210 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
211 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
212 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
213
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
214 ;;;_ = outline-old-style-prefixes
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
215 (defvar outline-old-style-prefixes nil
7416
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
216 "*When non-nil, use only old-and-crusty outline-mode '*' topic prefixes.
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
217
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
218 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
219 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
220 like the original emacs-outline style prefixes.
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
221
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
222 Whatever the setting of this variable, both old and new style prefixes
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
223 are always respected by the topic maneuvering functions.")
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
224 (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
225 ;;;_ = outline-stylish-prefixes - alternating bullets
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
226 (defvar outline-stylish-prefixes t
7416
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
227 "*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
228
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
229 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
230 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
231 depth) just preceding the start of the topic text) according to level.
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
232 Otherwise, only asterisks ('*') and distinctive bullets are used.
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 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
235 prefixes:
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
236
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
237 * Top level
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
238 .* A topic
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
239 . + One level 3 subtopic
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
240 . . One level 4 subtopic
7416
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
241 . . A second 4 subtopic
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
242 . + Another level 3 subtopic
7416
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
243 . #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
244 . #2 Another
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
245 . ! 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
246 . #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
247
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
248 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
249 numbered and other distinctive bullets retained):
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
250
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
251 * Top level
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
252 .* A topic
7416
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
253 . * One level 3 subtopic
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
254 . * One level 4 subtopic
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
255 . * A second 4 subtopic
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
256 . * Another level 3 subtopic
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
257 . #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
258 . #2 Another
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
259 . ! 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
260 . #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
261
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
262 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
263 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
264 this variable setting.
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
265
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
266 The setting of this var is not relevant when outline-old-style-prefixes
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
267 is non-nil.")
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
268 (make-variable-buffer-local 'outline-stylish-prefixes)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
269
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
270 ;;;_ = outline-numbered-bullet
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
271 (defvar outline-numbered-bullet "#"
7416
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
272 "*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
273
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
274 Topics having this bullet have automatic maintainence of a sibling
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
275 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
276 to \"#\", you can set it to a bullet of your choice. A nil value
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
277 disables numbering maintainence.")
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
278 (make-variable-buffer-local 'outline-numbered-bullet)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
279 ;;;_ = outline-file-xref-bullet
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
280 (defvar outline-file-xref-bullet "@"
7416
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
281 "*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
282
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
283 Set this var to the bullet you want to use for file cross-references.
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
284 Set it 'nil' if you want to inhibit this capability.")
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
285
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
286 ;;;_ + LaTeX formatting
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
287 ;;;_ - outline-number-pages
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
288 (defvar outline-number-pages nil
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
289 "*Non-nil turns on page numbering for LaTeX formatting of an outline.")
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
290 ;;;_ - outline-label-style
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
291 (defvar outline-label-style "\\large\\bf"
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
292 "*Font and size of labels for LaTeX formatting of an outline.")
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
293 ;;;_ - outline-head-line-style
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
294 (defvar outline-head-line-style "\\large\\sl "
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
295 "*Font and size of entries for LaTeX formatting of an outline.")
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
296 ;;;_ - outline-body-line-style
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
297 (defvar outline-body-line-style " "
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
298 "*Font and size of entries for LaTeX formatting of an outline.")
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
299 ;;;_ - outline-title-style
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
300 (defvar outline-title-style "\\Large\\bf"
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
301 "*Font and size of titles for LaTeX formatting of an outline.")
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
302 ;;;_ - outline-title
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
303 (defvar outline-title '(or buffer-file-name (current-buffer-name))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
304 "*Expression to be evaluated to determine the title for LaTeX
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
305 formatted copy.")
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
306 ;;;_ - outline-line-skip
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
307 (defvar outline-line-skip ".05cm"
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
308 "*Space between lines for LaTeX formatting of an outline.")
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
309 ;;;_ - outline-indent
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
310 (defvar outline-indent ".3cm"
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
311 "*LaTeX formatted depth-indent spacing.")
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
312
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
313 ;;;_ + Miscellaneous customization
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
314
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
315 ;;;_ = outline-keybindings-list
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
316 ;;; You have to reactivate outline-mode - '(outline-mode t)' - to
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
317 ;;; institute changes to this var.
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
318 (defvar outline-keybindings-list ()
7416
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
319 "*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
320
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
321 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
322 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
323 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
324 will be used as is.")
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
325 (setq outline-keybindings-list
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
326 '(
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
327 ; Motion commands:
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
328 ("?t" outline-latexify-exposed)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
329 ("\C-n" outline-next-visible-heading)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
330 ("\C-p" outline-previous-visible-heading)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
331 ("\C-u" outline-up-current-level)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
332 ("\C-f" outline-forward-current-level)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
333 ("\C-b" outline-backward-current-level)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
334 ("\C-a" outline-beginning-of-current-entry)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
335 ("\C-e" outline-end-of-current-entry)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
336 ;;("\C-n" outline-next-line-or-topic)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
337 ;;("\C-p" outline-previous-line-or-topic)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
338 ; Exposure commands:
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
339 ("\C-i" outline-show-children)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
340 ("\C-s" outline-show-current-subtree)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
341 ("\C-h" outline-hide-current-subtree)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
342 ("\C-o" outline-show-current-entry)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
343 ("!" outline-show-all)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
344 ; Alteration commands:
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
345 (" " outline-open-sibtopic)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
346 ("." outline-open-subtopic)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
347 ("," outline-open-supertopic)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
348 ("'" outline-shift-in)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
349 (">" outline-shift-in)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
350 ("<" outline-shift-out)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
351 ("\C-m" outline-rebullet-topic)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
352 ("b" outline-rebullet-current-heading)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
353 ("#" outline-number-siblings)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
354 ("\C-k" outline-kill-line t)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
355 ("\C-y" outline-yank t)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
356 ("\M-y" outline-yank-pop t)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
357 ("\C-k" outline-kill-topic)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
358 ; Miscellaneous commands:
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
359 ("\C-@" outline-mark-topic)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
360 ("@" outline-resolve-xref)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
361 ("?c" outline-copy-exposed)))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
362
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
363 ;;;_ = outline-command-prefix
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
364 (defvar outline-command-prefix "\C-c"
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
365 "*Key sequence to be used as prefix for outline mode command key bindings.")
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
366
7416
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
367 ;;;_ = outline-enwrap-isearch-mode
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
368 (defvar outline-enwrap-isearch-mode t
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
369 "*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
370
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
371 If non-nil, isearch will expose hidden text encountered in the course
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
372 of a search, and to reconceal it if the search is continued past it.")
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
373
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
374 ;;;_ = outline-use-hanging-indents
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
375 (defvar 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
376 "*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
377 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
378 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
379 where auto-fill occurs.
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
380
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
381 [This feature no longer depends in any way on the 'filladapt.el'
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
382 lisp-archive package.]")
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
383 (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
384
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
385 ;;;_ = outline-reindent-bodies
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
386 (defvar outline-reindent-bodies outline-use-hanging-indents
7416
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
387 "*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
388
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
389 Indented hanging bodies are adjusted to remain even with \(or
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
390 right-indented from\) the beginning of heading text.")
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
391 (make-variable-buffer-local 'outline-reindent-bodies)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
392
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
393 ;;;_ = outline-inhibit-protection
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
394 (defvar outline-inhibit-protection nil
7416
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
395 "*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
396
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
397 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
398 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
399 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
400
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
401 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
402 deactivate and then reactivate the mode if you want to toggle the
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
403 behavior.")
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
404
7416
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
405 ;;;_* CODE - no user customizations below.
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
406
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
407 ;;;_ #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
408 ;;;_ - Version
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
409 ;;;_ = outline-version
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
410 (defvar outline-version
7476
d1cbb5dd3434 (outline-init): Delete junk at end.
Richard M. Stallman <rms@gnu.org>
parents: 7416
diff changeset
411 (let ((rcs-rev "$Revision: 1.7 $"))
7416
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
412 (condition-case err
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
413 (save-match-data
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
414 (string-match "\\$Revision: \\([0-9]+\\.[0-9]+\\)" rcs-rev)
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
415 (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
416 (error rcs-rev)))
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
417 "Revision number of currently loaded outline package. (Currently
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
418 specific to allout.el.)")
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
419 ;;;_ > outline-version
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
420 (defun outline-version (&optional here)
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
421 "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
422 (interactive "P")
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
423 (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
424 (if here (insert-string msg))
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
425 (message "%s" msg)
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
426 msg))
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
427 ;;;_ - Topic header format
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
428 ;;;_ = outline-regexp
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
429 (defvar outline-regexp ""
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
430 "*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
431
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
432 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
433 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
434 by set-outline-regexp.")
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
435 (make-variable-buffer-local 'outline-regexp)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
436 ;;;_ = outline-bullets-string
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
437 (defvar outline-bullets-string ""
7416
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
438 "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
439
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
440 This var should *not* be set by the user - it is set by 'set-outline-regexp',
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
441 and is produced from the elements of 'outline-plain-bullets-string'
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
442 and 'outline-distinctive-bullets-string'.")
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
443 (make-variable-buffer-local 'outline-bullets-string)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
444 ;;;_ = outline-bullets-string-len
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
445 (defvar outline-bullets-string-len 0
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
446 "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
447 (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
448 ;;;_ = outline-line-boundary-regexp
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
449 (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
450 "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
451
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
452 (Ie, C-j, *or* C-m, for prefixes of hidden topics). This is properly
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
453 set when outline-regexp is produced by 'set-outline-regexp', so
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
454 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
455 (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
456 ;;;_ = outline-bob-regexp
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
457 (defvar outline-bob-regexp ()
7416
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
458 "Like outline-line-boundary-regexp, for headers at beginning of buffer.
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
459 (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
460 (make-variable-buffer-local 'outline-bob-regexp)
3430
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
461 ;;;_ = outline-header-subtraction
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
462 (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
463 "Outline-header prefix length to subtract when computing topic depth.")
3430
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
464 (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
465 ;;;_ = outline-plain-bullets-string-len
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
466 (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
467 "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
468 (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
469
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
470
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
471 ;;;_ > outline-reset-header-lead (header-lead)
3430
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
472 (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
473 "*Reset the leading string used to identify topic headers."
3430
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
474 (interactive "sNew lead string: ")
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
475 (setq outline-header-prefix header-lead)
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
476 (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
477 (set-outline-regexp))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
478 ;;;_ > outline-lead-with-comment-string (header-lead)
3430
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
479 (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
480 "*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
481
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
482 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
483 language comments. Returns the leading string."
3430
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
484
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
485 (interactive "P")
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
486 (if (not (stringp header-lead))
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
487 (setq header-lead (read-string
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
488 "String prefix for topic headers: ")))
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
489 (setq outline-reindent-bodies nil)
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
490 (outline-reset-header-lead header-lead)
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
491 header-lead)
7416
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
492 ;;;_ > outline-infer-header-lead (&optional reset)
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
493 (defun outline-infer-header-lead (&optional set)
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
494 "Determine appropriate `outline-header-prefix'.
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
495
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
496 Works according to settings of:
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
497
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
498 `outline-header-prefix' (default)
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
499 `outline-use-mode-specific-leader'
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
500 and `outline-mode-leaders'.
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
501
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
502 Optional arg SET means to do the processing to establish that prefix
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
503 for current outline processing, if it has changed from prior setting."
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
504 (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
505 (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
506 (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
507 '(outline-mode-leaders
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
508 comment-start
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
509 t)))
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
510 outline-use-mode-specific-leader
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
511 ;; 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
512 t)))
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
513 (leader
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
514 (cond
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
515 ((not use-leader) nil)
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
516 ;; Use the explicitly designated leader:
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
517 ((stringp use-leader) use-leader)
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
518 (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
519 ;; 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
520 (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
521 ;; ... 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
522 (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
523 comment-start
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
524 ;; Use comment-start, maybe tripled, and with
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
525 ;; underscore:
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
526 (concat
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
527 (if (string= " "
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
528 (substring comment-start
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
529 (1- (length comment-start))))
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
530 ;; 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
531 (substring comment-start 0 -1)
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
532 (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
533 ;; ... and append underscore, whichever:
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
534 "_")))))))
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
535 (if (not leader)
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
536 nil
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
537 (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
538 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
539 (setq outline-header-prefix leader)
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
540 (if set (outline-reset-header-lead outline-header-prefix))
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
541 outline-header-prefix))))
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
542 ;;;_ > set-outline-regexp ()
3430
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
543 (defun set-outline-regexp ()
7416
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
544 "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
545
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
546 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
547 `outline-distinctive-bullets-string'."
3430
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
548
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
549 (interactive)
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
550 ;; Derive outline-bullets-string from user configured components:
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
551 (setq outline-bullets-string "")
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
552 (let ((strings (list 'outline-plain-bullets-string
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
553 'outline-distinctive-bullets-string))
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
554 cur-string
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
555 cur-len
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
556 cur-char
3430
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
557 cur-char-string
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
558 index
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
559 new-string)
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
560 (while strings
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
561 (setq new-string "") (setq index 0)
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
562 (setq cur-len (length (setq cur-string (symbol-value (car strings)))))
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
563 (while (< index cur-len)
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
564 (setq cur-char (aref cur-string index))
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
565 (setq outline-bullets-string
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
566 (concat outline-bullets-string
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
567 (cond
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
568 ; Single dash would denote a
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
569 ; sequence, repeated denotes
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
570 ; a dash:
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
571 ((eq cur-char ?-) "--")
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
572 ; literal close-square-bracket
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
573 ; doesn't work right in the
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
574 ; expr, exclude it:
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
575 ((eq cur-char ?\]) "")
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
576 (t (regexp-quote (char-to-string cur-char))))))
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
577 (setq index (1+ index)))
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
578 (setq strings (cdr strings)))
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
579 )
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
580 ;; Derive next for repeated use in outline-pending-bullet:
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
581 (setq outline-plain-bullets-string-len (length outline-plain-bullets-string))
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
582 (setq outline-header-subtraction (1- (length outline-header-prefix)))
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
583 ;; Produce the new outline-regexp:
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
584 (setq outline-regexp (concat "\\(\\"
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
585 outline-header-prefix
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
586 "[ \t]*["
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
587 outline-bullets-string
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
588 "]\\)\\|\\"
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
589 outline-primary-bullet
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
590 "+\\|\^l"))
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
591 (setq outline-line-boundary-regexp
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
592 (concat "\\([\n\r]\\)\\(" outline-regexp "\\)"))
3430
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
593 (setq outline-bob-regexp
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
594 (concat "\\(\\`\\)\\(" outline-regexp "\\)"))
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
595 )
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
596 ;;;_ - Key bindings
7416
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
597 ;;;_ = outline-mode-map
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
598 (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
599 ;;;_ > 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
600 (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
601 "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
602
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
603 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
604 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
605 (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
606 (mapcar (lambda (cell)
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
607 (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
608 (cons (concat outline-command-prefix
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
609 (car cell))
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
610 (cdr cell))
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
611 (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
612 keymap-list)
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
613 map))
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
614 ;;;_ = outline-prior-bindings - being deprecated.
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
615 (defvar outline-prior-bindings nil
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
616 "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
617 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
618 activation. Being deprecated.")
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
619 ;;;_ = outline-added-bindings - being deprecated
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
620 (defvar outline-added-bindings nil
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
621 "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
622 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
623 activation. Being deprecated.")
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
624 ;;;_ - Mode-Specific Variable Maintenance Utilities
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
625 ;;;_ = outline-mode-prior-settings
3430
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
626 (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
627 "Internal outline mode use; settings to be resumed on mode deactivation.")
3430
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
628 (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
629 ;;;_ > outline-resumptions (name &optional value)
3430
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
630 (defun outline-resumptions (name &optional value)
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
631
7416
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
632 "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
633
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
634 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
635 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
636 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
637 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
638 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
639 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
640 from the list."
3430
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
641
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
642 (let ((on-list (assq name outline-mode-prior-settings))
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
643 prior-capsule ; By 'capsule' i mean a list
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
644 ; containing a value, so we can
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
645 ; distinguish nil from no value.
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
646 )
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
647
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
648 (if value
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
649
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
650 ;; Registering:
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
651 (progn
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
652 (if on-list
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
653 nil ; Already preserved prior value - don't mess with it.
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
654 ;; Register the old value, or nil if previously unbound:
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
655 (setq outline-mode-prior-settings
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
656 (cons (list name
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
657 (if (boundp name) (list (symbol-value name))))
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
658 outline-mode-prior-settings)))
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
659 ; And impose the new value, locally:
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
660 (progn (make-local-variable name)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
661 (set name (car value))))
3430
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
662
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
663 ;; Relinquishing:
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
664 (if (not on-list)
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
665
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
666 ;; Oops, not registered - leave it be:
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
667 nil
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
668
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
669 ;; Some registration:
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
670 ; reestablish it:
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
671 (setq prior-capsule (car (cdr on-list)))
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
672 (if prior-capsule
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
673 (set name (car prior-capsule)) ; Some prior value - reestablish it.
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
674 (makunbound name)) ; Previously unbound - demolish var.
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
675 ; Remove registration:
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
676 (let (rebuild)
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
677 (while outline-mode-prior-settings
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
678 (if (not (eq (car outline-mode-prior-settings)
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
679 on-list))
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
680 (setq rebuild
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
681 (cons (car outline-mode-prior-settings)
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
682 rebuild)))
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
683 (setq outline-mode-prior-settings
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
684 (cdr outline-mode-prior-settings)))
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
685 (setq outline-mode-prior-settings rebuild)))))
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
686 )
7416
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
687 ;;;_ - Mode-specific incidentals
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
688 ;;;_ = outline-during-write-cue nil
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
689 (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
690 "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
691
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
692 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
693 `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
694 functions.")
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
695 ;;;_ = outline-override-protect nil
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
696 (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
697 "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
698
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
699 Allout outline mode regulates alteration of concealed text to protect
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
700 against inadvertant, unnoticed changes. This is for use by specific,
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
701 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
702 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
703 (make-variable-buffer-local 'outline-override-protect)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
704 ;;;_ > outline-unprotected (expr)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
705 (defmacro outline-unprotected (expr)
7416
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
706 "Evaluate EXPRESSION with `outline-override-protect' let-bound 't'."
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
707 (` (let ((outline-override-protect t))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
708 (, expr))))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
709 ;;;_ = outline-undo-aggregation
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
710 (defvar outline-undo-aggregation 30
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
711 "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
712
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
713 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
714 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
715 (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
716 ;;;_ = file-var-bug hack
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
717 (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
718 "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
719 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
720 to track repeats.")
7416
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
721 ;;;_ > outline-write-file-hook ()
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
722 (defun outline-write-file-hook ()
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
723 "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
724
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
725 Currently just sets 'outline-during-write-cue', so outline-change-
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
726 protection knows to keep inactive during file write."
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
727 (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
728 nil)
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
729
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
730 ;;;_ #2 Mode activation
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
731 ;;;_ = outline-mode
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
732 (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
733 (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
734 ;;;_ > outline-mode-p ()
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
735 (defmacro outline-mode-p ()
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
736 "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
737 'outline-mode)
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
738 ;;;_ = outline-explicitly-deactivated
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
739 (defvar outline-explicitly-deactivated nil
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
740 "Outline-mode was last deliberately deactived.
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
741 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
742 (make-variable-buffer-local 'outline-explicitly-deactivated)
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
743 ;;;_ > outline-init (mode)
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
744 (defun outline-init (mode)
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
745 "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
746
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
747 MODE is one of:
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
748
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
749 - nil, for no auto-activation,
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
750 - `activation', for auto-activation only,
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
751 - `ask' for auto-activation and auto-layout on confirmation from user,
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
752 - anything else, for auto-activation and auto-layout, without any
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
753 confirmation check.
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
754
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
755 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
756 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
757 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
758 `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
759
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
760 `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
761 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
762 setting.
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
763
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
764 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
765 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
766
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
767 \(require 'allout)
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
768 \(outline-init t)"
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
769
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
770 (if (not mode)
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
771 (progn
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
772 (setq find-file-hooks (delq 'outline-find-file-hook find-file-hooks))
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
773 (if (interactive-p)
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
774 (message "Allout outline mode auto-activation inhibited.")))
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
775 (add-hook 'find-file-hooks 'outline-find-file-hook)
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
776 (setq outline-auto-activation
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
777 (cond ((eq mode 'activation)
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
778 (message "Allout outline mode auto-activation enabled.")
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
779 'activate)
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
780 ((eq mode 'ask)
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
781 (message "Allout outline mode auto-activation enabled.")
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
782 'ask)
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
783 ((message
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
784 "Allout outline mode auto-activation and -layout enabled.")
7476
d1cbb5dd3434 (outline-init): Delete junk at end.
Richard M. Stallman <rms@gnu.org>
parents: 7416
diff changeset
785 t)))))
7416
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
786 ;;;_ > outline-mode (&optional toggle)
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
787 ;;;_ : Defun:
3430
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
788 (defun outline-mode (&optional toggle)
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
789 ;;;_ . Doc string:
7416
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
790 "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
791
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
792 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
793
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
794 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
795 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
796 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
797 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
798 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
799
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
800 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
801 paste; integral outline exposure-layout; incremental search with
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
802 dynamic exposure/conceament of concealed text; automatic topic-number
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
803 maintenance; and many other features.
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
804
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
805 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
806 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
807 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
808
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
809 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
810 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
811
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
812 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
813 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
814 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
815 the mode is revoked.
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
816
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
817 Navigation: Exposure Control:
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
818 ---------- ----------------
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
819 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
820 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
821 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
822 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
823 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
824 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
825 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
826
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
827 Topic Header Production:
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 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
830 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
831 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
832
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
833 Topic Level and Prefix Adjustment:
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
834 ---------------------------------
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
835 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
836 C-c < outline-shift-out ... less deep.
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
837 C-c<CR> outline-rebullet-topic Reconcile bullets of topic and its' offspring
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
838 - 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
839 alternated according to nesting depth.
3430
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
840 C-c b outline-rebullet-current-heading Prompt for alternate bullet for
7416
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
841 current topic.
3430
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
842 C-c # outline-number-siblings Number bullets of topic and siblings - the
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
843 offspring are not affected. With repeat
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
844 count, revoke numbering.
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
845
7416
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
846 Topic-oriented Killing and Yanking:
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
847 ----------------------------------
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
848 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
849 C-k outline-kill-line Like kill-line, but reconciles numbering, etc.
3430
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
850 C-y outline-yank Yank, adjusting depth of yanked topic to
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
851 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
852 heading (ie, prefix sans text).
3430
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
853 M-y outline-yank-pop Is to outline-yank as yank-pop is to yank
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
854
7416
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
855 Misc commands:
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
856 -------------
3430
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
857 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
858 outline-file-xref-bullet)
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
859 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
860 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
861 current buffer - \"XXX exposed\"
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
862 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
863 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
864 for `outline-layout'.
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
865 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
866 auto-activation.
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
867
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
868 HOT-SPOT Operation
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
869
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
870 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
871 navigation and exposure control.
3430
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
872
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
873 \\<outline-mode-map>
7416
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
874 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
875 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
876 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
877 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
878 \(\\[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
879
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
880 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
881 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
882 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
883 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
884 operation.
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
885
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
886 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
887 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
888 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
889 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
890
7416
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
891 Terminology
3430
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
892
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
893 Topic hierarchy constituents - TOPICS and SUBTOPICS:
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
894
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
895 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
896 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
897 CURRENT topic:
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
898 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
899 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
900 containment. Also called the:
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
901 LEVEL: The same as DEPTH.
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
902
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
903 ANCESTORS:
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
904 The topics that contain a topic.
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
905 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
906 the topic.
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
907 OFFSPRING:
7416
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
908 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
909 SUBTOPIC:
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
910 An immediate offspring of a topic;
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
911 CHILDREN:
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
912 The immediate offspring of a topic.
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
913 SIBLINGS:
7416
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
914 Topics having the same parent and depth.
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
915
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
916 Topic text constituents:
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
917
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
918 HEADER: The first line of a topic, include the topic PREFIX and header
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
919 text.
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
920 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
921 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
922 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
923 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
924 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
925
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
926 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
927 of the topic.
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
928 PREFIX-LEAD:
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
929 The string at the beginning of a topic prefix, normally a '.'.
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
930 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
931 `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
932
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
933 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
934 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
935 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
936 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
937 docstring for more detail.
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
938 PREFIX-PADDING:
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
939 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
940 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
941 BULLET: A character at the end of the topic prefix, it must be one of
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
942 the characters listed on 'outline-plain-bullets-string' or
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
943 'outline-distinctive-bullets-string'. (See the documentation
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
944 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
945 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
946 topic.
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
947 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
948 BODY: Same as ENTRY.
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
949
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
950
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
951 EXPOSURE:
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
952 The state of a topic which determines the on-screen visibility
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
953 of its' offspring and contained text.
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
954 CONCEALED:
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
955 Topics and entry text whose display is inhibited. Contiguous
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
956 units of concealed text is represented by '...' ellipses.
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
957 (Ref the 'selective-display' var.)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
958
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
959 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
960 CLOSED: A topic whose immediate offspring and body-text is concealed.
7416
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
961 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
962 ;;;_ . Code
3430
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
963 (interactive "P")
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
964
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
965 (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
966 (outline-mode-p)))
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
967 ; Massage universal-arg 'toggle' val:
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
968 (toggle (and toggle
7416
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
969 (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
970 toggle)))
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
971 ; Activation specficially demanded?
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
972 (explicit-activation (or
7416
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
973 ;;
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
974 (and toggle
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
975 (or (symbolp toggle)
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
976 (and (natnump toggle)
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
977 (not (zerop toggle)))))))
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
978 ;; 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
979 (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
980 (car command-history)))
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
981 do-layout
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
982 )
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
983
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
984 ; 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
985 (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
986
3430
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
987 (cond
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
988
7416
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
989 ;; 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
990 ;; 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
991 ;; 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
992 ;; 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
993 ;; skip everything.
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
994 ((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
995 ; 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
996 active ; Already activated.
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
997 (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
998 (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
999 emacs-version)); 19.19.
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1000 t)
7416
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1001
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1002 ;; Deactivation:
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1003 ((and (not explicit-activation)
7416
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1004 (or active toggle))
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1005 ; Activation not explicitly
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1006 ; requested, and either in
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1007 ; active state or *de*activation
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1008 ; specifically requested:
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1009 (setq outline-explicitly-deactivated t)
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1010 (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
1011 ; Revoke those keys that remain
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1012 ; as we set them:
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1013 (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
1014 (mapcar '(lambda (cell)
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1015 (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
1016 (car (cdr cell)))
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1017 (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
1018 (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
1019 outline-added-bindings)
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1020 (outline-resumptions 'outline-added-bindings)
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1021 (outline-resumptions 'outline-prior-bindings)))
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1022
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1023 (if outline-old-style-prefixes
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1024 (progn
7416
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1025 (outline-resumptions 'outline-primary-bullet)
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1026 (outline-resumptions 'outline-old-style-prefixes)))
3430
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1027 (outline-resumptions 'selective-display)
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1028 (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
1029 (outline-resumptions 'before-change-function))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1030 (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
1031 pre-command-hook))
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1032 (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
1033 (delq 'outline-write-file-hook
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1034 local-write-file-hooks))
3430
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1035 (outline-resumptions 'paragraph-start)
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1036 (outline-resumptions 'paragraph-separate)
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1037 (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
1038 'auto-fill-hook
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1039 'auto-fill-function))
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1040 (outline-resumptions 'outline-former-auto-filler)
3430
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1041 (setq outline-mode nil))
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1042
7416
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1043 ;; Activation:
3430
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1044 ((not active)
7416
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1045 (setq outline-explicitly-deactivated nil)
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1046 (if outline-old-style-prefixes
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1047 (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
1048 (outline-resumptions 'outline-primary-bullet '("*"))
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1049 (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
1050
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1051 (outline-infer-header-lead)
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1052
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1053 (set-outline-regexp)
7416
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1054
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1055 ; Produce map from current version
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1056 ; of outline-keybindings-list:
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1057 (if (boundp 'minor-mode-map-alist)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1058
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1059 (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
1060 ; epoch, minor-mode key bindings:
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1061 (setq outline-mode-map
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1062 (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
1063 (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
1064 ; 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
1065 ; if not already there:
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1066 (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
1067 minor-mode-map-alist))
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1068 (setq minor-mode-map-alist
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1069 (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
1070 minor-mode-map-alist))))
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1071
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1072 ; V18 minor-mode key bindings:
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1073 ; Stash record of added bindings
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1074 ; for later revocation:
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1075 (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
1076 (list outline-keybindings-list))
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1077 (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
1078 (list (current-local-map)))
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1079 ; and add them:
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1080 (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
1081 (current-local-map)))
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1082 )
7416
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1083
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1084 ; selective-display is the
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1085 ; emacs conditional exposure
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1086 ; mechanism:
3430
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1087 (outline-resumptions 'selective-display '(t))
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1088 (if outline-inhibit-protection
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1089 t
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1090 (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
1091 '(outline-before-change-protect)))
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1092 ; Temporarily set by any outline
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1093 ; 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
1094 ; deal properly with concealed text.
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1095 (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
1096 ; 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
1097 ; respect for topic headline,
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1098 ; hanging-indents, etc:
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1099 (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
1100 'auto-fill-hook
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1101 'auto-fill-function))
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1102 (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
1103 ;; 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
1104 (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
1105 ;; 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
1106 (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
1107 ;; Paragraphs are broken by topic headlines.
3430
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1108 (make-local-variable 'paragraph-start)
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1109 (outline-resumptions 'paragraph-start
7416
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1110 (list (concat paragraph-start "\\|^\\("
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1111 outline-regexp "\\)")))
3430
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1112 (make-local-variable 'paragraph-separate)
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1113 (outline-resumptions 'paragraph-separate
7416
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1114 (list (concat paragraph-separate "\\|^\\("
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1115 outline-regexp "\\)")))
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1116
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1117 (or (assq 'outline-mode minor-mode-alist)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1118 (setq minor-mode-alist
7416
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1119 (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
1120
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1121 (if outline-layout
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1122 (setq do-layout t))
3430
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1123
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1124 (if outline-enwrap-isearch-mode
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1125 (outline-enwrap-isearch))
7416
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1126
3430
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1127 (run-hooks 'outline-mode-hook)
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1128 (setq outline-mode t))
7416
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1129
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1130 ;; Reactivation:
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1131 ((setq do-layout t))
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1132 ) ; cond
7416
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1133
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1134 (if (and do-layout
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1135 outline-auto-activation
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1136 (listp outline-layout)
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1137 (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
1138 (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
1139 (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
1140 (buffer-name)
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1141 outline-layout))
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1142 t
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1143 (message "Not doing %s layout.")
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1144 nil)
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1145 t)))
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1146 (save-excursion
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1147 (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
1148 (goto-char 0)
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1149 (if (not (outline-goto-prefix))
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1150 (outline-next-heading))
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1151 (apply 'outline-expose-topic (list outline-layout))
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1152 (message "Adjusting '%s' exposure... done." (buffer-name))))
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1153 outline-mode
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1154 ) ; let*
7416
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1155 ) ; defun
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1156
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1157 ;;;_ #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
1158 ;;; All the basic outline functions that directly do string matches to
3430
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1159 ;;; 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
1160 ;;; `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
1161 ;;; 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
1162 ;;; 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
1163 ;;; 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
1164 ;;; 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
1165 ;;;_ = outline-recent-prefix-beginning
3430
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1166 (defvar outline-recent-prefix-beginning 0
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1167 "Buffer point of the start of the last topic prefix encountered.")
3430
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1168 (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
1169 ;;;_ = outline-recent-prefix-end
3430
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1170 (defvar outline-recent-prefix-end 0
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1171 "Buffer point of the end of the last topic prefix encountered.")
3430
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1172 (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
1173 ;;;_ = outline-recent-end-of-subtree
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1174 (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
1175 "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
1176 (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
1177 ;;;_ > outline-prefix-data (beg end)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1178 (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
1179 "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
1180
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1181 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
1182 (` (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
1183 outline-recent-prefix-beginning (, beg))))
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1184 ;;;_ > outline-recent-depth ()
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1185 (defmacro outline-recent-depth ()
7416
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1186 "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
1187
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1188 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
1189 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
1190 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
1191 to return the current depth."
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1192
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1193 '(max 1 (- outline-recent-prefix-end
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1194 outline-recent-prefix-beginning
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1195 outline-header-subtraction)))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1196 ;;;_ > outline-recent-prefix ()
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1197 (defmacro outline-recent-prefix ()
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1198 "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
1199
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1200 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
1201 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
1202 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
1203 to return the current depth."
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1204 '(buffer-substring outline-recent-prefix-beginning
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1205 outline-recent-prefix-end))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1206 ;;;_ > outline-recent-bullet ()
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1207 (defmacro outline-recent-bullet ()
7416
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1208 "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
1209
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1210 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
1211 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
1212 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
1213 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
1214 '(buffer-substring (1- outline-recent-prefix-end)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1215 outline-recent-prefix-end))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1216
7416
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1217 ;;;_ #4 Navigation
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1219 ;;;_ - Position Assessment
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1220 ;;;_ : Location Predicates
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1221 ;;;_ > outline-on-current-heading-p ()
3430
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1222 (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
1223 "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
1224
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1225 Actually, returns prefix beginning point."
3430
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1226 (save-excursion
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1227 (beginning-of-line)
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1228 (and (looking-at outline-regexp)
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1229 (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
1230 ;;;_ > outline-e-o-prefix-p ()
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1231 (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
1232 "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
1233 (and (save-excursion (beginning-of-line)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1234 (looking-at outline-regexp))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1235 (= (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
1236 ;;;_ > outline-hidden-p ()
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1237 (defmacro outline-hidden-p ()
3430
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1238 "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
1239 '(save-excursion
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1240 (and (re-search-backward "[\n\r]" () t)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1241 (= ?\r (following-char)))))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1242 ;;;_ > outline-visible-p ()
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1243 (defmacro outline-visible-p ()
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1244 "True if point is not in hidden text."
3430
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1245 (interactive)
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1246 '(not (outline-hidden-p)))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1247 ;;;_ : Location attributes
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1248 ;;;_ > outline-depth ()
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1249 (defmacro outline-depth ()
7416
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1250 "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
1251 '(save-excursion
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1252 (if (outline-goto-prefix)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1253 (outline-recent-depth)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1254 (progn
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1255 ;; Oops, no prefix, zero prefix data:
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1256 (outline-prefix-data (point)(point))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1257 ;; ... and return 0:
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1258 0))))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1259 ;;;_ > outline-current-depth ()
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1260 (defmacro outline-current-depth ()
7416
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1261 "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
1262 '(save-excursion
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1263 (if (outline-back-to-current-heading)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1264 (max 1
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1265 (- outline-recent-prefix-end
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1266 outline-recent-prefix-beginning
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1267 outline-header-subtraction))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1268 0)))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1269 ;;;_ > outline-get-current-prefix ()
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1270 (defun outline-get-current-prefix ()
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1271 "Topic prefix of the current topic."
3430
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1272 (save-excursion
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1273 (if (outline-goto-prefix)
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1274 (outline-recent-prefix))))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1275 ;;;_ > outline-get-bullet ()
3430
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1276 (defun outline-get-bullet ()
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1277 "Return bullet of containing topic (visible or not)."
3430
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1278 (save-excursion
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1279 (and (outline-goto-prefix)
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1280 (outline-recent-bullet))))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1281 ;;;_ > outline-current-bullet ()
3430
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1282 (defun outline-current-bullet ()
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1283 "Return bullet of current (visible) topic heading, or none if none found."
3430
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1284 (condition-case err
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1285 (save-excursion
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1286 (outline-back-to-current-heading)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1287 (buffer-substring (- outline-recent-prefix-end 1)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1288 outline-recent-prefix-end))
3430
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1289 ;; Quick and dirty provision, ostensibly for missing bullet:
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1290 (args-out-of-range nil))
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1291 )
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1292 ;;;_ > outline-get-prefix-bullet (prefix)
3430
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1293 (defun outline-get-prefix-bullet (prefix)
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1294 "Return the bullet of the header prefix string PREFIX."
3430
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1295 ;; Doesn't make sense if we're old-style prefixes, but this just
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1296 ;; oughtn't be called then, so forget about it...
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1297 (if (string-match outline-regexp prefix)
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1298 (substring prefix (1- (match-end 0)) (match-end 0))))
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1299
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1300 ;;;_ - Navigation macros
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1301 ;;;_ > outline-next-heading ()
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1302 (defmacro outline-next-heading ()
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1303 "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
1304
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1305 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
1306
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1307 '(if (and (bobp) (not (eobp)))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1308 (forward-char 1))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1309
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1310 '(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
1311 (progn ; Got valid location state - set vars:
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1312 (outline-prefix-data
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1313 (goto-char (or (match-beginning 2)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1314 outline-recent-prefix-beginning))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1315 (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
1316 ;;;_ > outline-previous-heading ()
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1317 (defmacro outline-previous-heading ()
7416
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1318 "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
1319
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1320 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
1321
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1322 '(if (bobp)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1323 nil
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1324 (outline-goto-prefix)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1325 (if
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1326 ;; 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
1327 (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
1328 (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
1329 (progn ; Got valid location state - set vars:
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1330 (outline-prefix-data
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1331 (goto-char (or (match-beginning 2)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1332 outline-recent-prefix-beginning))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1333 (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
1334
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1335 ;;;_ - Subtree Charting
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1336 ;;;_ " 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
1337 ;;; 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
1338 ;;;
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1339 ;;; 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
1340 ;;; 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
1341 ;;; 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
1342 ;;; 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
1343 ;;; required, without requiring redundant topic-traversal procedures.
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1344
7416
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1345 ;;;_ > 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
1346 (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
1347 "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
1348
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1349 Optional argument LEVELS specifies the depth \(releative to start
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1350 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
1351 use.
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1352
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1353 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
1354 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
1355 for their elaborate manipulations.
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1356
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1357 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
1358 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
1359 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
1360 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
1361 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
1362 itself.
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1363
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1364 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
1365 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
1366 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
1367
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1368 (let ((original (not orig-depth)) ; 'orig-depth' set only in recursion.
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1369 chart curr-depth)
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1370
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1371 (if original ; Just starting?
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1372 ; Register initial settings and
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1373 ; position to first offspring:
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1374 (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
1375 (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
1376 (outline-next-heading)))
7416
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1377
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1378 ;; 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
1379 ;; 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
1380 ;; 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
1381 ;; 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
1382 ;; 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
1383 (while (and (not (eobp))
7416
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1384 ; Still within original topic?
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1385 (< 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
1386 (cond ((= prev-depth curr-depth)
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1387 ;; 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
1388 (setq chart (cons (point) chart))
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1389 (if (and levels (<= levels 1))
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1390 ;; At depth limit - skip sublevels:
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1391 (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
1392 ;; 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
1393 ;; next heading at lesser depth:
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1394 (while (<= curr-depth
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1395 (outline-recent-depth))
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1396 (outline-next-heading)))
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1397 (outline-next-heading)))
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1398
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1399 ((and (< prev-depth curr-depth)
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1400 (or (not levels)
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1401 (> levels 0)))
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1402 ;; 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
1403 (setq chart
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1404 (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
1405 (1- levels))
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1406 orig-depth
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1407 curr-depth)
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1408 chart))
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1409 ;; ... then continue with this one.
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1410 )
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1411
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1412 ;; ... 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
1413
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1414 )))
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1415
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1416 (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
1417 ; the original level. Position
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1418 ; to the end of it:
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1419 (progn (and (not (eobp)) (forward-char -1))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1420 (and (memq (preceding-char) '(?\n ?\^M))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1421 (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
1422 (point))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1423 1)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1424 '(?\n ?\^M))
7416
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1425 (forward-char -1))
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1426 (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
1427
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1428 chart ; (nreverse chart) not necessary,
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1429 ; and maybe not preferable.
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1430 ))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1431 ;;;_ > outline-chart-siblings (&optional start end)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1432 (defun outline-chart-siblings (&optional start end)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1433 "Produce a list of locations of this and succeeding sibling topics.
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1434 Effectively a top-level chart of siblings. See 'outline-chart-subtree'
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1435 for an explanation of charts."
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1436 (save-excursion
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1437 (if (outline-goto-prefix)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1438 (let ((chart (list (point))))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1439 (while (outline-next-sibling)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1440 (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
1441 (if chart (setq chart (nreverse chart)))))))
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1442 ;;;_ > outline-chart-to-reveal (chart depth)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1443 (defun outline-chart-to-reveal (chart depth)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1444
7416
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1445 "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
1446
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1447 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
1448 start point."
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1449
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1450 (let (result here)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1451 (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
1452 chart)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1453 (setq here (car chart))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1454 (if (listp here)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1455 (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
1456 (1- depth)))))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1457 ;; 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
1458 ;; more depth to go:
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1459 (if further (setq result (append further result)))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1460 (setq chart (cdr chart)))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1461 (goto-char here)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1462 (if (= (preceding-char) ?\r)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1463 (setq result (cons here result)))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1464 (setq chart (cdr chart))))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1465 result))
7416
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1466 ;;;_ 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
1467 (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
1468 "Not yet \(if ever\) implemented.
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1469
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1470 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
1471
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1472 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
1473 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
1474 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
1475 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
1476 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
1477 bodies should be exposed.
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1478
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1479 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
1480 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
1481 exposed reside.
7416
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1482
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1483 - 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
1484 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
1485 including their entries.
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1486 - bare positive values indicate that this topic header should be
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1487 openned.
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1488 - Lists signify the beginning and end points of regions that should
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1489 be flagged, and the flag to employ. (For concealment: '\(\?r\)', and
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1490 exposure:"
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1491 (while spec
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1492 (cond ((listp spec)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1493 )
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1494 )
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1495 (setq spec (cdr spec)))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1496 )
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1497
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1498 ;;;_ - Within Topic
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1499 ;;;_ > outline-goto-prefix ()
3430
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1500 (defun outline-goto-prefix ()
7416
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1501 "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
1502
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1503 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
1504
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1505 Not sensitive to topic visibility.
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1506
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1507 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
1508
7416
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1509 (let (done)
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1510 (while (and (not done)
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1511 (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
1512 (forward-char 1)
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1513 (if (looking-at outline-regexp)
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1514 (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
1515 (match-end 0)))
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1516 (forward-char -1)))
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1517 (if (bobp)
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1518 (cond ((looking-at outline-regexp)
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1519 (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
1520 ((outline-next-heading)
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1521 (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
1522 (done))
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1523 done)))
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1524 ;;;_ > outline-end-of-prefix ()
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1525 (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
1526 "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
1527
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1528 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
1529 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
1530
3430
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1531 (if (not (outline-goto-prefix))
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1532 nil
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1533 (let ((match-data (match-data)))
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1534 (goto-char (match-end 0))
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1535 (if ignore-decorations
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1536 t
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1537 (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
1538 (if (and (not (eolp)) (looking-at "\\s-")) (forward-char 1)))
3430
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1539 (store-match-data match-data))
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1540 ;; Reestablish where we are:
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1541 (outline-current-depth)))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1542 ;;;_ > outline-current-bullet-pos ()
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1543 (defun outline-current-bullet-pos ()
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1544 "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
1545
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1546 (if (not (outline-current-depth))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1547 nil
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1548 (1- (match-end 0))))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1549 ;;;_ > outline-back-to-current-heading ()
3430
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1550 (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
1551 "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
1552
3430
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1553 (beginning-of-line)
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1554 (prog1 (or (outline-on-current-heading-p)
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1555 (and (re-search-backward (concat "^\\(" outline-regexp "\\)")
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1556 nil
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1557 'move)
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1558 (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
1559 (if (interactive-p) (outline-end-of-prefix))))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1560 ;;;_ > outline-pre-next-preface ()
3430
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1561 (defun outline-pre-next-preface ()
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1562 "Skip forward to just before the next heading line.
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1563
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1564 Returns that character position."
3430
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1565
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1566 (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
1567 (prog1 (goto-char (match-beginning 0))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1568 (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
1569 ;;;_ > outline-end-of-current-subtree ()
3430
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1570 (defun outline-end-of-current-subtree ()
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1571 "Put point at the end of the last leaf in the currently visible topic."
3430
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1572 (interactive)
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1573 (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
1574 (let ((level (outline-recent-depth)))
3430
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1575 (outline-next-heading)
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1576 (while (and (not (eobp))
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1577 (> (outline-recent-depth) level))
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1578 (outline-next-heading))
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1579 (and (not (eobp)) (forward-char -1))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1580 (and (memq (preceding-char) '(?\n ?\^M))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1581 (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
1582 '(?\n ?\^M))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1583 (forward-char -1))
7416
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1584 (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
1585 ;;;_ > outline-beginning-of-current-entry ()
3430
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1586 (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
1587 "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
1588
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1589 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
1590 \(See outline-mode doc string for details on hot-spot operation.)"
3430
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1591 (interactive)
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1592 (let ((start-point (point)))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1593 (outline-end-of-prefix)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1594 (if (and (interactive-p)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1595 (= (point) start-point))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1596 (goto-char (outline-current-bullet-pos)))))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1597 ;;;_ > outline-end-of-current-entry ()
3430
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1598 (defun outline-end-of-current-entry ()
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1599 "Position the point at the end of the current topics' entry."
3430
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1600 (interactive)
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1601 (outline-show-entry)
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1602 (prog1 (outline-pre-next-preface)
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1603 (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
1604 (forward-char -1))))
3430
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1605
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1606 ;;;_ - Depth-wise
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1607 ;;;_ > outline-ascend-to-depth (depth)
3430
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1608 (defun outline-ascend-to-depth (depth)
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1609 "Ascend to depth DEPTH, returning depth if successful, nil if not."
3430
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1610 (if (and (> depth 0)(<= depth (outline-depth)))
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1611 (let ((last-good (point)))
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1612 (while (and (< depth (outline-depth))
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1613 (setq last-good (point))
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1614 (outline-beginning-of-level)
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1615 (outline-previous-heading)))
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1616 (if (= (outline-recent-depth) depth)
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1617 (progn (goto-char outline-recent-prefix-beginning)
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1618 depth)
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1619 (goto-char last-good)
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1620 nil))
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1621 (if (interactive-p) (outline-end-of-prefix))))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1622 ;;;_ > outline-descend-to-depth (depth)
3430
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1623 (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
1624 "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
1625
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1626 Returning depth if successful, nil if not."
3430
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1627 (let ((start-point (point))
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1628 (start-depth (outline-depth)))
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1629 (while
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1630 (and (> (outline-depth) 0)
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1631 (not (= depth (outline-recent-depth))) ; ... not there yet
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1632 (outline-next-heading) ; ... go further
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1633 (< start-depth (outline-recent-depth)))) ; ... still in topic
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1634 (if (and (> (outline-depth) 0)
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1635 (= (outline-recent-depth) depth))
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1636 depth
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1637 (goto-char start-point)
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1638 nil))
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1639 )
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1640 ;;;_ > outline-up-current-level (arg &optional dont-complain)
3430
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1641 (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
1642 "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
1643
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1644 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
1645 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
1646 DONT-COMPLAIN is non-nil."
3430
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1647 (interactive "p")
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1648 (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
1649 (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
1650 (last-good (point))
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1651 failed
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1652 return)
3430
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1653 ;; Loop for iterating arg:
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1654 (while (and (> (outline-recent-depth) 1)
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1655 (> arg 0)
7416
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1656 (not (bobp))
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1657 (not failed))
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1658 (setq last-good (point))
3430
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1659 ;; Loop for going back over current or greater depth:
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1660 (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
1661 (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
1662 (not (setq failed present-level)))))
3430
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1663 (setq present-level (outline-current-depth))
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1664 (setq arg (- arg 1)))
7416
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1665 (if (or failed
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1666 (> arg 0))
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1667 (progn (goto-char last-good)
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1668 (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
1669 (if (not dont-complain)
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1670 (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
1671 (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
1672 nil))
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1673 (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
1674 outline-recent-prefix-beginning)))
3430
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1675
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1676 ;;;_ - Linear
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1677 ;;;_ > outline-next-sibling (&optional depth backward)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1678 (defun outline-next-sibling (&optional depth backward)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1679 "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
1680
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1681 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
1682
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1683 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
1684
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1685 Return depth if successful, nil otherwise."
3430
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1686
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1687 (if (and backward (bobp))
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1688 nil
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1689 (let ((start-depth (or depth (outline-depth)))
3430
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1690 (start-point (point))
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1691 last-depth)
3430
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1692 (while (and (not (if backward (bobp) (eobp)))
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1693 (if backward (outline-previous-heading)
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1694 (outline-next-heading))
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1695 (> (setq last-depth (outline-recent-depth)) start-depth)))
3430
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1696 (if (and (not (eobp))
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1697 (and (> (or last-depth (outline-depth)) 0)
3430
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1698 (= (outline-recent-depth) start-depth)))
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1699 outline-recent-prefix-beginning
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1700 (goto-char start-point)
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1701 (if depth (outline-depth) start-depth)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1702 nil))))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1703 ;;;_ > outline-previous-sibling (&optional depth backward)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1704 (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
1705 "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
1706
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1707 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
1708
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1709 Optional BACKWARD reverses direction.
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1710
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1711 Return depth if successful, nil otherwise."
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1712 (outline-next-sibling depth (not backward))
3430
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1713 )
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1714 ;;;_ > outline-snug-back ()
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1715 (defun outline-snug-back ()
7416
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1716 "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
1717
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1718 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
1719 (if (or (bobp) (eobp))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1720 nil
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1721 (forward-char -1))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1722 (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
1723 nil
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1724 (forward-char -1)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1725 (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
1726 (forward-char -1)))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1727 (point))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1728 ;;;_ > outline-beginning-of-level ()
3430
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1729 (defun outline-beginning-of-level ()
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1730 "Go back to the first sibling at this level, visible or not."
3430
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1731 (outline-end-of-level 'backward))
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1732 ;;;_ > outline-end-of-level (&optional backward)
3430
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1733 (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
1734 "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
1735
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1736 (let ((depth (outline-depth)))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1737 (while (outline-previous-sibling depth nil))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1738 (prog1 (outline-recent-depth)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1739 (if (interactive-p) (outline-end-of-prefix)))))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1740 ;;;_ > outline-next-visible-heading (arg)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1741 (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
1742 "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
1743
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1744 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
1745 buffer\) if headings are exhausted."
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1746
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1747 (interactive "p")
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1748 (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
1749 (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
1750 (start-point (point))
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1751 prev got)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1752
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1753 (while (> arg 0) ; limit condition
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1754 (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
1755 ;; 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
1756 (< -1 (forward-line step))
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1757 (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
1758 ;; 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
1759 (if got (setq prev got))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1760 (setq arg (1- arg)))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1761 (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
1762 (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
1763 (outline-end-of-prefix))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1764 (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
1765 (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
1766 ((not backward) (end-of-line) nil))))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1767 ;;;_ > outline-previous-visible-heading (arg)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1768 (defun outline-previous-visible-heading (arg)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1769 "Move to the previous heading line.
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1770
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1771 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
1772 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
1773 matches)."
3430
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1774 (interactive "p")
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1775 (outline-next-visible-heading (- arg)))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1776 ;;;_ > outline-forward-current-level (arg)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1777 (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
1778 "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
1779
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1780 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
1781
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1782 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
1783 (interactive "p")
7416
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1784 (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
1785 (start-point (point))
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1786 (start-arg arg)
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1787 (backward (> 0 arg))
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1788 last-depth
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1789 (last-good (point))
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1790 at-boundary)
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1791 (if (= 0 start-depth)
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1792 (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
1793 (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
1794 (while (not (or (zerop arg)
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1795 at-boundary))
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1796 (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
1797 (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
1798 (outline-next-visible-heading 1))
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1799 (> (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
1800 (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
1801 (not (if backward (bobp) (eobp))))
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1802 (setq last-good (point)
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1803 arg (1- arg))
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1804 (setq at-boundary t)))
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1805 (if (and (not (eobp))
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1806 (= arg 0)
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1807 (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
1808 (= (outline-recent-depth) start-depth)))
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1809 outline-recent-prefix-beginning
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1810 (goto-char last-good)
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1811 (if (not (interactive-p))
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1812 nil
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1813 (outline-end-of-prefix)
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1814 (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
1815 (if backward "first" "last")
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1816 (outline-recent-depth)
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1817 (- (abs start-arg) arg)
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1818 (abs start-arg))))))
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1819 ;;;_ > outline-backward-current-level (arg)
3430
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1820 (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
1821 "Inverse of `outline-forward-current-level'."
3430
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1822 (interactive "p")
7416
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1823 (if (interactive-p)
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1824 (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
1825 (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
1826 (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
1827
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1828 ;;;_ #5 Alteration
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1829
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1830 ;;;_ - Fundamental
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1831 ;;;_ > outline-before-change-protect (beg end)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1832 (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
1833 "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
1834
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1835 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
1836 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
1837 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
1838
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1839 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
1840 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
1841 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
1842 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
1843
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1844 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
1845 \(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
1846 writes, like crypt and zip modes.)
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 Locally bound in outline buffers to 'before-change-function', which
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1849 in emacs 19 is run before any change to the buffer. (Has no effect
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1850 in Emacs 18, which doesn't support before-change-function.)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1851
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1852 Any functions which set ['this-command' to 'undo', or which set]
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1853 'outline-override-protect' non-nil (as does, eg, outline-flag-chars)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1854 are exempt from this restriction."
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1855 (if (and (outline-mode-p)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1856 ; outline-override-protect
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1857 ; set by functions that know what
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1858 ; they're doing, eg outline internals:
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1859 (not outline-override-protect)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1860 (not outline-during-write-cue)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1861 (save-match-data ; Preserve operation position state.
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1862 ; Both beginning and end chars must
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1863 ; be exposed:
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1864 (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
1865 ;; Compensate for stupid emacs {new,
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1866 ;; open-}line display optimization:
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1867 (setq beg (1+ beg)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1868 end (1+ end)))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1869 (goto-char beg)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1870 (or (outline-hidden-p)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1871 (and (not (= beg end))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1872 (goto-char end)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1873 (outline-hidden-p))))))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1874 (save-match-data
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1875 (if (equal this-command 'undo)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1876 ;; Allow undo without inhibition.
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1877 ;; - 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
1878 ;; optimization (em 19 cmds.c, ~ line 200).
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1879 ;; - Presumably, undoing what was properly protected when
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1880 ;; done.
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1881 ;; - 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
1882 ;; So, expose what getting changed:
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1883 (progn (message "Undo! - exposing concealed target...")
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1884 (if (outline-hidden-p)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1885 (outline-show-children))
7416
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1886 (message "Undo!"))
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1887 (let (response
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1888 (rehide-completely (save-excursion (outline-goto-prefix)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1889 (outline-hidden-p)))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1890 rehide-place)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1891
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1892 (save-excursion
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1893 (if (condition-case err
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1894 ;; 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
1895 (progn
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1896 ; Give them a peek where
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1897 (save-excursion
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1898 (if (eolp) (setq rehide-place
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1899 (outline-goto-prefix)))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1900 (outline-show-entry))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1901 ; Present the message, but...
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1902 ; leave the cursor at the location
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1903 ; until they respond:
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1904 ; Then interpret the response:
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1905 (while
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1906 (progn
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1907 (message (concat "Change inside concealed"
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1908 " region - do it? "
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1909 "(n or 'y'/'r'eclose)"))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1910 (setq response (read-char))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1911 (not
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1912 (cond ((memq response '(?r ?R))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1913 (setq response 'reclose))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1914 ((memq response '(?y ?Y ? ))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1915 (setq response t))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1916 ((memq response '(?n ?N 127))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1917 (setq response nil)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1918 t)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1919 ((eq response ??)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1920 (message
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1921 "'r' means 'yes, then reclose")
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1922 nil)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1923 (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
1924 (sit-for 1)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1925 nil)))))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1926 response)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1927 (quit nil))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1928 ; Continue:
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1929 (if (eq response 'reclose)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1930 (save-excursion
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1931 (if rehide-place (goto-char rehide-place))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1932 (if rehide-completely
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1933 (outline-hide-current-entry-completely)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1934 (outline-hide-current-entry)))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1935 (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
1936 (outline-show-children)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1937 (outline-show-to-offshoot)))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1938 ; Prevent:
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1939 (if rehide-completely
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1940 (save-excursion
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1941 (if rehide-place (goto-char rehide-place))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1942 (outline-hide-current-entry-completely))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1943 (outline-hide-current-entry))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1944 (error (concat
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1945 "Change within concealed region prevented.")))))))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1946 ) ; if
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1947 ) ; defun
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1948 ;;;_ = outline-post-goto-bullet
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1949 (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
1950 "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
1951
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1952 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
1953 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
1954 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
1955 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
1956 outline-mode-map.")
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1957 (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
1958 ;;;_ > outline-post-command-business ()
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1959 (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
1960 "Outline post-command-hook function.
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1961
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1962 - 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
1963
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1964 - 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
1965 outline commands.
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1966
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1967 - 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
1968 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
1969 before-change-function is used."
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1970
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1971 ; 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
1972 (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
1973 nil
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1974 (setq outline-override-protect nil)
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1975 (if outline-during-write-cue
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1976 ;; 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
1977 (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
1978 ;; Undo bunching business:
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1979 (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
1980 (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
1981 (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
1982 (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
1983 (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
1984 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
1985 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
1986 (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
1987 (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
1988 (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
1989 (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
1990 (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
1991
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1992 ;; 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
1993 (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
1994 (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
1995 (= 1 (- cur-to cur-from))
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1996
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1997 ;; 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
1998 ;; insertions:
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1999 (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
2000 (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
2001 ; Below threshold:
7416
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
2002 (> 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
2003 (setq buffer-undo-list
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
2004 (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
2005 (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
2006 ;; 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
2007 (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
2008 (outline-current-bullet-pos))
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
2009 (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
2010 (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
2011 ))
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2012 ;;;_ > outline-pre-command-business ()
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2013 (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
2014 "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
2015
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
2016 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
2017
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2018 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
2019 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
2020 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
2021 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
2022
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2023 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
2024 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
2025 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
2026 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
2027
7416
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
2028 (if (and (boundp 'outline-mode)
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
2029 outline-mode
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
2030 (eq this-command 'self-insert-command)
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2031 (eq (point)(outline-current-bullet-pos)))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2032
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2033 (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
2034 last-command-event))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2035 mapped-binding)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2036
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2037 ; Map upper-register literals
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2038 ; to lower register:
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2039 (if (<= 96 this-key-num)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2040 (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
2041 ; Check if we have a literal:
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2042 (if (and (<= 64 this-key-num)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2043 (>= 96 this-key-num))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2044 (setq mapped-binding
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2045 (lookup-key 'outline-mode-map
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2046 (concat outline-command-prefix
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2047 (char-to-string (- this-key-num 64))))))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2048 (if mapped-binding
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2049 (setq outline-post-goto-bullet t
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2050 this-command mapped-binding)))))
7416
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
2051 ;;;_ > outline-find-file-hook ()
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
2052 (defun outline-find-file-hook ()
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
2053 "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
2054
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
2055 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
2056 (if (and outline-auto-activation
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
2057 (not (outline-mode-p))
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
2058 outline-layout)
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
2059 (outline-mode t)))
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
2060 ;;;_ : Establish the hooks
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
2061 (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
2062 (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
2063
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2064 ;;;_ - Topic Format Assessment
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2065 ;;;_ > outline-solicit-alternate-bullet (depth &optional current-bullet)
3430
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2066 (defun outline-solicit-alternate-bullet (depth &optional current-bullet)
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2067
7416
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
2068 "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
2069
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
2070 Offer one suitable for current depth DEPTH as default."
3430
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2071
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2072 (let* ((default-bullet (or current-bullet
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2073 (outline-bullet-for-depth depth)))
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2074 (sans-escapes (regexp-sans-escapes outline-bullets-string))
3430
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2075 (choice (solicit-char-in-string
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2076 (format "Select bullet: %s ('%s' default): "
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2077 sans-escapes
3430
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2078 default-bullet)
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2079 sans-escapes
3430
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2080 t)))
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2081 (if (string= choice "") default-bullet choice))
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2082 )
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2083 ;;;_ > outline-sibling-index (&optional depth)
3430
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2084 (defun outline-sibling-index (&optional depth)
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2085 "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
2086
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2087 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
2088 opening a new level, and return 0.
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2089
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2090 If less than this depth, ascend to that depth and count..."
3430
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2091
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2092 (save-excursion
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2093 (cond ((and depth (<= depth 0) 0))
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2094 ((or (not depth) (= depth (outline-depth)))
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2095 (let ((index 1))
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2096 (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
2097 (setq index (1+ index)))
3430
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2098 index))
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2099 ((< depth (outline-recent-depth))
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2100 (outline-ascend-to-depth depth)
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2101 (outline-sibling-index))
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2102 (0))))
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2103 ;;;_ > outline-distinctive-bullet (bullet)
3430
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2104 (defun outline-distinctive-bullet (bullet)
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2105 "True if bullet is one of those on outline-distinctive-bullets-string."
3430
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2106 (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
2107 ;;;_ > outline-numbered-type-prefix (&optional prefix)
3430
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2108 (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
2109 "True if current header prefix bullet is numbered bullet."
3430
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2110 (and outline-numbered-bullet
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2111 (string= outline-numbered-bullet
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2112 (if prefix
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2113 (outline-get-prefix-bullet prefix)
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2114 (outline-get-bullet)))))
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2115 ;;;_ > outline-bullet-for-depth (&optional depth)
3430
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2116 (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
2117 "Return outline topic bullet suited to optional DEPTH, or current depth."
3430
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2118 ;; Find bullet in plain-bullets-string modulo DEPTH.
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2119 (if outline-stylish-prefixes
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2120 (char-to-string (aref outline-plain-bullets-string
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2121 (% (max 0 (- depth 2))
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2122 outline-plain-bullets-string-len)))
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2123 outline-primary-bullet)
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2124 )
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2125
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2126 ;;;_ - Topic Production
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2127 ;;;_ > outline-make-topic-prefix (&optional prior-bullet
3430
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2128 (defun outline-make-topic-prefix (&optional prior-bullet
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2129 new
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2130 depth
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2131 solicit
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2132 number-control
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2133 index)
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2134 ;; Depth null means use current depth, non-null means we're either
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2135 ;; opening a new topic after current topic, lower or higher, or we're
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2136 ;; changing level of current topic.
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2137 ;; Solicit dominates specified bullet-char.
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2138 ;;;_ . Doc string:
7416
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
2139 "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
2140
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2141 All the arguments are optional.
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2142
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2143 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
2144 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
2145 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
2146 for instance.
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2147
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2148 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
2149 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
2150 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
2151 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
2152 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
2153 bullet or previous sibling.
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2154
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2155 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
2156 the current topics' depth.
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2157
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2158 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
2159 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
2160 options, including, eg, a distinctive PRIOR-BULLET.)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2161
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2162 Fifth arg, NUMBER-CONTROL, matters only if 'outline-numbered-bullet'
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2163 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
2164 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
2165 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
2166
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2167 \(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
2168
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2169 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
2170 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
2171 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
2172 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
2173 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
2174 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
2175 number is used as the index for the numbered prefix (allowing, eg,
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2176 sequential renumbering to not requre this function counting back the
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2177 index for each successive sibling)."
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2178 ;;;_ . Code:
3430
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2179 ;; The options are ordered in likely frequence of use, most common
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2180 ;; highest, least lowest. Ie, more likely to be doing prefix
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2181 ;; adjustments than soliciting, and yet more than numbering.
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2182 ;; Current prefix is least dominant, but most likely to be commonly
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2183 ;; specified...
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2184
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2185 (let* (body
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2186 numbering
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2187 denumbering
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2188 (depth (or depth (outline-depth)))
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2189 (header-lead outline-header-prefix)
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2190 (bullet-char
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2191
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2192 ;; Getting value for bullet char is practically the whole job:
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2193
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2194 (cond
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2195 ; Simplest situation - level 1:
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2196 ((<= depth 1) (setq header-lead "") outline-primary-bullet)
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2197 ; Simple, too: all asterisks:
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2198 (outline-old-style-prefixes
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2199 ;; Cheat - make body the whole thing, null out header-lead and
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2200 ;; bullet-char:
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2201 (setq body (make-string depth
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2202 (string-to-char outline-primary-bullet)))
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2203 (setq header-lead "")
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2204 "")
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2205
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2206 ;; (Neither level 1 nor old-style, so we're space padding.
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2207 ;; Sneak it in the condition of the next case, whatever it is.)
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2208
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2209 ;; Solicitation overrides numbering and other cases:
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2210 ((progn (setq body (make-string (- depth 2) ?\ ))
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2211 ;; The actual condition:
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2212 solicit)
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2213 (let* ((got (outline-solicit-alternate-bullet depth)))
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2214 ;; Gotta check whether we're numbering and got a numbered bullet:
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2215 (setq numbering (and outline-numbered-bullet
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2216 (not (and number-control (not index)))
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2217 (string= got outline-numbered-bullet)))
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2218 ;; Now return what we got, regardless:
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2219 got))
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2220
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2221 ;; Numbering invoked through args:
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2222 ((and outline-numbered-bullet number-control)
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2223 (if (setq numbering (not (setq denumbering (not index))))
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2224 outline-numbered-bullet
7416
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
2225 (if (and prior-bullet
3430
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2226 (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
2227 prior-bullet)))
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
2228 prior-bullet
3430
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2229 (outline-bullet-for-depth depth))))
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2230
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2231 ;;; Neither soliciting nor controlled numbering ;;;
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2232 ;;; (may be controlled denumbering, tho) ;;;
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2233
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2234 ;; Check wrt previous sibling:
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2235 ((and new ; only check for new prefixes
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2236 (<= depth (outline-depth))
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2237 outline-numbered-bullet ; ... & numbering enabled
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2238 (not denumbering)
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2239 (let ((sibling-bullet
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2240 (save-excursion
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2241 ;; Locate correct sibling:
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2242 (or (>= depth (outline-depth))
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2243 (outline-ascend-to-depth depth))
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2244 (outline-get-bullet))))
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2245 (if (and sibling-bullet
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2246 (string= outline-numbered-bullet sibling-bullet))
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2247 (setq numbering sibling-bullet)))))
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2248
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2249 ;; Distinctive prior bullet?
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2250 ((and prior-bullet
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2251 (outline-distinctive-bullet prior-bullet)
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2252 ;; Either non-numbered:
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2253 (or (not (and outline-numbered-bullet
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2254 (string= prior-bullet outline-numbered-bullet)))
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2255 ;; or numbered, and not denumbering:
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2256 (setq numbering (not denumbering)))
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2257 ;; Here 'tis:
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2258 prior-bullet))
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2259
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2260 ;; Else, standard bullet per depth:
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2261 ((outline-bullet-for-depth depth)))))
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2262
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2263 (concat header-lead
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2264 body
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2265 bullet-char
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2266 (if numbering
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2267 (format "%d" (cond ((and index (numberp index)) index)
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2268 (new (1+ (outline-sibling-index depth)))
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2269 ((outline-sibling-index))))))
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2270 )
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2271 )
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2272 ;;;_ > outline-open-topic (relative-depth &optional before)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2273 (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
2274 "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
2275
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
2276 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
2277 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
2278 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
2279
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2280 Nuances:
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2281
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2282 - 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
2283 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
2284
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2285 - 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
2286 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
2287 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
2288 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
2289 deliberately dividing topic bodies.
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2290
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2291 - 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
2292 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
2293 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
2294 single-spacing is used.
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2295
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2296 - 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
2297 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
2298 can easily create a sibling in front of the current topic without
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2299 having to go to its preceeding sibling, and then open forward
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2300 from there."
3430
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2301
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2302 (let* ((depth (+ (outline-current-depth) relative-depth))
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2303 (opening-on-blank (if (looking-at "^\$")
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2304 (not (setq before nil))))
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2305 opening-numbered ; Will get while computing ref-topic, below
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2306 ref-depth ; Will get while computing ref-topic, next
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2307 (ref-topic (save-excursion
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2308 (cond ((< relative-depth 0)
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2309 (outline-ascend-to-depth depth))
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2310 ((>= relative-depth 1) nil)
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2311 (t (outline-back-to-current-heading)))
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2312 (setq ref-depth (outline-recent-depth))
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2313 (setq opening-numbered
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2314 (save-excursion
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2315 (and outline-numbered-bullet
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2316 (or (<= relative-depth 0)
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2317 (outline-descend-to-depth depth))
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2318 (if (outline-numbered-type-prefix)
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2319 outline-numbered-bullet))))
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2320 (point)))
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2321 dbl-space
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2322 doing-beginning)
3430
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2323
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2324 (if (not opening-on-blank)
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2325 ; Positioning and vertical
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2326 ; padding - only if not
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2327 ; opening-on-blank:
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2328 (progn
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2329 (goto-char ref-topic)
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2330 (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
2331 (or (and (<= relative-depth 0) ; not descending;
3430
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2332 (save-excursion
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2333 ;; at b-o-b or preceeded by a blank line?
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2334 (or (> 0 (forward-line -1))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2335 (looking-at "^\\s-*$")
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2336 (bobp)))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2337 (save-excursion
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2338 ;; succeeded by a blank line?
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2339 (outline-end-of-current-subtree)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2340 (bolp)))
3430
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2341 (and (= ref-depth 1)
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2342 (or before
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2343 (= depth 1)
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2344 (save-excursion
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2345 ;; Don't already have following
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2346 ;; vertical padding:
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2347 (not (outline-pre-next-preface)))))))
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2348
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2349 ; Position to prior heading,
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2350 ; if inserting backwards, and
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2351 ; not going outwards:
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2352 (if (and before (>= relative-depth 0))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2353 (progn (outline-back-to-current-heading)
3430
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2354 (setq doing-beginning (bobp))
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2355 (if (not (bobp))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2356 (outline-previous-heading)))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2357 (if (and before (bobp))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2358 (outline-unprotected (open-line 1))))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2359
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2360 (if (<= relative-depth 0)
3430
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2361 ;; Not going inwards, don't snug up:
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2362 (if doing-beginning
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2363 (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
2364 (if before
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2365 (progn (end-of-line)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2366 (outline-pre-next-preface)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2367 (while (= ?\r (following-char))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2368 (forward-char 1))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2369 (if (not (looking-at "^$"))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2370 (outline-unprotected (open-line 1))))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2371 (outline-end-of-current-subtree)))
3430
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2372 ;; Going inwards - double-space if first offspring is,
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2373 ;; otherwise snug up.
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2374 (end-of-line) ; So we skip any concealed progeny.
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2375 (outline-pre-next-preface)
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2376 (if (bolp)
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2377 ;; Blank lines between current header body and next
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2378 ;; header - get to last substantive (non-white-space)
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2379 ;; line in body:
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2380 (re-search-backward "[^ \t\n]" nil t))
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2381 (if (save-excursion
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2382 (outline-next-heading)
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2383 (if (> (outline-recent-depth) ref-depth)
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2384 ;; This is an offspring.
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2385 (progn (forward-line -1)
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2386 (looking-at "^\\s-*$"))))
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2387 (progn (forward-line 1)
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2388 (outline-unprotected (open-line 1))))
3430
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2389 (end-of-line))
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2390 ;;(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
2391 (if (not (bobp))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2392 (progn (if (and (not (> depth ref-depth))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2393 (not before))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2394 (outline-unprotected (open-line 1))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2395 (if (> depth ref-depth)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2396 (outline-unprotected (newline 1))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2397 (if dbl-space
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2398 (outline-unprotected (open-line 1))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2399 (if (not before)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2400 (outline-unprotected (newline 1))))))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2401 (if dbl-space
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2402 (outline-unprotected (newline 1)))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2403 (if (and (not (eobp))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2404 (not (bolp)))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2405 (forward-char 1))))
3430
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2406 ))
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2407 (insert-string (concat (outline-make-topic-prefix opening-numbered
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2408 t
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2409 depth)
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2410 " "))
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2411
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2412 ;;(if doing-beginning (save-excursion (newline (if dbl-space 2 1))))
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2413
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2414
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2415 (outline-rebullet-heading nil ;;; solicit
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2416 depth ;;; depth
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2417 nil ;;; number-control
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2418 nil ;;; index
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2419 t) (end-of-line)
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2420 )
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2421 )
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2422 ;;;_ . open-topic contingencies
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2423 ;;;_ ; 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
2424 ;;;_ , beginning char
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2425 ;;;_ , amount of space before will be used, unless openning in place
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2426 ;;;_ , 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
2427 ;;;_ ; absolute depth of new topic
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2428 ;;;_ ! insert in place - overrides most stuff
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2429 ;;;_ ; relative depth of new re base
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2430 ;;;_ ; before or after base topic
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2431 ;;;_ ; 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
2432 ;;;_ ; 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
2433 ;;;_ ; 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
2434 ;;;_ ; location of new topic
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2435 ;;;_ .
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2436 ;;;_ > outline-open-subtopic (arg)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2437 (defun outline-open-subtopic (arg)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2438 "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
2439
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2440 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
2441 prior to the current one."
3430
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2442 (interactive "p")
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2443 (outline-open-topic 1 (> 0 arg)))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2444 ;;;_ > outline-open-sibtopic (arg)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2445 (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
2446 "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
2447
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
2448 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
2449 one."
3430
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2450 (interactive "p")
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2451 (outline-open-topic 0 (> 0 arg)))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2452 ;;;_ > outline-open-supertopic (arg)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2453 (defun outline-open-supertopic (arg)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2454 "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
2455
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2456 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
2457 topic prior to the current one."
3430
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2458
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2459 (interactive "p")
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2460 (outline-open-topic -1 (> 0 arg)))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2461
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2462 ;;;_ - Outline Alteration
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2463 ;;;_ : Topic Modification
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2464 ;;;_ = outline-former-auto-filler
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2465 (defvar outline-former-auto-filler nil
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2466 "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
2467 ;;;_ > outline-auto-fill ()
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2468 (defun outline-auto-fill ()
7416
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
2469 "Outline-mode autofill function.
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
2470
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
2471 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
2472 `outline-use-hanging-indents' is set."
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2473 (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
2474 ;; Check for topic header indentation:
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2475 (save-excursion
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2476 (beginning-of-line)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2477 (if (looking-at outline-regexp)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2478 ;; ... construct indentation to account for
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2479 ;; length of topic prefix:
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2480 (make-string (progn (outline-end-of-prefix)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2481 (current-column))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2482 ?\ ))))))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2483 (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
2484 (do-auto-fill))))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2485 ;;;_ > 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
2486 (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
2487 "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
2488
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2489 Optional arg NUMBER indicates numbering is being added, and it must
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2490 be accomodated.
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2491
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2492 Note that refill of indented paragraphs is not done."
3430
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2493
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2494 (save-excursion
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2495 (outline-end-of-prefix)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2496 (let* ((new-margin (current-column))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2497 excess old-indent-begin old-indent-end
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2498 curr-ind
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2499 ;; 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
2500 ;; *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
2501 ;; 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
2502 (old-margin (+ old-depth (- new-margin new-depth))))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2503
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2504 ;; 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
2505 (outline-unprotected
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2506 (save-match-data
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2507 (while
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2508 (and (re-search-forward "[\n\r]\\(\\s-*\\)"
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2509 nil
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2510 t)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2511 ;; Register the indent data, before we reset the
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2512 ;; match data with a subsequent 'looking-at':
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2513 (setq old-indent-begin (match-beginning 1)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2514 old-indent-end (match-end 1))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2515 (not (looking-at outline-regexp)))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2516 (if (> 0 (setq excess (- (current-column)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2517 old-margin)))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2518 ;; 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
2519 nil
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2520 ;; 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
2521 ;; reindent it, preserving its existing indentation
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2522 ;; beyond the old margin:
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2523 (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
2524 (indent-to (+ new-margin excess)))))))))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2525 ;;;_ > outline-rebullet-current-heading (arg)
3430
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2526 (defun outline-rebullet-current-heading (arg)
7416
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
2527 "Like non-interactive version 'outline-rebullet-heading'.
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
2528
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
2529 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
2530
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2531 With repeat count, solicit for bullet."
3430
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2532 (interactive "P")
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2533 (save-excursion (outline-back-to-current-heading)
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2534 (outline-end-of-prefix)
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2535 (outline-rebullet-heading (not arg) ;;; solicit
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2536 nil ;;; depth
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2537 nil ;;; number-control
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2538 nil ;;; index
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2539 t) ;;; do-successors
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2540 )
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2541 )
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2542 ;;;_ > outline-rebullet-heading (&optional solicit ...)
3430
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2543 (defun outline-rebullet-heading (&optional solicit
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2544 new-depth
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2545 number-control
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2546 index
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2547 do-successors)
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2548
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2549 "Adjust bullet of current topic prefix.
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2550
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2551 All args are optional.
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2552
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2553 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
2554 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
2555 depth determines it.
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2556
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2557 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
2558 of the topics current depth.
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2559
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2560 Third arg NUMBER-CONTROL can force the prefix to or away from
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2561 numbered form. It has effect only if 'outline-numbered-bullet' is
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2562 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
2563 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
2564 of the forth arg, INDEX.
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2565
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2566 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
2567 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
2568 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
2569 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
2570 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
2571 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
2572 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
2573
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2574 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
2575 siblings.
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2576
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2577 Cf vars 'outline-stylish-prefixes', 'outline-old-style-prefixes',
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2578 and 'outline-numbered-bullet', which all affect the behavior of
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2579 this function."
3430
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2580
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2581 (let* ((current-depth (outline-depth))
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2582 (new-depth (or new-depth current-depth))
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2583 (mb outline-recent-prefix-beginning)
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2584 (me outline-recent-prefix-end)
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2585 (current-bullet (buffer-substring (- me 1) me))
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2586 (new-prefix (outline-make-topic-prefix current-bullet
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2587 nil
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2588 new-depth
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2589 solicit
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2590 number-control
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2591 index)))
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2592
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2593 ;; Is new one is identical to old?
3430
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2594 (if (and (= current-depth new-depth)
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2595 (string= current-bullet
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2596 (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
2597 ;; Nothing to do:
3430
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2598 t
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2599
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2600 ;; New prefix probably different from old:
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2601 ; get rid of old one:
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2602 (outline-unprotected (delete-region mb me))
3430
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2603 (goto-char mb)
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2604 ; Dispense with number if
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2605 ; numbered-bullet prefix:
3430
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2606 (if (and outline-numbered-bullet
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2607 (string= outline-numbered-bullet current-bullet)
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2608 (looking-at "[0-9]+"))
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2609 (outline-unprotected
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2610 (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
2611
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2612 ; Put in new prefix:
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2613 (outline-unprotected (insert-string new-prefix))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2614
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2615 ;; 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
2616 (if (and outline-reindent-bodies
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2617 (not (= new-depth current-depth)))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2618 (outline-reindent-body current-depth new-depth))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2619
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2620 ;; 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
2621 ;; caller elected for it:
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2622 (if do-successors
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2623 (save-excursion
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2624 (while (outline-next-sibling new-depth nil)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2625 (setq index
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2626 (cond ((numberp index) (1+ index))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2627 ((not number-control) (outline-sibling-index))))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2628 (if (outline-numbered-type-prefix)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2629 (outline-rebullet-heading nil ;;; solicit
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2630 new-depth ;;; new-depth
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2631 number-control;;; number-control
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2632 index ;;; index
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2633 nil))))) ;;;(dont!)do-successors
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2634 ) ; (if (and (= current-depth new-depth)...))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2635 ) ; let* ((current-depth (outline-depth))...)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2636 ) ; defun
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2637 ;;;_ > outline-rebullet-topic (arg)
3430
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2638 (defun outline-rebullet-topic (arg)
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2639 "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
2640
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2641 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
2642
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2643 With repeat count, shift topic depth by that amount."
3430
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2644 (interactive "P")
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2645 (let ((start-col (current-column))
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2646 (was-eol (eolp)))
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2647 (save-excursion
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2648 ;; Normalize arg:
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2649 (cond ((null arg) (setq arg 0))
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2650 ((listp arg) (setq arg (car arg))))
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2651 ;; Fill the user in, in case we're shifting a big topic:
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2652 (if (not (zerop arg)) (message "Shifting..."))
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2653 (outline-back-to-current-heading)
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2654 (if (<= (+ (outline-recent-depth) arg) 0)
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2655 (error "Attempt to shift topic below level 1"))
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2656 (outline-rebullet-topic-grunt arg)
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2657 (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
2658 (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
2659 ;;;_ > outline-rebullet-topic-grunt (&optional relative-depth ...)
3430
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2660 (defun outline-rebullet-topic-grunt (&optional relative-depth
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2661 starting-depth
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2662 starting-point
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2663 index
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2664 do-successors)
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2665
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2666 "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
2667 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
2668 behavior.
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2669
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2670 All arguments are optional.
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 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
2673 topic that amount.
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2674
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2675 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
2676 itself. The are STARTING-DEPTH, STARTING-POINT, and INDEX."
3430
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2677
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2678 (let* ((relative-depth (or relative-depth 0))
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2679 (new-depth (outline-depth))
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2680 (starting-depth (or starting-depth new-depth))
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2681 (on-starting-call (null starting-point))
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2682 (index (or index
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2683 ;; Leave index null on starting call, so rebullet-heading
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2684 ;; calculates it at what might be new depth:
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2685 (and (or (zerop relative-depth)
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2686 (not on-starting-call))
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2687 (outline-sibling-index))))
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2688 (moving-outwards (< 0 relative-depth))
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2689 (starting-point (or starting-point (point))))
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2690
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2691 ;; Sanity check for excessive promotion done only on starting call:
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2692 (and on-starting-call
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2693 moving-outwards
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2694 (> 0 (+ starting-depth relative-depth))
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2695 (error "Attempt to shift topic out beyond level 1.")) ;;; ====>
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2696
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2697 (cond ((= starting-depth new-depth)
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2698 ;; We're at depth to work on this one:
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2699 (outline-rebullet-heading nil ;;; solicit
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2700 (+ starting-depth ;;; starting-depth
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2701 relative-depth)
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2702 nil ;;; number
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2703 index ;;; index
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2704 ;; Every contained topic will get hit,
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2705 ;; and we have to get to outside ones
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2706 ;; deliberately:
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2707 nil) ;;; do-successors
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2708 ;; ... and work on subsequent ones which are at greater depth:
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2709 (setq index 0)
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2710 (outline-next-heading)
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2711 (while (and (not (eobp))
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2712 (< starting-depth (outline-recent-depth)))
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2713 (setq index (1+ index))
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2714 (outline-rebullet-topic-grunt relative-depth ;;; relative-depth
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2715 (1+ starting-depth);;;starting-depth
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2716 starting-point ;;; starting-point
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2717 index))) ;;; index
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2718
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2719 ((< starting-depth new-depth)
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2720 ;; Rare case - subtopic more than one level deeper than parent.
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2721 ;; Treat this one at an even deeper level:
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2722 (outline-rebullet-topic-grunt relative-depth ;;; relative-depth
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2723 new-depth ;;; starting-depth
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2724 starting-point ;;; starting-point
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2725 index))) ;;; index
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2726
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2727 (if on-starting-call
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2728 (progn
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2729 ;; Rectify numbering of former siblings of the adjusted topic,
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2730 ;; if topic has changed depth
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2731 (if (or do-successors
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2732 (and (not (zerop relative-depth))
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2733 (or (= (outline-recent-depth) starting-depth)
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2734 (= (outline-recent-depth) (+ starting-depth
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2735 relative-depth)))))
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2736 (outline-rebullet-heading nil nil nil nil t))
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2737 ;; Now rectify numbering of new siblings of the adjusted topic,
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2738 ;; if depth has been changed:
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2739 (progn (goto-char starting-point)
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2740 (if (not (zerop relative-depth))
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2741 (outline-rebullet-heading nil nil nil nil t)))))
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2742 )
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2743 )
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2744 ;;;_ > outline-renumber-to-depth (&optional depth)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2745 (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
2746 "Renumber siblings at current depth.
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
2747
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
2748 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
2749
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2750 Returns final depth."
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2751
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2752 ;; 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
2753 ;; 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
2754
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2755 (let ((ascender (outline-depth)))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2756 (while (and (not (eobp))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2757 (outline-depth)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2758 (>= (outline-recent-depth) depth)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2759 (>= ascender depth))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2760 ; Skip over all topics at
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2761 ; lesser depths, which can not
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2762 ; have been disturbed:
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2763 (while (and (not (eobp))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2764 (> (outline-recent-depth) ascender))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2765 (outline-next-heading))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2766 ; Prime ascender for ascension:
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2767 (setq ascender (1- (outline-recent-depth)))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2768 (if (>= (outline-recent-depth) depth)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2769 (outline-rebullet-heading nil ;;; solicit
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2770 nil ;;; depth
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2771 nil ;;; number-control
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2772 nil ;;; index
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2773 t))));;; do-successors
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2774 (outline-recent-depth))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2775 ;;;_ > outline-number-siblings (&optional denumber)
3430
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2776 (defun outline-number-siblings (&optional denumber)
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2777 "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
2778
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2779 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
2780 topic and its siblings.
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 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
2783 rebulleting each topic at this level."
3430
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2784
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2785 (interactive "P")
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2786
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2787 (save-excursion
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2788 (outline-back-to-current-heading)
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2789 (outline-beginning-of-level)
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2790 (let ((depth (outline-recent-depth))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2791 (index (if (not denumber) 1))
3430
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2792 (use-bullet (equal '(16) denumber))
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2793 (more t))
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2794 (while more
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2795 (outline-rebullet-heading use-bullet ;;; solicit
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2796 depth ;;; depth
3430
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2797 t ;;; number-control
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2798 index ;;; index
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2799 nil) ;;; do-successors
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2800 (if index (setq index (1+ index)))
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2801 (setq more (outline-next-sibling depth nil))))))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2802 ;;;_ > outline-shift-in (arg)
3430
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2803 (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
2804 "Increase depth of current heading and any topics collapsed within it."
3430
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2805 (interactive "p")
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2806 (outline-rebullet-topic arg))
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2807 ;;;_ > outline-shift-out (arg)
3430
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2808 (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
2809 "Decrease depth of current heading and any topics collapsed within it."
3430
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2810 (interactive "p")
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2811 (outline-rebullet-topic (* arg -1)))
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2812 ;;;_ : 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
2813 ;;;_ > outline-kill-line (&optional arg)
3430
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2814 (defun outline-kill-line (&optional arg)
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2815 "Kill line, adjusting subsequent lines suitably for outline mode."
3430
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2816
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2817 (interactive "*P")
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2818 (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
2819 outline-numbered-bullet ; numbers may need adjustment,
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2820 (bolp) ; may be clipping topic head,
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2821 (looking-at outline-regexp))) ; are clipping topic head.
3430
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2822 ;; Above conditions do not obtain - just do a regular kill:
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2823 (kill-line arg)
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2824 ;; 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
2825 (let* ((depth (outline-depth)))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2826 ; Do the kill:
3430
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2827 (kill-line arg)
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2828 ; Provide some feedback:
3430
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2829 (sit-for 0)
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2830 (save-excursion
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2831 ; Start with the topic
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2832 ; following killed line:
3430
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2833 (if (not (looking-at outline-regexp))
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2834 (outline-next-heading))
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2835 (outline-renumber-to-depth depth)))))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2836 ;;;_ > outline-kill-topic ()
3430
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2837 (defun outline-kill-topic ()
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2838 "Kill topic together with subtopics.
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2839
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2840 Leaves primary topic's trailing vertical whitespace, if any."
3430
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2841
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2842 ;; Some finagling is done to make complex topic kills appear faster
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2843 ;; than they actually are. A redisplay is performed immediately
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2844 ;; after the region is disposed of, though the renumbering process
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2845 ;; has yet to be performed. This means that there may appear to be
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2846 ;; a lag *after* the kill has been performed.
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2847
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2848 (interactive)
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2849 (let* ((beg (prog1 (outline-back-to-current-heading)(beginning-of-line)))
3430
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2850 (depth (outline-recent-depth)))
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2851 (outline-end-of-current-subtree)
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2852 (if (not (eobp))
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2853 (if (or (not (looking-at "^$"))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2854 ;; 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
2855 ;; 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
2856 ;; 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
2857 ;; containing topic:
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2858 (save-excursion
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2859 (and (outline-next-heading)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2860 (>= (outline-recent-depth) depth))))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2861 (forward-char 1)))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2862
3430
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2863 (kill-region beg (point))
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2864 (sit-for 0)
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2865 (save-excursion
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2866 (outline-renumber-to-depth depth))))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2867 ;;;_ > outline-yank-processing ()
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2868 (defun outline-yank-processing (&optional arg)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2869
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2870 "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
2871
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2872 Does depth adjustment of yanked topics, when:
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2873
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2874 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
2875 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
2876 topic prefix.
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2877
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2878 Also, adjusts numbering of subsequent siblings when appropropriate.
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2879
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2880 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
2881 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
2882 header into which it's being yanked.
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2883
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2884 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
2885 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
2886 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
2887
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2888 (interactive "*P")
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2889 ; Get to beginning, leaving
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2890 ; region around subject:
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2891 (if (< (mark-marker) (point))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2892 (exchange-point-and-mark))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2893 (let* ((subj-beg (point))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2894 (subj-end (mark-marker))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2895 ;; 'resituate' if yanking an entire topic into topic header:
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2896 (resituate (and (outline-e-o-prefix-p)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2897 (looking-at (concat "\\(" outline-regexp "\\)"))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2898 (outline-prefix-data (match-beginning 1)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2899 (match-end 1))))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2900 ;; 'rectify-numbering' if resituating (where several topics may
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2901 ;; 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
2902 (rectify-numbering (or resituate
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2903 (and (bolp) (looking-at outline-regexp)))))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2904 (if resituate
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2905 ; The yanked stuff is a topic:
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2906 (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
2907 (subj-depth (outline-recent-depth))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2908 (prefix-bullet (outline-recent-bullet))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2909 (adjust-to-depth
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2910 ;; 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
2911 ;; adjustment should be made:
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2912 (save-excursion
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2913 (and (goto-char subj-end)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2914 (eolp)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2915 (goto-char subj-beg)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2916 (and (looking-at outline-regexp)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2917 (progn
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2918 (beginning-of-line)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2919 (not (= (point) subj-beg)))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2920 (looking-at outline-regexp)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2921 (outline-prefix-data (match-beginning 0)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2922 (match-end 0)))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2923 (outline-recent-depth))))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2924 done
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2925 (more t))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2926 (setq rectify-numbering outline-numbered-bullet)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2927 (if adjust-to-depth
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2928 ; Do the adjustment:
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2929 (progn
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2930 (message "... yanking") (sit-for 0)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2931 (save-restriction
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2932 (narrow-to-region subj-beg subj-end)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2933 ; Trim off excessive blank
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2934 ; line at end, if any:
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2935 (goto-char (point-max))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2936 (if (looking-at "^$")
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2937 (outline-unprotected (delete-char -1)))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2938 ; Work backwards, with each
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2939 ; shallowest level,
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2940 ; successively excluding the
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2941 ; last processed topic from
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2942 ; the narrow region:
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2943 (while more
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2944 (outline-back-to-current-heading)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2945 ; 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
2946 (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
2947 (save-excursion
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2948 (outline-rebullet-topic-grunt (- adjust-to-depth
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2949 subj-depth))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2950 (outline-depth))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2951 (if (setq more (not (bobp)))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2952 (progn (widen)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2953 (forward-char -1)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2954 (narrow-to-region subj-beg (point))))))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2955 (message "")
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2956 ;; 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
2957 ;; use old one:
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2958 (if (string-match (regexp-quote prefix-bullet)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2959 outline-distinctive-bullets-string)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2960 ; Delete from bullet of old to
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2961 ; before bullet of new:
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2962 (progn
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2963 (beginning-of-line)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2964 (delete-region (point) subj-beg)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2965 (set-marker (mark-marker) subj-end)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2966 (goto-char subj-beg)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2967 (outline-end-of-prefix))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2968 ; Delete base subj prefix,
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2969 ; leaving old one:
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2970 (delete-region (point) (+ (point)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2971 prefix-len
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2972 (- adjust-to-depth subj-depth)))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2973 ; and delete residual subj
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2974 ; prefix digits and space:
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2975 (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
2976 (if (looking-at " ") (delete-char 1))))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2977 (exchange-point-and-mark))))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2978 (if rectify-numbering
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2979 (progn
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2980 (save-excursion
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2981 ; Give some preliminary feedback:
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2982 (message "... reconciling numbers") (sit-for 0)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2983 ; ... and renumber, in case necessary:
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2984 (goto-char subj-beg)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2985 (if (outline-goto-prefix)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2986 (outline-rebullet-heading nil ;;; solicit
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2987 (outline-depth) ;;; depth
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2988 nil ;;; number-control
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2989 nil ;;; index
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2990 t))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2991 (message ""))))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2992 (if (not resituate)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2993 (exchange-point-and-mark))))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2994 ;;;_ > outline-yank (&optional arg)
3430
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2995 (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
2996 "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
2997
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
2998 Non-topic yanks work no differntly than normal yanks.
7218
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 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
3001 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
3002
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3003 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
3004 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
3005 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
3006 topic prefix.
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3007
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3008 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
3009 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
3010 header into which it's being yanked.
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3011
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3012 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
3013 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
3014 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
3015 exactly like normal yanks.
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3016
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3017 Numbering of yanked topics, and the succesive siblings at the depth
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3018 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
3019
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3020 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
3021 works with normal yank in non-outline buffers."
3430
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3022
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3023 (interactive "*P")
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3024 (setq this-command 'yank)
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3025 (yank arg)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3026 (if (outline-mode-p)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3027 (outline-yank-processing)))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3028 ;;;_ > outline-yank-pop (&optional arg)
3430
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3029 (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
3030 "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
3031
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
3032 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
3033
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3034 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
3035 by pops to non-distinctive yanks. Bug..."
3430
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3036
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3037 (interactive "*p")
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3038 (setq this-command 'yank)
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3039 (yank-pop arg)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3040 (if (outline-mode-p)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3041 (outline-yank-processing)))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3042
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3043 ;;;_ - Specialty bullet functions
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3044 ;;;_ : File Cross references
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3045 ;;;_ > outline-resolve-xref ()
3430
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3046 (defun outline-resolve-xref ()
7416
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
3047 "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
3048
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
3049 \(Works according to setting of `outline-file-xref-bullet')."
3430
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3050 (interactive)
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3051 (if (not outline-file-xref-bullet)
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3052 (error
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3053 "outline cross references disabled - no 'outline-file-xref-bullet'")
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3054 (if (not (string= (outline-current-bullet) outline-file-xref-bullet))
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3055 (error "current heading lacks cross-reference bullet '%s'"
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3056 outline-file-xref-bullet)
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3057 (let (file-name)
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3058 (save-excursion
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3059 (let* ((text-start outline-recent-prefix-end)
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3060 (heading-end (progn (outline-pre-next-preface)
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3061 (point))))
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3062 (goto-char text-start)
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3063 (setq file-name
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3064 (if (re-search-forward "\\s-\\(\\S-*\\)" heading-end t)
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3065 (buffer-substring (match-beginning 1) (match-end 1))))))
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3066 (setq file-name
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3067 (if (not (= (aref file-name 0) ?:))
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3068 (expand-file-name file-name)
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3069 ; A registry-files ref, strip the ':'
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3070 ; and try to follow it:
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3071 (let ((reg-ref (reference-registered-file
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3072 (substring file-name 1) nil t)))
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3073 (if reg-ref (car (cdr reg-ref))))))
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3074 (if (or (file-exists-p file-name)
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3075 (if (file-writable-p file-name)
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3076 (y-or-n-p (format "%s not there, create one? "
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3077 file-name))
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3078 (error "%s not found and can't be created" file-name)))
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3079 (condition-case failure
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3080 (find-file-other-window file-name)
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3081 (error failure))
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3082 (error "%s not found" file-name))
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3083 )
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3084 )
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3085 )
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3086 )
7416
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
3087
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
3088 ;;;_ #6 Exposure Control and Processing
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3089
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3090 ;;;_ - Fundamental
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3091 ;;;_ > outline-flag-region (from to flag)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3092 (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
3093 "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
3094 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
3095 next C-j (newline) char.
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
3096
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
3097 Returns the endpoint of the region."
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3098 (` (let ((buffer-read-only nil)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3099 (outline-override-protect t))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3100 (subst-char-in-region (, from) (, to)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3101 (if (= (, flag) ?\n) ?\r ?\n)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3102 (, flag) t))))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3103 ;;;_ > outline-flag-current-subtree (flag)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3104 (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
3105 "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
3106
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
3107 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
3108
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3109 (save-excursion
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3110 (outline-back-to-current-heading)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3111 (outline-flag-region (point)
7416
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
3112 (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
3113 flag)))
7218
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 ;;;_ - Mapping and processing of topics
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3116 ;;;_ " See also chart functions, in navigation
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3117 ;;;_ > outline-listify-exposed (&optional start end)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3118 (defun outline-listify-exposed (&optional start end)
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 "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
3121
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3122 This list can then be used by 'outline-process-exposed' to manipulate
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3123 the subject region.
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3124
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3125 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
3126 exposed components in subtopic.
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3127
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3128 Each component list contains:
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3129 - a number representing the depth of the topic,
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3130 - a string representing the header-prefix (ref. 'outline-header-prefix'),
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3131 - a string representing the bullet character,
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3132 - 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
3133 portion of the topic entry."
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3134
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3135 (interactive "r")
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3136 (save-excursion
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3137 (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
3138 (goto-char start)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3139 (beginning-of-line)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3140 (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
3141 (outline-next-visible-heading 1))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3142 (while (and (not done)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3143 (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
3144 (not (> (point) end)))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3145 (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
3146 bullet (outline-recent-bullet) ; ... bullet,
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3147 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
3148 (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
3149 (not (outline-next-visible-heading 1)))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3150 (beginning-of-line)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3151 (setq next (point))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3152 (goto-char beg)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3153 (setq strings nil)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3154 (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
3155 (setq strings
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3156 (cons (buffer-substring
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3157 beg
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3158 ;To hidden text or end of line:
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3159 (progn
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3160 (search-forward "\r"
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3161 (save-excursion (end-of-line)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3162 (point))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3163 1)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3164 (if (= (preceding-char) ?\r)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3165 (1- (point))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3166 (point))))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3167 strings))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3168 (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
3169 (forward-line 1))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3170 (setq beg (point)))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3171 ;; Accumulate list for this topic:
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3172 (setq result
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3173 (cons (append (list depth
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3174 outline-header-prefix
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3175 bullet)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3176 (nreverse strings))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3177 result)))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3178 ;; 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
3179 (nreverse result))))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3180 ;;;_ > outline-process-exposed (arg &optional tobuf)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3181 (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
3182 "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
3183
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
3184 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
3185 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
3186 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
3187 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
3188 with \"*\" prepended and \" exposed*\" appended).
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3189
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3190 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
3191 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
3192
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3193 ; Resolve arguments,
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3194 ; defaulting if necessary:
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3195 (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
3196 (if (not (and from to))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3197 (if mark-active
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3198 (setq from (region-beginning) to (region-end))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3199 (setq from (point-min) to (point-max))))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3200 (if frombuf
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3201 (if (not (bufferp frombuf))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3202 ;; Specified but not a buffer - get it:
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3203 (let ((got (get-buffer frombuf)))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3204 (if (not got)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3205 (error (concat "outline-process-exposed: source buffer "
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3206 frombuf
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3207 " not found."))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3208 (setq frombuf got))))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3209 ;; not specified - default it:
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3210 (setq frombuf (current-buffer)))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3211 (if tobuf
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3212 (if (not (bufferp tobuf))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3213 (setq tobuf (get-buffer-create tobuf)))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3214 ;; not specified - default it:
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3215 (setq tobuf (concat "*" (buffer-name frombuf) " exposed*")))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3216
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3217 (let* ((listified (progn (set-buffer frombuf)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3218 (outline-listify-exposed from to)))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3219 (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
3220 curr)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3221 (set-buffer tobuf)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3222 (while listified
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3223 (setq curr (car listified))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3224 (setq listified (cdr listified))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3225 (apply func (list (car curr) ; depth
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3226 (car (cdr curr)) ; header-prefix
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3227 (car (cdr (cdr curr))) ; bullet
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3228 (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
3229 (pop-to-buffer tobuf)))
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 ;;;_ - Topic-specific
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3232 ;;;_ > outline-show-entry ()
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3233 ; 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
3234 (defun outline-show-entry ()
7416
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
3235 "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
3236
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3237 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
3238 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
3239 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
3240 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
3241
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3242 (interactive)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3243 (save-excursion
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3244 (outline-goto-prefix)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3245 (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
3246 (or (outline-pre-next-preface) (point))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3247 ?\n)))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3248 ;;;_ > outline-show-children (&optional level strict)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3249 (defun outline-show-children (&optional level strict)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3250
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3251 "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
3252
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3253 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
3254
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3255 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
3256 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
3257
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3258 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
3259 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
3260 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
3261 it.
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
3262
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
3263 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
3264 point of non-opened subtree?)"
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3265
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3266 (interactive "p")
7416
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
3267 (let (max-pos)
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
3268 (if (and (not strict)
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
3269 (outline-hidden-p))
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
3270
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
3271 (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
3272 ; expose it.
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
3273 ;; 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
3274 ;; infinite regress:
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
3275 (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
3276
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
3277 (save-excursion
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
3278 (save-restriction
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
3279 (let* ((start-pt (point))
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
3280 (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
3281 (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
3282 (goto-char start-pt)
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
3283 (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
3284 ;; 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
3285 ;; unless strict was set.
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
3286 (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
3287 (while to-reveal
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
3288 (goto-char (car to-reveal))
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
3289 (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
3290 (setq to-reveal (cdr to-reveal)))))))))
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3291 ;;;_ 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
3292 (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
3293 "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
3294
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3295 \(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
3296 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
3297 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
3298 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
3299 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
3300
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3301 (interactive "p")
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3302 ;;(beep)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3303 ;;(message (format "Use '%s' instead of '%s' (%s)."
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3304 ;; "outline-show-children"
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3305 ;; "outline-show-current-children"
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3306 ;; (buffer-name (current-buffer))))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3307 (outline-show-children level strict))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3308 ;;;_ > outline-hide-point-reconcile ()
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3309 (defun outline-hide-reconcile ()
7416
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
3310 "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
3311
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3312 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
3313 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
3314 (interactive)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3315 (save-excursion
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3316 (outline-goto-prefix)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3317 (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
3318 (progn (outline-pre-next-preface)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3319 (if (= ?\r (following-char))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3320 (point)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3321 (1- (point))))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3322 ?\r)))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3323 ;;;_ > outline-show-to-offshoot ()
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3324 (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
3325 "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
3326
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
3327 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
3328 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
3329
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3330 (interactive)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3331 (save-excursion
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3332 (let ((orig-pt (point))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3333 (orig-pref (outline-goto-prefix))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3334 (last-at (point))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3335 bag-it)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3336 (while (or bag-it (= (preceding-char) ?\r))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3337 (beginning-of-line)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3338 (if (= last-at (setq last-at (point)))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3339 ;; 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
3340 ;; topic completely, and bag this try.
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3341 (progn (beginning-of-line)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3342 (outline-show-current-subtree)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3343 (goto-char orig-pt)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3344 (setq bag-it t)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3345 (beep)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3346 (message "%s: %s"
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3347 "outline-show-to-offshoot: "
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3348 "Aberrant nesting encountered.")))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3349 (outline-show-children)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3350 (goto-char orig-pref))
7416
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
3351 (goto-char orig-pt)))
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
3352 (if (outline-hidden-p)
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
3353 (outline-show-entry)))
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3354 ;;;_ > outline-hide-current-entry ()
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3355 (defun outline-hide-current-entry ()
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3356 "Hide the body directly following this heading."
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3357 (interactive)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3358 (outline-back-to-current-heading)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3359 (save-excursion
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3360 (outline-flag-region (point)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3361 (progn (outline-end-of-current-entry) (point))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3362 ?\^M)))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3363 ;;;_ > outline-show-current-entry (&optional arg)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3364 (defun outline-show-current-entry (&optional arg)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3365
7416
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
3366 "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
3367
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3368 (interactive "P")
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3369 (if arg
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3370 (outline-hide-current-entry)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3371 (save-excursion
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3372 (outline-flag-region (point)
7416
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
3373 (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
3374 ?\n))))
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3375 ;;;_ > outline-hide-current-entry-completely ()
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3376 ; ... 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
3377 (defun outline-hide-current-entry-completely ()
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3378 "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
3379
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3380 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
3381 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
3382 (interactive)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3383 (save-excursion
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3384 (outline-goto-prefix)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3385 (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
3386 (progn (outline-pre-next-preface)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3387 (if (= ?\r (following-char))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3388 (point)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3389 (1- (point))))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3390 ?\r)))
7416
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
3391 ;;;_ > 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
3392 (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
3393 "Show everything within the current topic. With a repeat-count,
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
3394 expose this topic and its' siblings."
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
3395 (interactive "P")
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
3396 (save-excursion
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
3397 (if (<= (outline-current-depth) 0)
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
3398 ;; 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
3399 (if (not (outline-next-heading))
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
3400 (error "No topics.")
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
3401 ;; 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
3402 (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
3403 (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
3404 (if (not arg)
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
3405 (outline-flag-current-subtree ?\n)
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
3406 (outline-beginning-of-level)
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
3407 (outline-expose-topic '(* :))))))
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3408 ;;;_ > outline-hide-current-subtree (&optional just-close)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3409 (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
3410 "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
3411
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
3412 If this topic is closed and it's a top level topic, close this topic
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
3413 and its' siblings.
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
3414
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
3415 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
3416 siblings, even if the target topic is already closed."
3430
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3417
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3418 (interactive)
7416
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
3419 (let ((from (point))
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
3420 (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
3421 (if (not (outline-goto-prefix))
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
3422 (error "No topics found.")
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
3423 (end-of-line)(point)))))
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3424 (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
3425 (goto-char from)
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
3426 (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
3427 (end-of-line)
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
3428 (point)))
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
3429 (not just-close)
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3430 ;; 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
3431 (goto-char from)
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
3432 (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
3433 t
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
3434 (goto-char 0)
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
3435 (let ((msg
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
3436 "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
3437 (message msg)
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
3438 (outline-expose-topic '(0 :))
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
3439 (message (concat msg " Done.")))
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
3440 nil)
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
3441 (/= (outline-recent-depth) 0))
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
3442 (outline-hide-current-subtree))
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
3443 (goto-char from)))
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3444 ;;;_ > outline-show-current-branches ()
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3445 (defun outline-show-current-branches ()
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3446 "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
3447 (interactive)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3448 (beginning-of-line)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3449 (outline-show-children t))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3450 ;;;_ > outline-hide-current-leaves ()
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3451 (defun outline-hide-current-leaves ()
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3452 "Hide the bodies of the current topic and all its' offspring."
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3453 (interactive)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3454 (outline-back-to-current-heading)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3455 (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
3456 (point))))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3457
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3458 ;;;_ - Region and beyond
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3459 ;;;_ > outline-show-all ()
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3460 (defun outline-show-all ()
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3461 "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
3462 (interactive)
7416
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
3463 (message "Exposing entire buffer...")
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
3464 (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
3465 (message "Exposing entire buffer... Done."))
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3466 ;;;_ > outline-hide-bodies ()
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3467 (defun outline-hide-bodies ()
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3468 "Hide all of buffer except headings."
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3469 (interactive)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3470 (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
3471 ;;;_ > outline-hide-region-body (start end)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3472 (defun outline-hide-region-body (start end)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3473 "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
3474 (save-excursion
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3475 (save-restriction
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3476 (narrow-to-region start end)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3477 (goto-char (point-min))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3478 (while (not (eobp))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3479 (outline-flag-region (point)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3480 (progn (outline-pre-next-preface) (point)) ?\^M)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3481 (if (not (eobp))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3482 (forward-char
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3483 (if (looking-at "[\n\r][\n\r]")
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3484 2 1)))))))
7416
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
3485
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
3486 ;;;_ > outline-expose-topic (spec)
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
3487 (defun outline-expose-topic (spec)
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
3488 "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
3489
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
3490 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
3491 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
3492 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
3493 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
3494
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3495 Cursor is left at start position.
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3496
7416
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
3497 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
3498
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
3499 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
3500
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3501 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
3502 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
3503
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
3504 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
3505 subtopics of the current topic.
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
3506
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
3507 The ':' repeat spec is used to specify exposure for any number of
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
3508 successive siblings, up to the trailing ones for which there are
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
3509 explicit specs following the ':'.
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3510
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3511 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
3512
7416
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
3513 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
3514 - 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
3515 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
3516 that level.
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
3517 - 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
3518 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
3519 - 0 means to close topic - hide all offspring.
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
3520 : - 'repeat'
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3521 apply prior element to all siblings at current level, *up to*
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3522 those siblings that would be covered by specs following the ':'
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3523 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
3524 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
3525 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
3526 * - 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
3527 + - 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
3528 - - 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
3529
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3530 Examples:
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3531 \(outline-expose-topic '(-1 : 0))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3532 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
3533 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
3534 at this current level completely.
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3535 \(outline-expose-topic '(-1 () : 1 0))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3536 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
3537 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
3538 close the last one.
7416
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
3539 \(outline-expose-topic '(-2 : -1 *))
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3540 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
3541 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
3542 last and completely open the last one."
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3543
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3544 (interactive "xExposure spec: ")
7416
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
3545 (if (not (listp spec))
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
3546 nil
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
3547 (let ((depth (outline-depth))
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
3548 (max-pos 0)
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
3549 prev-elem curr-elem
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
3550 stay done
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
3551 snug-back
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
3552 )
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
3553 (while spec
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
3554 (setq prev-elem curr-elem
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
3555 curr-elem (car spec)
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
3556 spec (cdr spec))
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
3557 (cond ; Do current element:
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
3558 ((null curr-elem) nil)
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
3559 ((symbolp curr-elem)
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
3560 (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
3561 (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
3562 (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
3563 ((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
3564 (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
3565 (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
3566 ((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
3567 ((eq curr-elem ':)
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
3568 (setq stay t)
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
3569 ;; Expand the 'repeat' spec to an explicit version,
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
3570 ;; w.r.t. remaining siblings:
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
3571 (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
3572 ;; 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
3573 (- (length (outline-chart-siblings))
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
3574 (length spec))))
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
3575 (if (< 0 residue)
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
3576 ;; 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
3577 (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
3578 spec)))))))
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
3579 ((numberp curr-elem)
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
3580 (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
3581 (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
3582 (if (> 0 curr-elem)
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
3583 nil
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
3584 (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
3585 (setq max-pos
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
3586 outline-recent-end-of-subtree)))))
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
3587 (if (> (abs curr-elem) 0)
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
3588 (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
3589 (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
3590 (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
3591 ((listp curr-elem)
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
3592 (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
3593 (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
3594 (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
3595 (cond (stay (setq stay nil))
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
3596 ((listp (car spec)) nil)
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
3597 ((> max-pos (point))
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
3598 ;; 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
3599 (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
3600 (outline-next-heading)))
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
3601 ((outline-next-sibling depth))))
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
3602 max-pos)))
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3603 ;;;_ > outline-old-expose-topic (spec &rest followers)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3604 (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
3605
7416
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
3606 "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
3607 format\) instead.
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 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
3610
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3611 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
3612 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
3613
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3614 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
3615 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
3616 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
3617 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
3618 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
3619
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3620 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
3621
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3622 - 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
3623 - 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
3624 absolute value of the number.
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3625 - 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
3626 - 0 just closes
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3627 - '*' completely opens the topic, including bodies.
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3628 - '+' shows all the sub headers, but not the bodies
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3629 - '-' exposes the body and immediate offspring of the corresponding topic.
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3630
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3631 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
3632 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
3633 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
3634 for the corresponding offspring of the topic.
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3635
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3636 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
3637
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3638 (interactive "xExposure spec: ")
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3639 (let ((depth (outline-current-depth))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3640 done
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3641 max-pos)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3642 (cond ((null spec) nil)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3643 ((symbolp spec)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3644 (if (eq spec '*) (outline-show-current-subtree))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3645 (if (eq spec '+) (outline-show-current-branches))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3646 (if (eq spec '-) (outline-show-current-entry)))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3647 ((numberp spec)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3648 (if (>= 0 spec)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3649 (save-excursion (outline-hide-current-subtree t)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3650 (end-of-line)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3651 (if (or (not max-pos)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3652 (> (point) max-pos))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3653 (setq max-pos (point)))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3654 (if (> 0 spec)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3655 (setq spec (* -1 spec)))))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3656 (if (> spec 0)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3657 (outline-show-children spec)))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3658 ((listp spec)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3659 ;(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
3660 ; (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
3661 ; (setq max-pos got)))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3662 (let ((new-depth (+ (outline-current-depth) 1))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3663 got)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3664 (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
3665 (setq spec (cdr spec))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3666 (if (and spec
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3667 (outline-descend-to-depth new-depth)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3668 (not (outline-hidden-p)))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3669 (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
3670 (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
3671 (setq max-pos got)))))))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3672 (while (and followers
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3673 (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
3674 (progn (goto-char max-pos)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3675 (setq max-pos nil)))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3676 (end-of-line)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3677 (outline-next-sibling depth)))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3678 (outline-old-expose-topic (car followers))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3679 (setq followers (cdr followers)))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3680 max-pos))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3681 ;;;_ > outline-new-exposure '()
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3682 (defmacro outline-new-exposure (&rest spec)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3683 "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
3684 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
3685 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
3686
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3687 Cursor is left at start position.
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3688
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3689 Use this instead of obsolete 'outline-exposure'.
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3690
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3691 Examples:
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3692 \(outline-exposure (-1 () () () 1) 0)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3693 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
3694 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
3695 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
3696 \(outline-exposure : -1 0)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3697 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
3698 immediate children, except for the last topic at the current
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3699 level, in which even its' immediate children are hidden.
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3700 \(outline-exposure -2 : -1 *)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3701 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
3702 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
3703 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
3704 (list 'save-excursion
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3705 '(if (not (or (outline-goto-prefix)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3706 (outline-next-heading)))
7416
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
3707 (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
3708 (list 'outline-expose-topic (list 'quote spec))))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3709 ;;;_ > outline-exposure '()
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3710 (defmacro outline-exposure (&rest spec)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3711 "Being deprecated - use more recent 'outline-new-exposure' instead.
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3712
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3713 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
3714 and retains start position."
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3715 (list 'save-excursion
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3716 '(if (not (or (outline-goto-prefix)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3717 (outline-next-heading)))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3718 (error "Can't find any outline topics."))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3719 (cons 'outline-old-expose-topic
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3720 (mapcar '(lambda (x) (list 'quote x)) spec))))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3721
7416
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
3722 ;;;_ #7 ISearch with Dynamic Exposure
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3723 ;;;_ = outline-search-reconceal
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3724 (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
3725 "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
3726
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
3727 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
3728 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
3729 ;;;_ = outline-search-quitting
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3730 (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
3731 "Distinguishes isearch conclusion and cancellation.
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
3732
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
3733 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
3734 isearch-done/outline-provisions")
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3735
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3736
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3737 ;;;_ > outline-enwrap-isearch ()
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3738 (defun outline-enwrap-isearch ()
7416
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
3739 "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
3740
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
3741 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
3742 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
3743
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3744 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
3745
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3746 ; Should isearch-mode be employed,
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3747 (if (or (not outline-enwrap-isearch-mode)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3748 ; or are preparations already done?
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3749 (fboundp 'real-isearch-terminate))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3750
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3751 ;; ... no - skip this all:
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3752 nil
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3753
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3754 ;; ... yes:
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3755
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3756 ; Ensure load of isearch-mode:
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3757 (if (or (and (fboundp 'isearch-mode)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3758 (fboundp 'isearch-quote-char))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3759 (condition-case error
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3760 (load-library outline-enwrap-isearch-mode)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3761 (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
3762 (car (cdr error))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3763 (car (cdr (cdr error))))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3764 (sit-for 1)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3765 ;; Inhibit subsequent tries and return nil:
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3766 (setq outline-enwrap-isearch-mode nil))))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3767 ;; 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
3768 ;; outline dynamic-exposure business:
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3769 (progn
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3770
7416
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
3771 ;; 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
3772 ;; names, then register wrapper functions under the old
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
3773 ;; 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
3774 (fset 'real-isearch-terminate
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3775 ; 'isearch-quit is pre v 1.2:
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3776 (or (if (fboundp 'isearch-quit)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3777 (symbol-function 'isearch-quit))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3778 (if (fboundp 'isearch-abort)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3779 ; 'isearch-abort' is v 1.2 and on:
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3780 (symbol-function 'isearch-abort))))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3781 (fset 'isearch-quit 'isearch-terminate/outline-provisions)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3782 (fset 'isearch-abort 'isearch-terminate/outline-provisions)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3783 (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
3784 (fset 'isearch-done 'isearch-done/outline-provisions)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3785 (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
3786 (fset 'isearch-update 'isearch-update/outline-provisions)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3787 (make-variable-buffer-local 'outline-search-reconceal)))))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3788 ;;;_ > outline-isearch-arrival-business ()
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3789 (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
3790 "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
3791
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
3792 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
3793 accordingly.
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3794
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3795 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
3796 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
3797 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
3798
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3799 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
3800 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
3801 restore the prior concealment state."
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3802
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3803 (if (outline-mode-p)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3804 (setq outline-search-reconceal
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3805 (if (outline-hidden-p)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3806 (save-excursion
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3807 (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
3808 ;; 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
3809 ;; to advance.
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3810 (forward-char 1))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3811 ; We'll return point or list
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3812 ; containing point, depending
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3813 ; on concealment state of
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3814 ; topic prefix.
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3815 (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
3816 ; And reveal the current
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3817 ; search target:
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3818 (outline-show-entry)))))))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3819 ;;;_ > outline-isearch-advancing-business ()
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3820 (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
3821 "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
3822
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
3823 Works according to reconceal state registration."
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3824 (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
3825 (save-excursion
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3826 (if (listp outline-search-reconceal)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3827 ;; Leave the topic visible:
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3828 (progn (goto-char (car outline-search-reconceal))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3829 (outline-hide-current-entry))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3830 ;; Rehide the entire topic:
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3831 (goto-char outline-search-reconceal)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3832 (outline-hide-current-entry-completely)))))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3833 ;;;_ > isearch-terminate/outline-provisions ()
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3834 (defun isearch-terminate/outline-provisions ()
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3835 (interactive)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3836 (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
3837 (outline-isearch-advancing-business))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3838 (let ((outline-search-quitting t)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3839 (outline-search-reconceal nil))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3840 (real-isearch-terminate)))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3841 ;;;_ > isearch-done/outline-provisions ()
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3842 (defun isearch-done/outline-provisions (&optional nopush)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3843 (interactive)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3844 (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
3845 (progn (if (and outline-search-reconceal
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3846 (not (listp outline-search-reconceal)))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3847 ;; 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
3848 ;; and any ancestors that are still concealed:
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3849 (save-excursion
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3850 (message "(exposing destination)")(sit-for 0)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3851 (outline-goto-prefix)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3852 ; There may be a closed blank
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3853 ; line between prior and
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3854 ; current topic that would be
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3855 ; missed - provide for it:
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3856 (if (not (bobp))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3857 (progn (forward-char -1) ; newline
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3858 (if (eq ?\r (preceding-char))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3859 (outline-flag-region (1- (point))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3860 (point)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3861 ?\n))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3862 (forward-char 1)))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3863 ; Goto parent
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3864 (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
3865 (outline-show-children)))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3866 (if (and (boundp 'outline-search-quitting)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3867 outline-search-quitting)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3868 nil
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3869 ; We're concluding abort:
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3870 (outline-isearch-arrival-business)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3871 (outline-show-children))))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3872 (if nopush
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3873 ;; 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
3874 (real-isearch-done nopush)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3875 (real-isearch-done)))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3876 ;;;_ > isearch-update/outline-provisions ()
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3877 (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
3878 "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
3879
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
3880 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
3881 necessary, in the course of searching."
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3882 (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
3883 ;; Just do the plain business:
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3884 (real-isearch-update)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3885
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3886 ;; Ah - provide for outline conditions:
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3887 (outline-isearch-advancing-business)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3888 (real-isearch-update)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3889 (cond (isearch-success (outline-isearch-arrival-business))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3890 ((not isearch-success) (outline-isearch-advancing-business)))))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3891
7416
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
3892 ;;;_ #8 Copying and printing
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3893
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3894 ;;;_ - Copy exposed
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3895 ;;;_ > outline-insert-listified (depth prefix bullet text)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3896 (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
3897 "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
3898 (insert-string (concat (if (> depth 1) prefix "")
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3899 (make-string (1- depth) ?\ )
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3900 bullet))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3901 (while text
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3902 (insert-string (car text))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3903 (if (setq text (cdr text))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3904 (insert-string "\n")))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3905 (insert-string "\n"))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3906 ;;;_ > outline-copy-exposed (arg &optional tobuf)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3907 (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
3908 "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
3909
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
3910 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
3911
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3912 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
3913
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3914 (interactive "P")
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3915 (if (not tobuf)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3916 (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
3917 (let* ((start-pt (point))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3918 (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
3919 (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
3920 (buf (current-buffer)))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3921 (save-excursion (set-buffer tobuf)(erase-buffer))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3922 (outline-process-exposed 'outline-insert-listified
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3923 beg
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3924 end
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3925 (current-buffer)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3926 tobuf)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3927 (goto-char (point-min))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3928 (pop-to-buffer buf)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3929 (goto-char start-pt)))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3930
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3931 ;;;_ - LaTeX formatting
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3932 ;;;_ > outline-latex-verb-quote (str &optional flow)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3933 (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
3934 "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
3935 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
3936 string across latex processing."
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3937 (mapconcat '(lambda (char)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3938 ;;;mess: (cond ((memq char '(?"" ?$ ?% ?# ?& ?- ?" ?` ?^ ?- ?*));;;"))))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3939 (cond ((memq char '(?\\ ?$ ?% ?# ?& ?{ ?} ?_ ?^ ?- ?*))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3940 (concat "\\char" (number-to-string char) "{}"))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3941 ((= char ?\n) "\\\\")
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3942 (t (char-to-string char))))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3943 str
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3944 ""))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3945 ;;;_ > outline-latex-verbatim-quote-curr-line ()
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3946 (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
3947 "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
3948
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
3949 Adjust line contents so it is unaltered \(from the original line)
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3950 across latex processing, within the context of a 'verbatim'
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3951 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
3952 (beginning-of-line)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3953 (let ((beg (point))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3954 (end (progn (end-of-line)(point))))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3955 (goto-char beg)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3956 (while (re-search-forward "\\\\"
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3957 ;;"\\\\\\|\\{\\|\\}\\|\\_\\|\\$\\|\\\"\\|\\&\\|\\^\\|\\-\\|\\*\\|#"
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3958 end ; bounded by end-of-line
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3959 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
3960 (goto-char (match-beginning 0))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3961 (insert-string "\\")
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3962 (setq end (1+ end))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3963 (goto-char (1+ (match-end 0))))))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3964 ;;;_ > outline-insert-latex-header (buf)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3965 (defun outline-insert-latex-header (buf)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3966 "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
3967 ;; 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
3968 ;; the TeXBook, pg 421.
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3969 (set-buffer buf)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3970 (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
3971 "report"))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3972 (page-numbering (if outline-number-pages
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3973 "\\pagestyle{empty}\n"
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3974 ""))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3975 (linesdef (concat "\\def\\beginlines{"
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3976 "\\par\\begingroup\\nobreak\\medskip"
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3977 "\\parindent=0pt\n"
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3978 " \\kern1pt\\nobreak \\obeylines \\obeyspaces "
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3979 "\\everypar{\\strut}}\n"
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3980 "\\def\\endlines{"
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3981 "\\kern1pt\\endgroup\\medbreak\\noindent}\n"))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3982 (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
3983 outline-title-style))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3984 (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
3985 outline-label-style))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3986 (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
3987 outline-head-line-style))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3988 (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
3989 outline-body-line-style))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3990 (setlength (format "%s%s%s%s"
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3991 "\\newlength{\\stepsize}\n"
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3992 "\\setlength{\\stepsize}{"
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3993 outline-indent
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3994 "}\n"))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3995 (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
3996 "\\newcommand{\\OneHeadLine}[3]{%\n"
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3997 "\\noindent%\n"
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3998 "\\hspace*{#2\\stepsize}%\n"
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3999 "\\labelcmd{#1}\\hspace*{.2cm}"
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4000 "\\headlinecmd{#3}\\\\["
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4001 outline-line-skip
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4002 "]\n}\n"))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4003 (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
4004 "\\newcommand{\\OneBodyLine}[2]{%\n"
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4005 "\\noindent%\n"
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4006 "\\hspace*{#1\\stepsize}%\n"
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4007 "\\bodylinecmd{#2}\\\\["
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4008 outline-line-skip
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4009 "]\n}\n"))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4010 (begindoc "\\begin{document}\n\\begin{center}\n")
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4011 (title (format "%s%s%s%s"
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4012 "\\titlecmd{"
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4013 (outline-latex-verb-quote (if outline-title
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4014 (condition-case err
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4015 (eval outline-title)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4016 (error "<unnamed buffer>"))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4017 "Unnamed Outline"))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4018 "}\n"
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4019 "\\end{center}\n\n"))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4020 (hsize "\\hsize = 7.5 true in\n")
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4021 (hoffset "\\hoffset = -1.5 true in\n")
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4022 (vspace "\\vspace{.1cm}\n\n"))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4023 (insert (concat doc-style
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4024 page-numbering
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4025 titlecmd
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4026 labelcmd
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4027 headlinecmd
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4028 bodylinecmd
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4029 setlength
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4030 oneheadline
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4031 onebodyline
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4032 begindoc
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4033 title
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4034 hsize
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4035 hoffset
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4036 vspace)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4037 )))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4038 ;;;_ > outline-insert-latex-trailer (buf)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4039 (defun outline-insert-latex-trailer (buf)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4040 "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
4041 (set-buffer buf)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4042 (insert "\n\\end{document}\n"))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4043 ;;;_ > 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
4044 (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
4045 "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
4046
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
4047 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
4048 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
4049 (let* ((head-line (if text (car text)))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4050 (body-lines (cdr text))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4051 (curr-line)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4052 body-content bop)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4053 ; Do the head line:
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4054 (insert-string (concat "\\OneHeadLine{\\verb\1 "
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4055 (outline-latex-verb-quote bullet)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4056 "\1}{"
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4057 depth
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4058 "}{\\verb\1 "
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4059 (if head-line
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4060 (outline-latex-verb-quote head-line)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4061 "")
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4062 "\1}\n"))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4063 (if (not body-lines)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4064 nil
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4065 ;;(insert-string "\\beginlines\n")
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4066 (insert-string "\\begin{verbatim}\n")
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4067 (while body-lines
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4068 (setq curr-line (car body-lines))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4069 (if (and (not body-content)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4070 (not (string-match "^\\s-*$" curr-line)))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4071 (setq body-content t))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4072 ; Mangle any occurrences of
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4073 ; "\end{verbatim}" in text,
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4074 ; it's special:
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4075 (if (and body-content
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4076 (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
4077 (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
4078 ">"
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4079 (substring curr-line bop))))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4080 ;;(insert-string "|" (car body-lines) "|")
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4081 (insert-string curr-line)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4082 (outline-latex-verbatim-quote-curr-line)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4083 (insert-string "\n")
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4084 (setq body-lines (cdr body-lines)))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4085 (if body-content
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4086 (setq body-content nil)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4087 (forward-char -1)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4088 (insert-string "\\ ")
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4089 (forward-char 1))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4090 ;;(insert-string "\\endlines\n")
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4091 (insert-string "\\end{verbatim}\n")
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4092 )))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4093 ;;;_ > outline-latexify-exposed (arg &optional tobuf)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4094 (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
4095 "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
4096 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
4097 with \"*\" prepended and \" latex-formed*\" appended.
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4098
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4099 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
4100
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4101 (interactive "P")
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4102 (if (not tobuf)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4103 (setq tobuf
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4104 (get-buffer-create (concat "*" (buffer-name) " latexified*"))))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4105 (let* ((start-pt (point))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4106 (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
4107 (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
4108 (buf (current-buffer)))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4109 (set-buffer tobuf)
3430
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4110 (erase-buffer)
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4111 (outline-insert-latex-header tobuf)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4112 (goto-char (point-max))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4113 (outline-process-exposed 'outline-latexify-one-item
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4114 beg
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4115 end
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4116 buf
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4117 tobuf)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4118 (goto-char (point-max))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4119 (outline-insert-latex-trailer tobuf)
3430
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4120 (goto-char (point-min))
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4121 (pop-to-buffer buf)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4122 (goto-char start-pt)))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4123
7416
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
4124 ;;;_ #9 miscellaneous
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4125 ;;;_ > outline-mark-topic ()
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4126 (defun outline-mark-topic ()
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4127 "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
4128 (interactive)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4129 (beginning-of-line)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4130 (outline-goto-prefix)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4131 (push-mark (point))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4132 (outline-end-of-current-subtree)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4133 (exchange-point-and-mark))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4134 ;;;_ > outlineify-sticky ()
7416
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
4135 ;; 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
4136 (defalias 'outlinify-sticky 'outlineify-sticky)
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4137 (defun outlineify-sticky (&optional arg)
7416
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
4138 "Activate outline mode and establish file var so it is started subseqently.
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
4139
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
4140 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
4141 setup for auto-startup."
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
4142
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
4143 (interactive "P")
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
4144
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
4145 (outline-mode t)
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
4146
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
4147 (save-excursion
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
4148 (goto-char (point-min))
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
4149 (if (looking-at outline-regexp)
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
4150 t
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
4151 (outline-open-topic 2)
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
4152 (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
4153 "`outline-mode' docstring for info."))
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
4154 (next-line 1)
3430
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4155 (goto-char (point-max))
7416
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
4156 (next-line 1)
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
4157 (outline-open-topic 0)
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
4158 (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
4159 (outline-open-topic 1)
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
4160 (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
4161 (outline-open-topic 0)
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
4162 (insert-string "Local variables:\n")
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
4163 (outline-open-topic 0)
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
4164 (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
4165 (or outline-layout
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
4166 '(1 : 0))))
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
4167 (outline-open-topic 0)
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
4168 (insert-string "End:\n"))))
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4169 ;;;_ > solicit-char-in-string (prompt string &optional do-defaulting)
3430
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4170 (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
4171 "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
4172
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4173 Optional arg DO-DEFAULTING indicates to accept empty input (CR)."
3430
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4174
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4175 (let ((new-prompt prompt)
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4176 got)
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4177
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4178 (while (not got)
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4179 (message "%s" new-prompt)
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4180
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4181 ;; We do our own reading here, so we can circumvent, eg, special
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4182 ;; treatment for '?' character. (Might oughta change minibuffer
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4183 ;; keymap instead, oh well.)
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4184 (setq got
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4185 (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
4186
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4187 (if (null (string-match (regexp-quote got) string))
3430
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4188 (if (and do-defaulting (string= got "\^M"))
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4189 ;; We're defaulting, return null string to indicate that:
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4190 (setq got "")
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4191 ;; Failed match and not defaulting,
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4192 ;; set the prompt to give feedback,
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4193 (setq new-prompt (concat prompt
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4194 got
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4195 " ...pick from: "
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4196 string
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4197 ""))
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4198 ;; and set loop to try again:
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4199 (setq got nil))
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4200 ;; Got a match - give feedback:
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4201 (message "")))
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4202 ;; got something out of loop - return it:
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4203 got)
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4204 )
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4205 ;;;_ > regexp-sans-escapes (string)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4206 (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
4207 "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
4208
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4209 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
4210 single backslash.
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4211
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4212 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
4213
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4214 (if (string= regexp "")
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4215 ""
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4216 ;; 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
4217 ;; backslash, or else to nil:
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4218 (setq successive-backslashes
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4219 (if (= (aref regexp 0) ?\\)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4220 (if successive-backslashes (1+ successive-backslashes) 1)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4221 nil))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4222 (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
4223 ;; Include first char:
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4224 (concat (substring regexp 0 1)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4225 (regexp-sans-escapes (substring regexp 1)))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4226 ;; Exclude first char, but maintain count:
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4227 (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
4228 ;;;_ - add-hook definition for divergent emacsen
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4229 ;;;_ > add-hook (hook function &optional append)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4230 (if (not (fboundp 'add-hook))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4231 (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
4232 "Add to the value of HOOK the function FUNCTION unless already present.
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
4233 \(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
4234 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
4235 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
4236 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
4237 (or (boundp hook) (set hook nil))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4238 (or (if (consp function)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4239 ;; 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
4240 ;; is equal to anything in the hook.
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4241 (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
4242 (equal function tail))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4243 (memq function (symbol-value hook)))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4244 (set hook
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4245 (if append
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4246 (nconc (symbol-value hook) (list function))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4247 (cons function (symbol-value hook)))))))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4248
7416
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
4249 ;;;_ #10 Under development
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4250 ;;;_ > outline-bullet-isearch (&optional bullet)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4251 (defun outline-bullet-isearch (&optional bullet)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4252 "Isearch \(regexp\) for topic with bullet BULLET."
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4253 (interactive)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4254 (if (not bullet)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4255 (setq bullet (solicit-char-in-string
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4256 "ISearch for topic with bullet: "
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4257 (regexp-sans-escapes outline-bullets-string))))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4258
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4259 (let ((isearch-regexp t)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4260 (isearch-string (concat "^"
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4261 outline-header-prefix
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4262 "[ \t]*"
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4263 bullet)))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4264 (isearch-repeat 'forward)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4265 (isearch-mode t)))
7416
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
4266 ;;;_ ? Re hooking up with isearch - use isearch-op-fun rather than
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
4267 ;;; wrapping the isearch functions.
3430
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4268
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4269 ;;;_* Local emacs vars.
7416
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
4270 ;;; 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
4271 ;;; - 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
4272 ;;; - 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
4273 ;;; - 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
4274 ;;; - 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
4275 ;;;Local variables:
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
4276 ;;;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
4277 ;;;End:
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
4278
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
4279 ;; allout.el ends here
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
4280