annotate lisp/allout.el @ 44715:dd2e1ea680ae

(auto-save-file-name-transforms): Doc string addition - no effect for MS-DOS systems without long file names. Add third element for uniquifying filenames. (make-auto-save-file-name): Make a unique filename if indicated by new element of auto-save-file-name-transforms.
author Glenn Morris <rgm@gnu.org>
date Sat, 20 Apr 2002 22:22:57 +0000
parents 015e04aba83b
children 29f1f32aee5b
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
38431
853c3674f20a Fixes to follow coding conventions.
Pavel Janík <Pavel@Janik.cz>
parents: 38250
diff changeset
1 ;;; allout.el --- extensive outline mode for use alone and with other modes
7416
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
2
36390
495ba6e137c7 (outline-flag-region): Move macro in front of first
Gerd Moellmann <gerd@gnu.org>
parents: 29490
diff changeset
3 ;; Copyright (C) 1992, 1993, 1994, 2001 Free Software Foundation, Inc.
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4
19923
b4ff95522987 Change maintainer email address.
Richard M. Stallman <rms@gnu.org>
parents: 15664
diff changeset
5 ;; Author: Ken Manheimer <klm@python.org>
b4ff95522987 Change maintainer email address.
Richard M. Stallman <rms@gnu.org>
parents: 15664
diff changeset
6 ;; Maintainer: Ken Manheimer <klm@python.org>
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
7 ;; Created: Dec 1991 - first release to usenet
44182
015e04aba83b (outline-layout): Doc fix.
Pavel Janík <Pavel@Janik.cz>
parents: 41905
diff changeset
8 ;; Version: $Id: allout.el,v 1.31 2001/12/09 13:13:13 pj Exp $||
41905
90c1cb5c072c Fix Keywords header.
Pavel Janík <Pavel@Janik.cz>
parents: 41571
diff changeset
9 ;; Keywords: outlines mode wp languages
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
14169
83f275dcd93a Update FSF's address.
Erik Naggum <erik@naggum.no>
parents: 13964
diff changeset
24 ;; along with GNU Emacs; see the file COPYING. If not, write to the
83f275dcd93a Update FSF's address.
Erik Naggum <erik@naggum.no>
parents: 13964
diff changeset
25 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
83f275dcd93a Update FSF's address.
Erik Naggum <erik@naggum.no>
parents: 13964
diff changeset
26 ;; Boston, MA 02111-1307, USA.
3430
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
27
38431
853c3674f20a Fixes to follow coding conventions.
Pavel Janík <Pavel@Janik.cz>
parents: 38250
diff changeset
28 ;;; Commentary:
7416
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
29
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
30 ;; Allout outline mode provides extensive outline formatting and
29490
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
31 ;; and manipulation beyond standard emacs outline mode. It provides
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
32 ;; for structured editing of outlines, as well as navigation and
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
33 ;; exposure. It also provides for syntax-sensitive text like
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
34 ;; programming languages. (For an example, see the allout code
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
35 ;; itself, which is organized in ;; an outline framework.)
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
36 ;;
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
37 ;; In addition to outline navigation and exposure, allout includes:
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
38 ;;
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
39 ;; - topic-oriented repositioning, cut, and paste
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
40 ;; - integral outline exposure-layout
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
41 ;; - incremental search with dynamic exposure and reconcealment of hidden text
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
42 ;; - automatic topic-number maintenance
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
43 ;; - "Hot-spot" operation, for single-keystroke maneuvering and
44182
015e04aba83b (outline-layout): Doc fix.
Pavel Janík <Pavel@Janik.cz>
parents: 41905
diff changeset
44 ;; exposure control. (See the `outline-mode' docstring.)
29490
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
45 ;;
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
46 ;; and many other features.
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
47 ;;
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
48 ;; The outline menubar additions provide quick reference to many of
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
49 ;; the features, and see the docstring of the variable `outline-init'
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
50 ;; for instructions on priming your emacs session for automatic
44182
015e04aba83b (outline-layout): Doc fix.
Pavel Janík <Pavel@Janik.cz>
parents: 41905
diff changeset
51 ;; activation of `outline-mode'.
29490
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
52 ;;
7416
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
53 ;; See the docstring of the variables `outline-layout' and
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
54 ;; `outline-auto-activation' for details on automatic activation of
44182
015e04aba83b (outline-layout): Doc fix.
Pavel Janík <Pavel@Janik.cz>
parents: 41905
diff changeset
55 ;; allout `outline-mode' as a minor mode. (It has changed since allout
7416
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
56 ;; 3.x, for those of you that depend on the old method.)
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
57 ;;
15664
a50ebf4ac764 (outline-auto-activation, outline-layout)
Karl Heuer <kwzh@gnu.org>
parents: 15663
diff changeset
58 ;; Note - the lines beginning with `;;;_' are outline topic headers.
a50ebf4ac764 (outline-auto-activation, outline-layout)
Karl Heuer <kwzh@gnu.org>
parents: 15663
diff changeset
59 ;; Just `ESC-x eval-current-buffer' to give it a whirl.
7416
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
60
29490
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
61 ;; Ken Manheimer klm@python.org
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
62
38431
853c3674f20a Fixes to follow coding conventions.
Pavel Janík <Pavel@Janik.cz>
parents: 38250
diff changeset
63 ;;; Code:
853c3674f20a Fixes to follow coding conventions.
Pavel Janík <Pavel@Janik.cz>
parents: 38250
diff changeset
64
7416
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
65 ;;;_* Provide
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
66 (provide 'outline)
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
67 (provide 'allout)
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
68
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
69 ;;;_* USER CUSTOMIZATION VARIABLES:
21088
ac1673121774 Customized.
Stephen Eglen <stephen@gnu.org>
parents: 19923
diff changeset
70 (defgroup allout nil
ac1673121774 Customized.
Stephen Eglen <stephen@gnu.org>
parents: 19923
diff changeset
71 "Extensive outline mode for use alone and with other modes."
ac1673121774 Customized.
Stephen Eglen <stephen@gnu.org>
parents: 19923
diff changeset
72 :prefix "outline-"
ac1673121774 Customized.
Stephen Eglen <stephen@gnu.org>
parents: 19923
diff changeset
73 :group 'outlines)
7416
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 ;;;_ + 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
76
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
77 ;;;_ = outline-auto-activation
29490
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
78 (defcustom outline-auto-activation nil
7416
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
79 "*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
80
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
81 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
82 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
83 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
84 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
85
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
86 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
87 \(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
88 `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
89
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
90 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
91 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
92
29490
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
93 With value `activate', only auto-mode-activation is enabled,
15664
a50ebf4ac764 (outline-auto-activation, outline-layout)
Karl Heuer <kwzh@gnu.org>
parents: 15663
diff changeset
94 auto-layout is not.
7416
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 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
97 enabled.
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
98
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
99 See the docstring for `outline-init' for the proper interface to
29490
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
100 this variable."
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
101 :type '(choice (const :tag "On" t)
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
102 (const :tag "Ask about layout" "ask")
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
103 (const :tag "Mode only" "activate")
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
104 (const :tag "Off" nil))
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
105 :group 'allout)
7416
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
106 ;;;_ = outline-layout
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
107 (defvar outline-layout nil
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
108 "*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
109
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
110 Buffer-specific.
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
111
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
112 A list value specifies a default layout for the current buffer, to be
44182
015e04aba83b (outline-layout): Doc fix.
Pavel Janík <Pavel@Janik.cz>
parents: 41905
diff changeset
113 applied upon activation of allout `outline-mode'. Any non-nil value will
015e04aba83b (outline-layout): Doc fix.
Pavel Janík <Pavel@Janik.cz>
parents: 41905
diff changeset
114 automatically trigger allout `outline-mode', provided `outline-init'
15664
a50ebf4ac764 (outline-auto-activation, outline-layout)
Karl Heuer <kwzh@gnu.org>
parents: 15663
diff changeset
115 has been called to enable it.
7416
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
116
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
117 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
118 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
119 the layout specification.
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
120
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
121 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
122 this var via the file's local variables. For example, the following
11034
27df51bcb4b0 (outline-layout): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents: 10867
diff changeset
123 lines at the bottom of an Emacs Lisp file:
7416
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
124
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
125 ;;;Local variables:
29490
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
126 ;;;outline-layout: \(0 : -1 -1 0)
7416
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
127 ;;;End:
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
128
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
129 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
130 activated when the file is visited, followed by the equivalent of
29490
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
131 `\(outline-expose-topic 0 : -1 -1 0)'. \(This is the layout used for
7416
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
132 the allout.el, itself.)
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
133
15664
a50ebf4ac764 (outline-auto-activation, outline-layout)
Karl Heuer <kwzh@gnu.org>
parents: 15663
diff changeset
134 Also, allout's mode-specific provisions will make topic prefixes default
a50ebf4ac764 (outline-auto-activation, outline-layout)
Karl Heuer <kwzh@gnu.org>
parents: 15663
diff changeset
135 to the comment-start string, if any, of the language of the file. This
a50ebf4ac764 (outline-auto-activation, outline-layout)
Karl Heuer <kwzh@gnu.org>
parents: 15663
diff changeset
136 is modulo the setting of `outline-use-mode-specific-leader', which see.")
7416
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
137 (make-variable-buffer-local 'outline-layout)
29490
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
138 ;;;_ = outline-show-bodies
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
139 (defcustom outline-show-bodies nil
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
140 "*If non-nil, show entire body when exposing a topic, rather than
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
141 just the header."
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
142 :type 'boolean
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
143 :group 'allout)
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
144 (make-variable-buffer-local 'outline-show-bodies)
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
145
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
146 ;;;_ = outline-header-prefix
21088
ac1673121774 Customized.
Stephen Eglen <stephen@gnu.org>
parents: 19923
diff changeset
147 (defcustom outline-header-prefix "."
7416
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
148 "*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
149
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
150 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
151 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
152 \(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
153 character, which is typically set to the outline-primary-bullet. Many
21088
ac1673121774 Customized.
Stephen Eglen <stephen@gnu.org>
parents: 19923
diff changeset
154 outlines start at level 2 to avoid this discrepancy."
ac1673121774 Customized.
Stephen Eglen <stephen@gnu.org>
parents: 19923
diff changeset
155 :type 'string
ac1673121774 Customized.
Stephen Eglen <stephen@gnu.org>
parents: 19923
diff changeset
156 :group 'allout)
3430
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
157 (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
158 ;;;_ = outline-primary-bullet
21088
ac1673121774 Customized.
Stephen Eglen <stephen@gnu.org>
parents: 19923
diff changeset
159 (defcustom outline-primary-bullet "*"
7416
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
160 "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
161
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
162 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
163 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
164 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
165
15664
a50ebf4ac764 (outline-auto-activation, outline-layout)
Karl Heuer <kwzh@gnu.org>
parents: 15663
diff changeset
166 The value of an asterisk (`*') provides for backwards compatibility
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
167 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
168 and outline-distinctive-bullets-string for the range of available
21088
ac1673121774 Customized.
Stephen Eglen <stephen@gnu.org>
parents: 19923
diff changeset
169 bullets."
ac1673121774 Customized.
Stephen Eglen <stephen@gnu.org>
parents: 19923
diff changeset
170 :type 'string
ac1673121774 Customized.
Stephen Eglen <stephen@gnu.org>
parents: 19923
diff changeset
171 :group 'allout)
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
172 (make-variable-buffer-local 'outline-primary-bullet)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
173 ;;;_ = outline-plain-bullets-string
29490
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
174 (defcustom outline-plain-bullets-string ".:,;"
7416
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
175 "*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
176
15664
a50ebf4ac764 (outline-auto-activation, outline-layout)
Karl Heuer <kwzh@gnu.org>
parents: 15663
diff changeset
177 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
178 bullets.
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
179
15664
a50ebf4ac764 (outline-auto-activation, outline-layout)
Karl Heuer <kwzh@gnu.org>
parents: 15663
diff changeset
180 DO NOT include the close-square-bracket, `]', as a bullet.
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
181
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
182 Outline mode has to be reactivated in order for changes to the value
21088
ac1673121774 Customized.
Stephen Eglen <stephen@gnu.org>
parents: 19923
diff changeset
183 of this var to take effect."
ac1673121774 Customized.
Stephen Eglen <stephen@gnu.org>
parents: 19923
diff changeset
184 :type 'string
ac1673121774 Customized.
Stephen Eglen <stephen@gnu.org>
parents: 19923
diff changeset
185 :group 'allout)
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
186 (make-variable-buffer-local 'outline-plain-bullets-string)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
187 ;;;_ = outline-distinctive-bullets-string
29490
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
188 (defcustom outline-distinctive-bullets-string "*+-=>([{}&!?#%\"X@$~_\\"
7416
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
189 "*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
190
29490
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
191 These bullets are used to distinguish topics from the run-of-the-mill
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
192 ones. They are not used in the standard topic headers created by
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
193 the topic-opening, shifting, and rebulleting \(eg, on topic shift,
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
194 topic paste, blanket rebulleting) routines, but are offered among the
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
195 choices for rebulleting. They are not altered by the above automatic
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
196 rebulleting, so they can be used to characterize topics, eg:
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
197
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
198 `?' question topics
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
199 `\(' parenthetic comment \(with a matching close paren inside)
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
200 `[' meta-note \(with a matching close ] inside)
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
201 `\"' a quote
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
202 `=' value settings
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
203 `~' \"more or less\"
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
204
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
205 ... just for example. (`#' typically has a special meaning to the
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
206 software, according to the value of `outline-numbered-bullet'.)
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
207
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
208 See `outline-plain-bullets-string' for the selection of
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
209 alternating bullets.
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
210
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
211 You must run `set-outline-regexp' in order for outline mode to
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
212 reconcile to changes of this value.
7416
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
213
15664
a50ebf4ac764 (outline-auto-activation, outline-layout)
Karl Heuer <kwzh@gnu.org>
parents: 15663
diff changeset
214 DO NOT include the close-square-bracket, `]', on either of the bullet
21088
ac1673121774 Customized.
Stephen Eglen <stephen@gnu.org>
parents: 19923
diff changeset
215 strings."
ac1673121774 Customized.
Stephen Eglen <stephen@gnu.org>
parents: 19923
diff changeset
216 :type 'string
ac1673121774 Customized.
Stephen Eglen <stephen@gnu.org>
parents: 19923
diff changeset
217 :group 'allout)
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
218 (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
219
7416
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
220 ;;;_ = outline-use-mode-specific-leader
21088
ac1673121774 Customized.
Stephen Eglen <stephen@gnu.org>
parents: 19923
diff changeset
221 (defcustom outline-use-mode-specific-leader t
7416
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
222 "*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
223
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
224 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
225 and/or comment-start string, if any, to lead the topic prefix string,
15664
a50ebf4ac764 (outline-auto-activation, outline-layout)
Karl Heuer <kwzh@gnu.org>
parents: 15663
diff changeset
226 so topic headers look like comments in the programming language.
7416
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
227
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
228 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
229
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
230 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
231 alist, then use comment-start string, if any, then use default \(`.').
29490
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
232 \(See note about use of comment-start strings, below.)
7416
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
233
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
234 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
235 `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
236
29490
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
237 Value `nil' means to always use the default \(`.').
7416
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
238
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
239 comment-start strings that do not end in spaces are tripled, and an
15664
a50ebf4ac764 (outline-auto-activation, outline-layout)
Karl Heuer <kwzh@gnu.org>
parents: 15663
diff changeset
240 `_' underscore is tacked on the end, to distinguish them from regular
7416
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
241 comment strings. comment-start strings that do end in spaces are not
29490
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
242 tripled, but an underscore is substituted for the space. [This
7416
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
243 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
244 can use `outline-mode-leaders' to override this behavior, when
21088
ac1673121774 Customized.
Stephen Eglen <stephen@gnu.org>
parents: 19923
diff changeset
245 incorrect.]"
ac1673121774 Customized.
Stephen Eglen <stephen@gnu.org>
parents: 19923
diff changeset
246 :type '(choice (const t) (const nil) string
ac1673121774 Customized.
Stephen Eglen <stephen@gnu.org>
parents: 19923
diff changeset
247 (const outline-mode-leaders)
ac1673121774 Customized.
Stephen Eglen <stephen@gnu.org>
parents: 19923
diff changeset
248 (const comment-start))
ac1673121774 Customized.
Stephen Eglen <stephen@gnu.org>
parents: 19923
diff changeset
249 :group 'allout)
7416
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
250 ;;;_ = outline-mode-leaders
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
251 (defvar outline-mode-leaders '()
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
252 "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
253
29490
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
254 Entries will be used instead or in lieu of mode-specific
7416
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
255 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
256
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
257 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
258 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
259 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
260 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
261
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
262 ;;;_ = outline-old-style-prefixes
21088
ac1673121774 Customized.
Stephen Eglen <stephen@gnu.org>
parents: 19923
diff changeset
263 (defcustom outline-old-style-prefixes nil
15664
a50ebf4ac764 (outline-auto-activation, outline-layout)
Karl Heuer <kwzh@gnu.org>
parents: 15663
diff changeset
264 "*When non-nil, use only old-and-crusty outline-mode `*' topic prefixes.
7416
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
265
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
266 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
267 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
268 like the original emacs-outline style 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 Whatever the setting of this variable, both old and new style prefixes
21088
ac1673121774 Customized.
Stephen Eglen <stephen@gnu.org>
parents: 19923
diff changeset
271 are always respected by the topic maneuvering functions."
ac1673121774 Customized.
Stephen Eglen <stephen@gnu.org>
parents: 19923
diff changeset
272 :type 'boolean
ac1673121774 Customized.
Stephen Eglen <stephen@gnu.org>
parents: 19923
diff changeset
273 :group 'allout)
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
274 (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
275 ;;;_ = outline-stylish-prefixes - alternating bullets
21088
ac1673121774 Customized.
Stephen Eglen <stephen@gnu.org>
parents: 19923
diff changeset
276 (defcustom outline-stylish-prefixes t
7416
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
277 "*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
278
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
279 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
280 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
281 depth) just preceding the start of the topic text) according to level.
15664
a50ebf4ac764 (outline-auto-activation, outline-layout)
Karl Heuer <kwzh@gnu.org>
parents: 15663
diff changeset
282 Otherwise, only asterisks (`*') and distinctive bullets are used.
7416
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
283
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
284 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
285 prefixes:
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
286
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
287 * Top level
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
288 .* A topic
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
289 . + One level 3 subtopic
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
290 . . One level 4 subtopic
7416
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
291 . . A second 4 subtopic
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
292 . + Another level 3 subtopic
7416
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
293 . #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
294 . #2 Another
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
295 . ! 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
296 . #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
297
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
298 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
299 numbered and other distinctive bullets retained):
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
300
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
301 * Top level
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
302 .* A topic
7416
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
303 . * One level 3 subtopic
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
304 . * One level 4 subtopic
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
305 . * A second 4 subtopic
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
306 . * Another level 3 subtopic
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
307 . #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
308 . #2 Another
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
309 . ! 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
310 . #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
311
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
312 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
313 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
314 this variable setting.
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
315
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
316 The setting of this var is not relevant when outline-old-style-prefixes
21088
ac1673121774 Customized.
Stephen Eglen <stephen@gnu.org>
parents: 19923
diff changeset
317 is non-nil."
ac1673121774 Customized.
Stephen Eglen <stephen@gnu.org>
parents: 19923
diff changeset
318 :type 'boolean
ac1673121774 Customized.
Stephen Eglen <stephen@gnu.org>
parents: 19923
diff changeset
319 :group 'allout)
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
320 (make-variable-buffer-local 'outline-stylish-prefixes)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
321
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
322 ;;;_ = outline-numbered-bullet
21088
ac1673121774 Customized.
Stephen Eglen <stephen@gnu.org>
parents: 19923
diff changeset
323 (defcustom outline-numbered-bullet "#"
7416
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
324 "*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
325
13964
4de229297f1f (outline-primary-bullet, outline-numbered-bullet,
Karl Heuer <kwzh@gnu.org>
parents: 13337
diff changeset
326 Topics having this bullet have automatic maintenance of a sibling
7416
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
327 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
328 to \"#\", you can set it to a bullet of your choice. A nil value
21088
ac1673121774 Customized.
Stephen Eglen <stephen@gnu.org>
parents: 19923
diff changeset
329 disables numbering maintenance."
ac1673121774 Customized.
Stephen Eglen <stephen@gnu.org>
parents: 19923
diff changeset
330 :type '(choice (const nil) string)
ac1673121774 Customized.
Stephen Eglen <stephen@gnu.org>
parents: 19923
diff changeset
331 :group 'allout)
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
332 (make-variable-buffer-local 'outline-numbered-bullet)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
333 ;;;_ = outline-file-xref-bullet
21088
ac1673121774 Customized.
Stephen Eglen <stephen@gnu.org>
parents: 19923
diff changeset
334 (defcustom outline-file-xref-bullet "@"
7416
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
335 "*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
336
29490
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
337 Set this var to the bullet you want to use for file cross-references."
21088
ac1673121774 Customized.
Stephen Eglen <stephen@gnu.org>
parents: 19923
diff changeset
338 :type '(choice (const nil) string)
ac1673121774 Customized.
Stephen Eglen <stephen@gnu.org>
parents: 19923
diff changeset
339 :group 'allout)
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
340
29490
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
341 ;;;_ = outline-presentation-padding
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
342 (defcustom outline-presentation-padding 2
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
343 "*Presentation-format white-space padding factor, for greater indent."
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
344 :type 'integer
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
345 :group 'allout)
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
346
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
347 (make-variable-buffer-local 'outline-presentation-padding)
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
348
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
349 ;;;_ = outline-abbreviate-flattened-numbering
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
350 (defcustom outline-abbreviate-flattened-numbering nil
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
351 "*If non-nil, `outline-flatten-exposed-to-buffer' abbreviates topic
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
352 numbers to minimal amount with some context. Otherwise, entire
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
353 numbers are always used."
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
354 :type 'boolean
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
355 :group 'allout)
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
356
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
357 ;;;_ + LaTeX formatting
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
358 ;;;_ - outline-number-pages
21088
ac1673121774 Customized.
Stephen Eglen <stephen@gnu.org>
parents: 19923
diff changeset
359 (defcustom outline-number-pages nil
ac1673121774 Customized.
Stephen Eglen <stephen@gnu.org>
parents: 19923
diff changeset
360 "*Non-nil turns on page numbering for LaTeX formatting of an outline."
ac1673121774 Customized.
Stephen Eglen <stephen@gnu.org>
parents: 19923
diff changeset
361 :type 'boolean
ac1673121774 Customized.
Stephen Eglen <stephen@gnu.org>
parents: 19923
diff changeset
362 :group 'allout)
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
363 ;;;_ - outline-label-style
21088
ac1673121774 Customized.
Stephen Eglen <stephen@gnu.org>
parents: 19923
diff changeset
364 (defcustom outline-label-style "\\large\\bf"
ac1673121774 Customized.
Stephen Eglen <stephen@gnu.org>
parents: 19923
diff changeset
365 "*Font and size of labels for LaTeX formatting of an outline."
ac1673121774 Customized.
Stephen Eglen <stephen@gnu.org>
parents: 19923
diff changeset
366 :type 'string
ac1673121774 Customized.
Stephen Eglen <stephen@gnu.org>
parents: 19923
diff changeset
367 :group 'allout)
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
368 ;;;_ - outline-head-line-style
21088
ac1673121774 Customized.
Stephen Eglen <stephen@gnu.org>
parents: 19923
diff changeset
369 (defcustom outline-head-line-style "\\large\\sl "
ac1673121774 Customized.
Stephen Eglen <stephen@gnu.org>
parents: 19923
diff changeset
370 "*Font and size of entries for LaTeX formatting of an outline."
ac1673121774 Customized.
Stephen Eglen <stephen@gnu.org>
parents: 19923
diff changeset
371 :type 'string
ac1673121774 Customized.
Stephen Eglen <stephen@gnu.org>
parents: 19923
diff changeset
372 :group 'allout)
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
373 ;;;_ - outline-body-line-style
21088
ac1673121774 Customized.
Stephen Eglen <stephen@gnu.org>
parents: 19923
diff changeset
374 (defcustom outline-body-line-style " "
ac1673121774 Customized.
Stephen Eglen <stephen@gnu.org>
parents: 19923
diff changeset
375 "*Font and size of entries for LaTeX formatting of an outline."
ac1673121774 Customized.
Stephen Eglen <stephen@gnu.org>
parents: 19923
diff changeset
376 :type 'string
ac1673121774 Customized.
Stephen Eglen <stephen@gnu.org>
parents: 19923
diff changeset
377 :group 'allout)
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
378 ;;;_ - outline-title-style
21088
ac1673121774 Customized.
Stephen Eglen <stephen@gnu.org>
parents: 19923
diff changeset
379 (defcustom outline-title-style "\\Large\\bf"
ac1673121774 Customized.
Stephen Eglen <stephen@gnu.org>
parents: 19923
diff changeset
380 "*Font and size of titles for LaTeX formatting of an outline."
ac1673121774 Customized.
Stephen Eglen <stephen@gnu.org>
parents: 19923
diff changeset
381 :type 'string
ac1673121774 Customized.
Stephen Eglen <stephen@gnu.org>
parents: 19923
diff changeset
382 :group 'allout)
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
383 ;;;_ - outline-title
21088
ac1673121774 Customized.
Stephen Eglen <stephen@gnu.org>
parents: 19923
diff changeset
384 (defcustom outline-title '(or buffer-file-name (current-buffer-name))
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
385 "*Expression to be evaluated to determine the title for LaTeX
21088
ac1673121774 Customized.
Stephen Eglen <stephen@gnu.org>
parents: 19923
diff changeset
386 formatted copy."
ac1673121774 Customized.
Stephen Eglen <stephen@gnu.org>
parents: 19923
diff changeset
387 :type 'sexp
ac1673121774 Customized.
Stephen Eglen <stephen@gnu.org>
parents: 19923
diff changeset
388 :group 'allout)
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
389 ;;;_ - outline-line-skip
21088
ac1673121774 Customized.
Stephen Eglen <stephen@gnu.org>
parents: 19923
diff changeset
390 (defcustom outline-line-skip ".05cm"
ac1673121774 Customized.
Stephen Eglen <stephen@gnu.org>
parents: 19923
diff changeset
391 "*Space between lines for LaTeX formatting of an outline."
ac1673121774 Customized.
Stephen Eglen <stephen@gnu.org>
parents: 19923
diff changeset
392 :type 'string
ac1673121774 Customized.
Stephen Eglen <stephen@gnu.org>
parents: 19923
diff changeset
393 :group 'allout)
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
394 ;;;_ - outline-indent
21088
ac1673121774 Customized.
Stephen Eglen <stephen@gnu.org>
parents: 19923
diff changeset
395 (defcustom outline-indent ".3cm"
ac1673121774 Customized.
Stephen Eglen <stephen@gnu.org>
parents: 19923
diff changeset
396 "*LaTeX formatted depth-indent spacing."
ac1673121774 Customized.
Stephen Eglen <stephen@gnu.org>
parents: 19923
diff changeset
397 :type 'string
ac1673121774 Customized.
Stephen Eglen <stephen@gnu.org>
parents: 19923
diff changeset
398 :group 'allout)
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
399
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
400 ;;;_ + Miscellaneous customization
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
401
29490
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
402 ;;;_ = outline-command-prefix
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
403 (defcustom outline-command-prefix "\C-c"
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
404 "*Key sequence to be used as prefix for outline mode command key bindings."
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
405 :type 'string
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
406 :group 'allout)
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
407
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
408 ;;;_ = outline-keybindings-list
15664
a50ebf4ac764 (outline-auto-activation, outline-layout)
Karl Heuer <kwzh@gnu.org>
parents: 15663
diff changeset
409 ;;; You have to reactivate outline-mode - `(outline-mode t)' - to
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
410 ;;; institute changes to this var.
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
411 (defvar outline-keybindings-list ()
29490
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
412 "*List of outline-mode key / function bindings, for outline-mode-map.
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
413
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
414 String or vector key will be prefaced with outline-command-prefix,
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
415 unless optional third, non-nil element is present.")
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
416 (setq outline-keybindings-list
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
417 '(
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
418 ; Motion commands:
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
419 ("\C-n" outline-next-visible-heading)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
420 ("\C-p" outline-previous-visible-heading)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
421 ("\C-u" outline-up-current-level)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
422 ("\C-f" outline-forward-current-level)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
423 ("\C-b" outline-backward-current-level)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
424 ("\C-a" outline-beginning-of-current-entry)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
425 ("\C-e" outline-end-of-current-entry)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
426 ; Exposure commands:
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
427 ("\C-i" outline-show-children)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
428 ("\C-s" outline-show-current-subtree)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
429 ("\C-h" outline-hide-current-subtree)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
430 ("\C-o" outline-show-current-entry)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
431 ("!" outline-show-all)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
432 ; Alteration commands:
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
433 (" " outline-open-sibtopic)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
434 ("." outline-open-subtopic)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
435 ("," outline-open-supertopic)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
436 ("'" outline-shift-in)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
437 (">" outline-shift-in)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
438 ("<" outline-shift-out)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
439 ("\C-m" outline-rebullet-topic)
11661
9ac485495712 (outline-rebullet-current-heading): Change to C-c *.
Karl Heuer <kwzh@gnu.org>
parents: 11034
diff changeset
440 ("*" outline-rebullet-current-heading)
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
441 ("#" outline-number-siblings)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
442 ("\C-k" outline-kill-line t)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
443 ("\C-y" outline-yank t)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
444 ("\M-y" outline-yank-pop t)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
445 ("\C-k" outline-kill-topic)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
446 ; Miscellaneous commands:
29490
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
447 ;([?\C-\ ] outline-mark-topic)
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
448 ("@" outline-resolve-xref)
29490
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
449 ("=c" outline-copy-exposed-to-buffer)
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
450 ("=i" outline-indented-exposed-to-buffer)
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
451 ("=t" outline-latexify-exposed)
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
452 ("=p" outline-flatten-exposed-to-buffer)))
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
453
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
454 ;;;_ = outline-isearch-dynamic-expose
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
455 (defcustom outline-isearch-dynamic-expose t
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
456 "*Non-nil enable dynamic exposure of hidden incremental-search
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
457 targets as they're encountered."
21088
ac1673121774 Customized.
Stephen Eglen <stephen@gnu.org>
parents: 19923
diff changeset
458 :type 'boolean
ac1673121774 Customized.
Stephen Eglen <stephen@gnu.org>
parents: 19923
diff changeset
459 :group 'allout)
29490
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
460 (make-variable-buffer-local 'outline-isearch-dynamic-expose)
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
461
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
462 ;;;_ = outline-use-hanging-indents
21088
ac1673121774 Customized.
Stephen Eglen <stephen@gnu.org>
parents: 19923
diff changeset
463 (defcustom outline-use-hanging-indents t
7416
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
464 "*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
465 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
466 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
467 where auto-fill occurs.
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
468
15664
a50ebf4ac764 (outline-auto-activation, outline-layout)
Karl Heuer <kwzh@gnu.org>
parents: 15663
diff changeset
469 \[This feature no longer depends in any way on the `filladapt.el'
21088
ac1673121774 Customized.
Stephen Eglen <stephen@gnu.org>
parents: 19923
diff changeset
470 lisp-archive package.\]"
ac1673121774 Customized.
Stephen Eglen <stephen@gnu.org>
parents: 19923
diff changeset
471 :type 'boolean
ac1673121774 Customized.
Stephen Eglen <stephen@gnu.org>
parents: 19923
diff changeset
472 :group 'allout)
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
473 (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
474
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
475 ;;;_ = outline-reindent-bodies
21088
ac1673121774 Customized.
Stephen Eglen <stephen@gnu.org>
parents: 19923
diff changeset
476 (defcustom outline-reindent-bodies (if outline-use-hanging-indents
7527
1f09079e18c4 (outline-mode): Use outline-this-or-next-heading.
Richard M. Stallman <rms@gnu.org>
parents: 7476
diff changeset
477 'text)
7416
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
478 "*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
479
7527
1f09079e18c4 (outline-mode): Use outline-this-or-next-heading.
Richard M. Stallman <rms@gnu.org>
parents: 7476
diff changeset
480 When active, topic body lines that are indented even with or beyond
1f09079e18c4 (outline-mode): Use outline-this-or-next-heading.
Richard M. Stallman <rms@gnu.org>
parents: 7476
diff changeset
481 their topic header are reindented to correspond with depth shifts of
1f09079e18c4 (outline-mode): Use outline-this-or-next-heading.
Richard M. Stallman <rms@gnu.org>
parents: 7476
diff changeset
482 the header.
1f09079e18c4 (outline-mode): Use outline-this-or-next-heading.
Richard M. Stallman <rms@gnu.org>
parents: 7476
diff changeset
483
1f09079e18c4 (outline-mode): Use outline-this-or-next-heading.
Richard M. Stallman <rms@gnu.org>
parents: 7476
diff changeset
484 A value of `t' enables reindent in non-programming-code buffers, ie
1f09079e18c4 (outline-mode): Use outline-this-or-next-heading.
Richard M. Stallman <rms@gnu.org>
parents: 7476
diff changeset
485 those that do not have the variable `comment-start' set. A value of
21088
ac1673121774 Customized.
Stephen Eglen <stephen@gnu.org>
parents: 19923
diff changeset
486 `force' enables reindent whether or not `comment-start' is set."
ac1673121774 Customized.
Stephen Eglen <stephen@gnu.org>
parents: 19923
diff changeset
487 :type '(choice (const nil) (const t) (const text) (const force))
ac1673121774 Customized.
Stephen Eglen <stephen@gnu.org>
parents: 19923
diff changeset
488 :group 'allout)
7527
1f09079e18c4 (outline-mode): Use outline-this-or-next-heading.
Richard M. Stallman <rms@gnu.org>
parents: 7476
diff changeset
489
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
490 (make-variable-buffer-local 'outline-reindent-bodies)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
491
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
492 ;;;_ = outline-inhibit-protection
21088
ac1673121774 Customized.
Stephen Eglen <stephen@gnu.org>
parents: 19923
diff changeset
493 (defcustom outline-inhibit-protection nil
7416
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
494 "*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
495
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
496 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
497 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
498 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
499
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
500 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
501 deactivate and then reactivate the mode if you want to toggle the
21088
ac1673121774 Customized.
Stephen Eglen <stephen@gnu.org>
parents: 19923
diff changeset
502 behavior."
ac1673121774 Customized.
Stephen Eglen <stephen@gnu.org>
parents: 19923
diff changeset
503 :type 'boolean
ac1673121774 Customized.
Stephen Eglen <stephen@gnu.org>
parents: 19923
diff changeset
504 :group 'allout)
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
505
7416
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
506 ;;;_* CODE - no user customizations below.
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
507
29490
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
508 ;;;_ #1 Internal Outline Formatting and Configuration
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
509 ;;;_ : Version
7416
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
510 ;;;_ = outline-version
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
511 (defvar outline-version
44182
015e04aba83b (outline-layout): Doc fix.
Pavel Janík <Pavel@Janik.cz>
parents: 41905
diff changeset
512 (let ((rcs-rev "$Revision: 1.31 $"))
7416
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
513 (condition-case err
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
514 (save-match-data
7527
1f09079e18c4 (outline-mode): Use outline-this-or-next-heading.
Richard M. Stallman <rms@gnu.org>
parents: 7476
diff changeset
515 (string-match "Revision: \\([0-9]+\\.[0-9]+\\)" rcs-rev)
7416
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
516 (substring rcs-rev (match-beginning 1) (match-end 1)))
29490
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
517 ('error rcs-rev)))
7527
1f09079e18c4 (outline-mode): Use outline-this-or-next-heading.
Richard M. Stallman <rms@gnu.org>
parents: 7476
diff changeset
518 "Revision number of currently loaded outline package. \(allout.el)")
7416
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
519 ;;;_ > outline-version
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
520 (defun outline-version (&optional here)
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
521 "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
522 (interactive "P")
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
523 (let ((msg (concat "Allout Outline Mode v " outline-version)))
41571
2902b21d2034 (outline-version, outline-open-topic)
Pavel Janík <Pavel@Janik.cz>
parents: 38431
diff changeset
524 (if here (insert msg))
7416
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
525 (message "%s" msg)
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
526 msg))
29490
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
527 ;;;_ : Topic header format
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
528 ;;;_ = outline-regexp
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
529 (defvar outline-regexp ""
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
530 "*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
531
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
532 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
533 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
534 by set-outline-regexp.")
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
535 (make-variable-buffer-local 'outline-regexp)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
536 ;;;_ = outline-bullets-string
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
537 (defvar outline-bullets-string ""
7416
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
538 "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
539
15664
a50ebf4ac764 (outline-auto-activation, outline-layout)
Karl Heuer <kwzh@gnu.org>
parents: 15663
diff changeset
540 This var should *not* be set by the user - it is set by `set-outline-regexp',
a50ebf4ac764 (outline-auto-activation, outline-layout)
Karl Heuer <kwzh@gnu.org>
parents: 15663
diff changeset
541 and is produced from the elements of `outline-plain-bullets-string'
a50ebf4ac764 (outline-auto-activation, outline-layout)
Karl Heuer <kwzh@gnu.org>
parents: 15663
diff changeset
542 and `outline-distinctive-bullets-string'.")
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
543 (make-variable-buffer-local 'outline-bullets-string)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
544 ;;;_ = outline-bullets-string-len
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
545 (defvar outline-bullets-string-len 0
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
546 "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
547 (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
548 ;;;_ = outline-line-boundary-regexp
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
549 (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
550 "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
551
7639
67b7d1ea7b2e Doc fix.
Richard M. Stallman <rms@gnu.org>
parents: 7527
diff changeset
552 \(Ie, C-j, *or* C-m, for prefixes of hidden topics). This is properly
15664
a50ebf4ac764 (outline-auto-activation, outline-layout)
Karl Heuer <kwzh@gnu.org>
parents: 15663
diff changeset
553 set when outline-regexp is produced by `set-outline-regexp', so
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
554 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
555 (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
556 ;;;_ = outline-bob-regexp
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
557 (defvar outline-bob-regexp ()
7416
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
558 "Like outline-line-boundary-regexp, for headers at beginning of buffer.
29490
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
559 \(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
560 (make-variable-buffer-local 'outline-bob-regexp)
3430
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
561 ;;;_ = outline-header-subtraction
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
562 (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
563 "Outline-header prefix length to subtract when computing topic depth.")
3430
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
564 (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
565 ;;;_ = outline-plain-bullets-string-len
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
566 (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
567 "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
568 (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
569
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
570
7527
1f09079e18c4 (outline-mode): Use outline-this-or-next-heading.
Richard M. Stallman <rms@gnu.org>
parents: 7476
diff changeset
571 ;;;_ X outline-reset-header-lead (header-lead)
3430
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
572 (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
573 "*Reset the leading string used to identify topic headers."
3430
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
574 (interactive "sNew lead string: ")
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
575 (setq outline-header-prefix header-lead)
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
576 (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
577 (set-outline-regexp))
7527
1f09079e18c4 (outline-mode): Use outline-this-or-next-heading.
Richard M. Stallman <rms@gnu.org>
parents: 7476
diff changeset
578 ;;;_ X outline-lead-with-comment-string (header-lead)
3430
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
579 (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
580 "*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
581
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
582 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
583 language comments. Returns the leading string."
3430
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
584
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
585 (interactive "P")
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
586 (if (not (stringp header-lead))
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
587 (setq header-lead (read-string
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
588 "String prefix for topic headers: ")))
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
589 (setq outline-reindent-bodies nil)
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
590 (outline-reset-header-lead header-lead)
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
591 header-lead)
7527
1f09079e18c4 (outline-mode): Use outline-this-or-next-heading.
Richard M. Stallman <rms@gnu.org>
parents: 7476
diff changeset
592 ;;;_ > outline-infer-header-lead ()
1f09079e18c4 (outline-mode): Use outline-this-or-next-heading.
Richard M. Stallman <rms@gnu.org>
parents: 7476
diff changeset
593 (defun outline-infer-header-lead ()
7416
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
594 "Determine appropriate `outline-header-prefix'.
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
595
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
596 Works according to settings of:
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
597
7527
1f09079e18c4 (outline-mode): Use outline-this-or-next-heading.
Richard M. Stallman <rms@gnu.org>
parents: 7476
diff changeset
598 `comment-start'
7416
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
599 `outline-header-prefix' (default)
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
600 `outline-use-mode-specific-leader'
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
601 and `outline-mode-leaders'.
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
602
29490
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
603 Apply this via \(re)activation of `outline-mode', rather than
7527
1f09079e18c4 (outline-mode): Use outline-this-or-next-heading.
Richard M. Stallman <rms@gnu.org>
parents: 7476
diff changeset
604 invoking it directly."
7416
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
605 (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
606 (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
607 (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
608 '(outline-mode-leaders
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
609 comment-start
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
610 t)))
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
611 outline-use-mode-specific-leader
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
612 ;; 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
613 t)))
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
614 (leader
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
615 (cond
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
616 ((not use-leader) nil)
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
617 ;; Use the explicitly designated leader:
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
618 ((stringp use-leader) use-leader)
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
619 (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
620 ;; 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
621 (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
622 ;; ... 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
623 (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
624 comment-start
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
625 ;; Use comment-start, maybe tripled, and with
15664
a50ebf4ac764 (outline-auto-activation, outline-layout)
Karl Heuer <kwzh@gnu.org>
parents: 15663
diff changeset
626 ;; underscore:
7416
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
627 (concat
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
628 (if (string= " "
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
629 (substring comment-start
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
630 (1- (length comment-start))))
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
631 ;; 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
632 (substring comment-start 0 -1)
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
633 (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
634 ;; ... and append underscore, whichever:
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
635 "_")))))))
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
636 (if (not leader)
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
637 nil
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
638 (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
639 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
640 (setq outline-header-prefix leader)
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
641 outline-header-prefix))))
7527
1f09079e18c4 (outline-mode): Use outline-this-or-next-heading.
Richard M. Stallman <rms@gnu.org>
parents: 7476
diff changeset
642 ;;;_ > outline-infer-body-reindent ()
1f09079e18c4 (outline-mode): Use outline-this-or-next-heading.
Richard M. Stallman <rms@gnu.org>
parents: 7476
diff changeset
643 (defun outline-infer-body-reindent ()
1f09079e18c4 (outline-mode): Use outline-this-or-next-heading.
Richard M. Stallman <rms@gnu.org>
parents: 7476
diff changeset
644 "Determine proper setting for `outline-reindent-bodies'.
1f09079e18c4 (outline-mode): Use outline-this-or-next-heading.
Richard M. Stallman <rms@gnu.org>
parents: 7476
diff changeset
645
1f09079e18c4 (outline-mode): Use outline-this-or-next-heading.
Richard M. Stallman <rms@gnu.org>
parents: 7476
diff changeset
646 Depends on default setting of `outline-reindent-bodies' \(which see)
1f09079e18c4 (outline-mode): Use outline-this-or-next-heading.
Richard M. Stallman <rms@gnu.org>
parents: 7476
diff changeset
647 and presence of setting for `comment-start', to tell whether the
1f09079e18c4 (outline-mode): Use outline-this-or-next-heading.
Richard M. Stallman <rms@gnu.org>
parents: 7476
diff changeset
648 file is programming code."
1f09079e18c4 (outline-mode): Use outline-this-or-next-heading.
Richard M. Stallman <rms@gnu.org>
parents: 7476
diff changeset
649 (if (and outline-reindent-bodies
1f09079e18c4 (outline-mode): Use outline-this-or-next-heading.
Richard M. Stallman <rms@gnu.org>
parents: 7476
diff changeset
650 comment-start
1f09079e18c4 (outline-mode): Use outline-this-or-next-heading.
Richard M. Stallman <rms@gnu.org>
parents: 7476
diff changeset
651 (not (eq 'force outline-reindent-bodies)))
1f09079e18c4 (outline-mode): Use outline-this-or-next-heading.
Richard M. Stallman <rms@gnu.org>
parents: 7476
diff changeset
652 (setq outline-reindent-bodies nil)))
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
653 ;;;_ > set-outline-regexp ()
3430
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
654 (defun set-outline-regexp ()
7416
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
655 "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
656
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
657 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
658 `outline-distinctive-bullets-string'."
3430
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
659
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
660 (interactive)
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
661 ;; Derive outline-bullets-string from user configured components:
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
662 (setq outline-bullets-string "")
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
663 (let ((strings (list 'outline-plain-bullets-string
29490
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
664 'outline-distinctive-bullets-string
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
665 'outline-primary-bullet))
3430
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
666 cur-string
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
667 cur-len
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
668 cur-char
3430
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
669 cur-char-string
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
670 index
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
671 new-string)
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
672 (while strings
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
673 (setq new-string "") (setq index 0)
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
674 (setq cur-len (length (setq cur-string (symbol-value (car strings)))))
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
675 (while (< index cur-len)
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
676 (setq cur-char (aref cur-string index))
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
677 (setq outline-bullets-string
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
678 (concat outline-bullets-string
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
679 (cond
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
680 ; Single dash would denote a
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
681 ; sequence, repeated denotes
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
682 ; a dash:
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
683 ((eq cur-char ?-) "--")
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
684 ; literal close-square-bracket
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
685 ; doesn't work right in the
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
686 ; expr, exclude it:
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
687 ((eq cur-char ?\]) "")
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
688 (t (regexp-quote (char-to-string cur-char))))))
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
689 (setq index (1+ index)))
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
690 (setq strings (cdr strings)))
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
691 )
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
692 ;; Derive next for repeated use in outline-pending-bullet:
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
693 (setq outline-plain-bullets-string-len (length outline-plain-bullets-string))
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
694 (setq outline-header-subtraction (1- (length outline-header-prefix)))
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
695 ;; Produce the new outline-regexp:
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
696 (setq outline-regexp (concat "\\(\\"
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
697 outline-header-prefix
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
698 "[ \t]*["
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
699 outline-bullets-string
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
700 "]\\)\\|\\"
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
701 outline-primary-bullet
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
702 "+\\|\^l"))
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
703 (setq outline-line-boundary-regexp
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
704 (concat "\\([\n\r]\\)\\(" outline-regexp "\\)"))
3430
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
705 (setq outline-bob-regexp
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
706 (concat "\\(\\`\\)\\(" outline-regexp "\\)"))
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
707 )
29490
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
708 ;;;_ : Key bindings
7416
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
709 ;;;_ = outline-mode-map
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
710 (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
711 ;;;_ > 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
712 (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
713 "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
714
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
715 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
716 See doc string for outline-keybindings-list for format of binding list."
29490
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
717 (let ((map (or base-map (make-sparse-keymap)))
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
718 (pref (list outline-command-prefix)))
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
719 (mapcar (function
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
720 (lambda (cell)
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
721 (let ((add-pref (null (cdr (cdr cell))))
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
722 (key-suff (list (car cell))))
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
723 (apply 'define-key
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
724 (list map
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
725 (apply 'concat (if add-pref
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
726 (append pref key-suff)
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
727 key-suff))
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
728 (car (cdr cell)))))))
7416
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
729 keymap-list)
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
730 map))
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
731 ;;;_ = outline-prior-bindings - being deprecated.
15664
a50ebf4ac764 (outline-auto-activation, outline-layout)
Karl Heuer <kwzh@gnu.org>
parents: 15663
diff changeset
732 (defvar outline-prior-bindings nil
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
733 "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
734 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
735 activation. Being deprecated.")
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
736 ;;;_ = outline-added-bindings - being deprecated
15664
a50ebf4ac764 (outline-auto-activation, outline-layout)
Karl Heuer <kwzh@gnu.org>
parents: 15663
diff changeset
737 (defvar outline-added-bindings nil
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
738 "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
739 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
740 activation. Being deprecated.")
29490
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
741 ;;;_ : Menu bar
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
742 (defun produce-outline-mode-menubar-entries ()
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
743 (require 'easymenu)
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
744 (easy-menu-define outline-mode-exposure-menu
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
745 outline-mode-map
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
746 "Allout outline exposure menu."
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
747 '("Exposure"
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
748 ["Show Entry" outline-show-current-entry t]
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
749 ["Show Children" outline-show-children t]
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
750 ["Show Subtree" outline-show-current-subtree t]
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
751 ["Hide Subtree" outline-hide-current-subtree t]
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
752 ["Hide Leaves" outline-hide-current-leaves t]
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
753 "----"
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
754 ["Show All" outline-show-all t]))
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
755 (easy-menu-define outline-mode-editing-menu
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
756 outline-mode-map
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
757 "Allout outline editing menu."
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
758 '("Headings"
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
759 ["Open Sibling" outline-open-sibtopic t]
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
760 ["Open Subtopic" outline-open-subtopic t]
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
761 ["Open Supertopic" outline-open-supertopic t]
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
762 "----"
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
763 ["Shift Topic In" outline-shift-in t]
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
764 ["Shift Topic Out" outline-shift-out t]
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
765 ["Rebullet Topic" outline-rebullet-topic t]
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
766 ["Rebullet Heading" outline-rebullet-current-heading t]
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
767 ["Number Siblings" outline-number-siblings t]))
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
768 (easy-menu-define outline-mode-navigation-menu
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
769 outline-mode-map
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
770 "Allout outline navigation menu."
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
771 '("Navigation"
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
772 ["Next Visible Heading" outline-next-visible-heading t]
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
773 ["Previous Visible Heading"
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
774 outline-previous-visible-heading t]
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
775 "----"
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
776 ["Up Level" outline-up-current-level t]
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
777 ["Forward Current Level" outline-forward-current-level t]
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
778 ["Backward Current Level"
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
779 outline-backward-current-level t]
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
780 "----"
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
781 ["Beginning of Entry"
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
782 outline-beginning-of-current-entry t]
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
783 ["End of Entry" outline-end-of-current-entry t]
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
784 ["End of Subtree" outline-end-of-current-subtree t]))
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
785 (easy-menu-define outline-mode-misc-menu
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
786 outline-mode-map
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
787 "Allout outlines miscellaneous bindings."
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
788 '("Misc"
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
789 ["Version" outline-version t]
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
790 "----"
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
791 ["Duplicate Exposed" outline-copy-exposed-to-buffer t]
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
792 ["Duplicate Exposed, numbered"
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
793 outline-flatten-exposed-to-buffer t]
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
794 ["Duplicate Exposed, indented"
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
795 outline-indented-exposed-to-buffer t]
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
796 "----"
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
797 ["Set Header Lead" outline-reset-header-lead t]
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
798 ["Set New Exposure" outline-expose-topic t])))
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
799 ;;;_ : Mode-Specific Variable Maintenance Utilities
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
800 ;;;_ = outline-mode-prior-settings
3430
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
801 (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
802 "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
803 (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
804 ;;;_ > outline-resumptions (name &optional value)
3430
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
805 (defun outline-resumptions (name &optional value)
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
806
7416
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
807 "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
808
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
809 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
810 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
811 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
812 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
813 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
814 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
815 from the list."
3430
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
816
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
817 (let ((on-list (assq name outline-mode-prior-settings))
15664
a50ebf4ac764 (outline-auto-activation, outline-layout)
Karl Heuer <kwzh@gnu.org>
parents: 15663
diff changeset
818 prior-capsule ; By `capsule' i mean a list
3430
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
819 ; containing a value, so we can
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
820 ; distinguish nil from no value.
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
821 )
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
822
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
823 (if value
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
824
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
825 ;; Registering:
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
826 (progn
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
827 (if on-list
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
828 nil ; Already preserved prior value - don't mess with it.
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
829 ;; Register the old value, or nil if previously unbound:
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
830 (setq outline-mode-prior-settings
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
831 (cons (list name
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
832 (if (boundp name) (list (symbol-value name))))
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
833 outline-mode-prior-settings)))
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
834 ; And impose the new value, locally:
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
835 (progn (make-local-variable name)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
836 (set name (car value))))
3430
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
837
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
838 ;; Relinquishing:
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
839 (if (not on-list)
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
840
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
841 ;; Oops, not registered - leave it be:
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
842 nil
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
843
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
844 ;; Some registration:
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
845 ; reestablish it:
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
846 (setq prior-capsule (car (cdr on-list)))
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
847 (if prior-capsule
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
848 (set name (car prior-capsule)) ; Some prior value - reestablish it.
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
849 (makunbound name)) ; Previously unbound - demolish var.
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
850 ; Remove registration:
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
851 (let (rebuild)
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
852 (while outline-mode-prior-settings
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
853 (if (not (eq (car outline-mode-prior-settings)
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
854 on-list))
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
855 (setq rebuild
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
856 (cons (car outline-mode-prior-settings)
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
857 rebuild)))
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
858 (setq outline-mode-prior-settings
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
859 (cdr outline-mode-prior-settings)))
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
860 (setq outline-mode-prior-settings rebuild)))))
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
861 )
29490
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
862 ;;;_ : Mode-specific incidentals
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
863 ;;;_ = outline-during-write-cue nil
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
864 (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
865 "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
866
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
867 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
868 `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
869 functions.")
29490
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
870 ;;;_ = outline-pre-was-isearching nil
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
871 (defvar outline-pre-was-isearching nil
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
872 "Cue for isearch-dynamic-exposure mechanism, implemented in
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
873 outline-pre- and -post-command-hooks.")
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
874 (make-variable-buffer-local 'outline-pre-was-isearching)
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
875 ;;;_ = outline-isearch-prior-pos nil
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
876 (defvar outline-isearch-prior-pos nil
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
877 "Cue for isearch-dynamic-exposure tracking, used by outline-isearch-expose.")
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
878 (make-variable-buffer-local 'outline-isearch-prior-pos)
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
879 ;;;_ = outline-isearch-did-quit
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
880 (defvar outline-isearch-did-quit nil
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
881 "Distinguishes isearch conclusion and cancellation.
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
882
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
883 Maintained by outline-isearch-abort \(which is wrapped around the real
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
884 isearch-abort), and monitored by outline-isearch-expose for action.")
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
885 (make-variable-buffer-local 'outline-isearch-did-quit)
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
886 ;;;_ = outline-override-protect nil
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
887 (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
888 "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
889
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
890 Allout outline mode regulates alteration of concealed text to protect
13964
4de229297f1f (outline-primary-bullet, outline-numbered-bullet,
Karl Heuer <kwzh@gnu.org>
parents: 13337
diff changeset
891 against inadvertent, unnoticed changes. This is for use by specific,
7416
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
892 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
893 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
894 (make-variable-buffer-local 'outline-override-protect)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
895 ;;;_ > outline-unprotected (expr)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
896 (defmacro outline-unprotected (expr)
29490
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
897 "Evaluate EXPRESSION with `outline-override-protect' let-bound `t'."
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
898 `(let ((outline-override-protect t))
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
899 ,expr))
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
900 ;;;_ = outline-undo-aggregation
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
901 (defvar outline-undo-aggregation 30
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
902 "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
903
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
904 This is purely a kludge variable, regulating the compensation for a bug in
29490
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
905 the way that before-change-functions and undo interact.")
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
906 (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
907 ;;;_ = file-var-bug hack
29490
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
908 (defvar outline-v18/19-file-var-hack nil
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
909 "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
910 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
911 to track repeats.")
7416
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
912 ;;;_ > outline-write-file-hook ()
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
913 (defun outline-write-file-hook ()
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
914 "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
915
15664
a50ebf4ac764 (outline-auto-activation, outline-layout)
Karl Heuer <kwzh@gnu.org>
parents: 15663
diff changeset
916 Currently just sets `outline-during-write-cue', so outline-change-protection
a50ebf4ac764 (outline-auto-activation, outline-layout)
Karl Heuer <kwzh@gnu.org>
parents: 15663
diff changeset
917 knows to keep inactive during file write."
7416
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
918 (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
919 nil)
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
920
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
921 ;;;_ #2 Mode activation
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
922 ;;;_ = outline-mode
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
923 (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
924 (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
925 ;;;_ > outline-mode-p ()
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
926 (defmacro outline-mode-p ()
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
927 "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
928 'outline-mode)
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
929 ;;;_ = outline-explicitly-deactivated
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
930 (defvar outline-explicitly-deactivated nil
13964
4de229297f1f (outline-primary-bullet, outline-numbered-bullet,
Karl Heuer <kwzh@gnu.org>
parents: 13337
diff changeset
931 "Outline-mode was last deliberately deactivated.
7416
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
932 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
933 (make-variable-buffer-local 'outline-explicitly-deactivated)
7527
1f09079e18c4 (outline-mode): Use outline-this-or-next-heading.
Richard M. Stallman <rms@gnu.org>
parents: 7476
diff changeset
934 ;;;_ > outline-init (&optional mode)
1f09079e18c4 (outline-mode): Use outline-this-or-next-heading.
Richard M. Stallman <rms@gnu.org>
parents: 7476
diff changeset
935 (defun outline-init (&optional mode)
7416
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
936 "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
937
7527
1f09079e18c4 (outline-mode): Use outline-this-or-next-heading.
Richard M. Stallman <rms@gnu.org>
parents: 7476
diff changeset
938 MODE is one of the following symbols:
1f09079e18c4 (outline-mode): Use outline-this-or-next-heading.
Richard M. Stallman <rms@gnu.org>
parents: 7476
diff changeset
939
15664
a50ebf4ac764 (outline-auto-activation, outline-layout)
Karl Heuer <kwzh@gnu.org>
parents: 15663
diff changeset
940 - nil \(or no argument) deactivate auto-activation/layout;
a50ebf4ac764 (outline-auto-activation, outline-layout)
Karl Heuer <kwzh@gnu.org>
parents: 15663
diff changeset
941 - `activate', enable auto-activation only;
a50ebf4ac764 (outline-auto-activation, outline-layout)
Karl Heuer <kwzh@gnu.org>
parents: 15663
diff changeset
942 - `ask', enable auto-activation, and enable auto-layout but with
13964
4de229297f1f (outline-primary-bullet, outline-numbered-bullet,
Karl Heuer <kwzh@gnu.org>
parents: 13337
diff changeset
943 confirmation for layout operation solicited from user each time;
15664
a50ebf4ac764 (outline-auto-activation, outline-layout)
Karl Heuer <kwzh@gnu.org>
parents: 15663
diff changeset
944 - `report', just report and return the current auto-activation state;
7527
1f09079e18c4 (outline-mode): Use outline-this-or-next-heading.
Richard M. Stallman <rms@gnu.org>
parents: 7476
diff changeset
945 - anything else \(eg, t) for auto-activation and auto-layout, without
1f09079e18c4 (outline-mode): Use outline-this-or-next-heading.
Richard M. Stallman <rms@gnu.org>
parents: 7476
diff changeset
946 any confirmation check.
7416
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
947
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
948 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
949 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
950 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
951 `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
952
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
953 `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
954 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
955 setting.
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
956
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
957 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
958 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
959
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
960 \(require 'allout)
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
961 \(outline-init t)"
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
962
7527
1f09079e18c4 (outline-mode): Use outline-this-or-next-heading.
Richard M. Stallman <rms@gnu.org>
parents: 7476
diff changeset
963 (interactive)
1f09079e18c4 (outline-mode): Use outline-this-or-next-heading.
Richard M. Stallman <rms@gnu.org>
parents: 7476
diff changeset
964 (if (interactive-p)
7416
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
965 (progn
7527
1f09079e18c4 (outline-mode): Use outline-this-or-next-heading.
Richard M. Stallman <rms@gnu.org>
parents: 7476
diff changeset
966 (setq mode
1f09079e18c4 (outline-mode): Use outline-this-or-next-heading.
Richard M. Stallman <rms@gnu.org>
parents: 7476
diff changeset
967 (completing-read
1f09079e18c4 (outline-mode): Use outline-this-or-next-heading.
Richard M. Stallman <rms@gnu.org>
parents: 7476
diff changeset
968 (concat "Select outline auto setup mode "
1f09079e18c4 (outline-mode): Use outline-this-or-next-heading.
Richard M. Stallman <rms@gnu.org>
parents: 7476
diff changeset
969 "(empty for report, ? for options) ")
1f09079e18c4 (outline-mode): Use outline-this-or-next-heading.
Richard M. Stallman <rms@gnu.org>
parents: 7476
diff changeset
970 '(("nil")("full")("activate")("deactivate")
1f09079e18c4 (outline-mode): Use outline-this-or-next-heading.
Richard M. Stallman <rms@gnu.org>
parents: 7476
diff changeset
971 ("ask") ("report") (""))
1f09079e18c4 (outline-mode): Use outline-this-or-next-heading.
Richard M. Stallman <rms@gnu.org>
parents: 7476
diff changeset
972 nil
1f09079e18c4 (outline-mode): Use outline-this-or-next-heading.
Richard M. Stallman <rms@gnu.org>
parents: 7476
diff changeset
973 t))
1f09079e18c4 (outline-mode): Use outline-this-or-next-heading.
Richard M. Stallman <rms@gnu.org>
parents: 7476
diff changeset
974 (if (string= mode "")
1f09079e18c4 (outline-mode): Use outline-this-or-next-heading.
Richard M. Stallman <rms@gnu.org>
parents: 7476
diff changeset
975 (setq mode 'report)
1f09079e18c4 (outline-mode): Use outline-this-or-next-heading.
Richard M. Stallman <rms@gnu.org>
parents: 7476
diff changeset
976 (setq mode (intern-soft mode)))))
1f09079e18c4 (outline-mode): Use outline-this-or-next-heading.
Richard M. Stallman <rms@gnu.org>
parents: 7476
diff changeset
977 (let
1f09079e18c4 (outline-mode): Use outline-this-or-next-heading.
Richard M. Stallman <rms@gnu.org>
parents: 7476
diff changeset
978 ;; convenience aliases, for consistent ref to respective vars:
1f09079e18c4 (outline-mode): Use outline-this-or-next-heading.
Richard M. Stallman <rms@gnu.org>
parents: 7476
diff changeset
979 ((hook 'outline-find-file-hook)
1f09079e18c4 (outline-mode): Use outline-this-or-next-heading.
Richard M. Stallman <rms@gnu.org>
parents: 7476
diff changeset
980 (curr-mode 'outline-auto-activation))
15664
a50ebf4ac764 (outline-auto-activation, outline-layout)
Karl Heuer <kwzh@gnu.org>
parents: 15663
diff changeset
981
7527
1f09079e18c4 (outline-mode): Use outline-this-or-next-heading.
Richard M. Stallman <rms@gnu.org>
parents: 7476
diff changeset
982 (cond ((not mode)
1f09079e18c4 (outline-mode): Use outline-this-or-next-heading.
Richard M. Stallman <rms@gnu.org>
parents: 7476
diff changeset
983 (setq find-file-hooks (delq hook find-file-hooks))
1f09079e18c4 (outline-mode): Use outline-this-or-next-heading.
Richard M. Stallman <rms@gnu.org>
parents: 7476
diff changeset
984 (if (interactive-p)
1f09079e18c4 (outline-mode): Use outline-this-or-next-heading.
Richard M. Stallman <rms@gnu.org>
parents: 7476
diff changeset
985 (message "Allout outline mode auto-activation inhibited.")))
1f09079e18c4 (outline-mode): Use outline-this-or-next-heading.
Richard M. Stallman <rms@gnu.org>
parents: 7476
diff changeset
986 ((eq mode 'report)
1f09079e18c4 (outline-mode): Use outline-this-or-next-heading.
Richard M. Stallman <rms@gnu.org>
parents: 7476
diff changeset
987 (if (not (memq hook find-file-hooks))
1f09079e18c4 (outline-mode): Use outline-this-or-next-heading.
Richard M. Stallman <rms@gnu.org>
parents: 7476
diff changeset
988 (outline-init nil)
1f09079e18c4 (outline-mode): Use outline-this-or-next-heading.
Richard M. Stallman <rms@gnu.org>
parents: 7476
diff changeset
989 ;; Just punt and use the reports from each of the modes:
1f09079e18c4 (outline-mode): Use outline-this-or-next-heading.
Richard M. Stallman <rms@gnu.org>
parents: 7476
diff changeset
990 (outline-init (symbol-value curr-mode))))
1f09079e18c4 (outline-mode): Use outline-this-or-next-heading.
Richard M. Stallman <rms@gnu.org>
parents: 7476
diff changeset
991 (t (add-hook 'find-file-hooks hook)
15664
a50ebf4ac764 (outline-auto-activation, outline-layout)
Karl Heuer <kwzh@gnu.org>
parents: 15663
diff changeset
992 (set curr-mode ; `set', not `setq'!
7527
1f09079e18c4 (outline-mode): Use outline-this-or-next-heading.
Richard M. Stallman <rms@gnu.org>
parents: 7476
diff changeset
993 (cond ((eq mode 'activate)
1f09079e18c4 (outline-mode): Use outline-this-or-next-heading.
Richard M. Stallman <rms@gnu.org>
parents: 7476
diff changeset
994 (message
1f09079e18c4 (outline-mode): Use outline-this-or-next-heading.
Richard M. Stallman <rms@gnu.org>
parents: 7476
diff changeset
995 "Outline mode auto-activation enabled.")
1f09079e18c4 (outline-mode): Use outline-this-or-next-heading.
Richard M. Stallman <rms@gnu.org>
parents: 7476
diff changeset
996 'activate)
1f09079e18c4 (outline-mode): Use outline-this-or-next-heading.
Richard M. Stallman <rms@gnu.org>
parents: 7476
diff changeset
997 ((eq mode 'report)
1f09079e18c4 (outline-mode): Use outline-this-or-next-heading.
Richard M. Stallman <rms@gnu.org>
parents: 7476
diff changeset
998 ;; Return the current mode setting:
1f09079e18c4 (outline-mode): Use outline-this-or-next-heading.
Richard M. Stallman <rms@gnu.org>
parents: 7476
diff changeset
999 (outline-init mode))
1f09079e18c4 (outline-mode): Use outline-this-or-next-heading.
Richard M. Stallman <rms@gnu.org>
parents: 7476
diff changeset
1000 ((eq mode 'ask)
1f09079e18c4 (outline-mode): Use outline-this-or-next-heading.
Richard M. Stallman <rms@gnu.org>
parents: 7476
diff changeset
1001 (message
1f09079e18c4 (outline-mode): Use outline-this-or-next-heading.
Richard M. Stallman <rms@gnu.org>
parents: 7476
diff changeset
1002 (concat "Outline mode auto-activation and "
1f09079e18c4 (outline-mode): Use outline-this-or-next-heading.
Richard M. Stallman <rms@gnu.org>
parents: 7476
diff changeset
1003 "-layout \(upon confirmation) enabled."))
1f09079e18c4 (outline-mode): Use outline-this-or-next-heading.
Richard M. Stallman <rms@gnu.org>
parents: 7476
diff changeset
1004 'ask)
1f09079e18c4 (outline-mode): Use outline-this-or-next-heading.
Richard M. Stallman <rms@gnu.org>
parents: 7476
diff changeset
1005 ((message
1f09079e18c4 (outline-mode): Use outline-this-or-next-heading.
Richard M. Stallman <rms@gnu.org>
parents: 7476
diff changeset
1006 "Outline mode auto-activation and -layout enabled.")
1f09079e18c4 (outline-mode): Use outline-this-or-next-heading.
Richard M. Stallman <rms@gnu.org>
parents: 7476
diff changeset
1007 'full)))))))
29490
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
1008
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
1009 ;;;_ > outline-setup-menubar ()
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
1010 (defun outline-setup-menubar ()
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
1011 "Populate the current buffer's menubar with allout outline-mode stuff."
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
1012 (let ((menus (list outline-mode-exposure-menu
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
1013 outline-mode-editing-menu
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
1014 outline-mode-navigation-menu
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
1015 outline-mode-misc-menu))
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
1016 cur)
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
1017 (while menus
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
1018 (setq cur (car menus)
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
1019 menus (cdr menus))
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
1020 (easy-menu-add cur))))
7416
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1021 ;;;_ > outline-mode (&optional toggle)
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1022 ;;;_ : Defun:
3430
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1023 (defun outline-mode (&optional toggle)
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1024 ;;;_ . Doc string:
7416
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1025 "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
1026
29490
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
1027 Optional arg forces mode to re-initialize iff arg is positive num or
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
1028 symbol. Allout outline mode always runs as a minor mode.
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
1029
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
1030 Allout outline mode provides extensive outline-oriented formatting and
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
1031 manipulation. It enables structural editing of outlines, as well as
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
1032 navigation and exposure. It also is specifically aimed at
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
1033 accommodating syntax-sensitive text like programming languages. \(For
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
1034 an example, see the allout code itself, which is organized as an allout
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
1035 outline.)
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
1036
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
1037 In addition to outline navigation and exposure, allout includes:
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
1038
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
1039 - topic-oriented repositioning, cut, and paste
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
1040 - integral outline exposure-layout
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
1041 - incremental search with dynamic exposure and reconcealment of hidden text
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
1042 - automatic topic-number maintenance
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
1043 - \"Hot-spot\" operation, for single-keystroke maneuvering and
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
1044 exposure control. \(See the outline-mode docstring.)
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
1045
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
1046 and many other features.
7416
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1047
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1048 Below is a description of the bindings, and then explanation of
29490
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
1049 special outline-mode features and terminology. See also the outline
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
1050 menubar additions for quick reference to many of the features, and see
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
1051 the docstring of the variable `outline-init' for instructions on
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
1052 priming your emacs session for automatic activation of outline-mode.
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
1053
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
1054
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
1055 The bindings are dictated by the `outline-keybindings-list' and
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
1056 `outline-command-prefix' variables.
7416
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1057
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1058 Navigation: Exposure Control:
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1059 ---------- ----------------
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1060 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
1061 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
1062 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
1063 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
1064 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
1065 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
1066 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
1067
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1068 Topic Header Production:
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1069 -----------------------
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1070 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
1071 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
1072 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
1073
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1074 Topic Level and Prefix Adjustment:
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1075 ---------------------------------
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1076 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
1077 C-c < outline-shift-out ... less deep.
15664
a50ebf4ac764 (outline-auto-activation, outline-layout)
Karl Heuer <kwzh@gnu.org>
parents: 15663
diff changeset
1078 C-c<CR> outline-rebullet-topic Reconcile bullets of topic and its offspring
7416
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1079 - 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
1080 alternated according to nesting depth.
29490
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
1081 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
1082 current topic.
3430
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1083 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
1084 offspring are not affected. With repeat
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1085 count, revoke numbering.
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1086
7416
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1087 Topic-oriented Killing and Yanking:
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1088 ----------------------------------
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1089 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
1090 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
1091 C-y outline-yank Yank, adjusting depth of yanked topic to
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1092 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
1093 heading (ie, prefix sans text).
3430
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1094 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
1095
7416
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1096 Misc commands:
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1097 -------------
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1098 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
1099 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
1100 for `outline-layout'.
29490
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
1101 C-c C-SPC outline-mark-topic
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
1102 C-c = c outline-copy-exposed-to-buffer
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
1103 Duplicate outline, sans concealed text, to
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
1104 buffer with name derived from derived from
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
1105 that of current buffer - \"*XXX exposed*\".
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
1106 C-c = p outline-flatten-exposed-to-buffer
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
1107 Like above 'copy-exposed', but convert topic
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
1108 prefixes to section.subsection... numeric
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
1109 format.
7416
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1110 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
1111 auto-activation.
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1112
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1113 HOT-SPOT Operation
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1114
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1115 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
1116 navigation and exposure control.
3430
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1117
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1118 \\<outline-mode-map>
7416
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1119 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
1120 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
1121 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
1122 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
1123 \(\\[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
1124
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1125 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
1126 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
1127 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
1128 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
1129 operation.
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1130
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1131 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
1132 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
1133 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
1134 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
1135
7416
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1136 Terminology
3430
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1137
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1138 Topic hierarchy constituents - TOPICS and SUBTOPICS:
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1139
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1140 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
1141 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
1142 CURRENT topic:
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1143 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
1144 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
1145 containment. Also called the:
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1146 LEVEL: The same as DEPTH.
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1147
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1148 ANCESTORS:
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1149 The topics that contain a topic.
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1150 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
1151 the topic.
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1152 OFFSPRING:
7416
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1153 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
1154 SUBTOPIC:
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1155 An immediate offspring of a topic;
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1156 CHILDREN:
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1157 The immediate offspring of a topic.
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1158 SIBLINGS:
7416
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1159 Topics having the same parent and depth.
15664
a50ebf4ac764 (outline-auto-activation, outline-layout)
Karl Heuer <kwzh@gnu.org>
parents: 15663
diff changeset
1160
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1161 Topic text constituents:
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1162
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1163 HEADER: The first line of a topic, include the topic PREFIX and header
15664
a50ebf4ac764 (outline-auto-activation, outline-layout)
Karl Heuer <kwzh@gnu.org>
parents: 15663
diff changeset
1164 text.
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1165 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
1166 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
1167 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
1168 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
1169 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
1170
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1171 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
1172 of the topic.
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1173 PREFIX-LEAD:
15664
a50ebf4ac764 (outline-auto-activation, outline-layout)
Karl Heuer <kwzh@gnu.org>
parents: 15663
diff changeset
1174 The string at the beginning of a topic prefix, normally a `.'.
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1175 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
1176 `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
1177
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1178 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
1179 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
1180 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
1181 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
1182 docstring for more detail.
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1183 PREFIX-PADDING:
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1184 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
1185 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
1186 BULLET: A character at the end of the topic prefix, it must be one of
15664
a50ebf4ac764 (outline-auto-activation, outline-layout)
Karl Heuer <kwzh@gnu.org>
parents: 15663
diff changeset
1187 the characters listed on `outline-plain-bullets-string' or
a50ebf4ac764 (outline-auto-activation, outline-layout)
Karl Heuer <kwzh@gnu.org>
parents: 15663
diff changeset
1188 `outline-distinctive-bullets-string'. (See the documentation
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1189 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
1190 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
1191 topic.
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1192 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
1193 BODY: Same as ENTRY.
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1194
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1195
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1196 EXPOSURE:
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1197 The state of a topic which determines the on-screen visibility
15664
a50ebf4ac764 (outline-auto-activation, outline-layout)
Karl Heuer <kwzh@gnu.org>
parents: 15663
diff changeset
1198 of its offspring and contained text.
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1199 CONCEALED:
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1200 Topics and entry text whose display is inhibited. Contiguous
15664
a50ebf4ac764 (outline-auto-activation, outline-layout)
Karl Heuer <kwzh@gnu.org>
parents: 15663
diff changeset
1201 units of concealed text is represented by `...' ellipses.
a50ebf4ac764 (outline-auto-activation, outline-layout)
Karl Heuer <kwzh@gnu.org>
parents: 15663
diff changeset
1202 (Ref the `selective-display' var.)
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1203
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1204 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
1205 CLOSED: A topic whose immediate offspring and body-text is concealed.
15664
a50ebf4ac764 (outline-auto-activation, outline-layout)
Karl Heuer <kwzh@gnu.org>
parents: 15663
diff changeset
1206 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
1207 ;;;_ . Code
3430
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1208 (interactive "P")
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1209
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1210 (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
1211 (outline-mode-p)))
15664
a50ebf4ac764 (outline-auto-activation, outline-layout)
Karl Heuer <kwzh@gnu.org>
parents: 15663
diff changeset
1212 ; Massage universal-arg `toggle' val:
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1213 (toggle (and toggle
7416
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1214 (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
1215 toggle)))
13964
4de229297f1f (outline-primary-bullet, outline-numbered-bullet,
Karl Heuer <kwzh@gnu.org>
parents: 13337
diff changeset
1216 ; Activation specifically demanded?
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1217 (explicit-activation (or
7416
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1218 ;;
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1219 (and toggle
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1220 (or (symbolp toggle)
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1221 (and (natnump toggle)
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1222 (not (zerop toggle)))))))
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1223 ;; outline-mode already called once during this complex command?
29490
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
1224 (same-complex-command (eq outline-v18/19-file-var-hack
7416
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1225 (car command-history)))
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1226 do-layout
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1227 )
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1228
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1229 ; See comments below re v19.18,.19 bug.
29490
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
1230 (setq outline-v18/19-file-var-hack (car command-history))
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1231
3430
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1232 (cond
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1233
7416
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1234 ;; 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
1235 ;; 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
1236 ;; 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
1237 ;; 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
1238 ;; skip everything.
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1239 ((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
1240 ; 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
1241 active ; Already activated.
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1242 (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
1243 (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
1244 emacs-version)); 19.19.
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1245 t)
15664
a50ebf4ac764 (outline-auto-activation, outline-layout)
Karl Heuer <kwzh@gnu.org>
parents: 15663
diff changeset
1246
7416
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1247 ;; Deactivation:
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1248 ((and (not explicit-activation)
7416
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1249 (or active toggle))
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1250 ; Activation not explicitly
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1251 ; requested, and either in
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1252 ; active state or *de*activation
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1253 ; specifically requested:
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1254 (setq outline-explicitly-deactivated t)
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1255 (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
1256 ; Revoke those keys that remain
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1257 ; as we set them:
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1258 (let ((curr-loc (current-local-map)))
29490
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
1259 (mapcar (function
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
1260 (lambda (cell)
7416
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1261 (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
1262 (car (cdr cell)))
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1263 (define-key curr-loc (car cell)
29490
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
1264 (assq (car cell) outline-prior-bindings)))))
7416
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1265 outline-added-bindings)
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1266 (outline-resumptions 'outline-added-bindings)
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1267 (outline-resumptions 'outline-prior-bindings)))
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1268
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1269 (if outline-old-style-prefixes
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1270 (progn
7416
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1271 (outline-resumptions 'outline-primary-bullet)
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1272 (outline-resumptions 'outline-old-style-prefixes)))
3430
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1273 (outline-resumptions 'selective-display)
29490
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
1274 (if (and (boundp 'before-change-functions) before-change-functions)
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
1275 (outline-resumptions 'before-change-functions))
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1276 (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
1277 (delq 'outline-write-file-hook
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1278 local-write-file-hooks))
3430
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1279 (outline-resumptions 'paragraph-start)
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1280 (outline-resumptions 'paragraph-separate)
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1281 (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
1282 'auto-fill-hook
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1283 'auto-fill-function))
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1284 (outline-resumptions 'outline-former-auto-filler)
3430
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1285 (setq outline-mode nil))
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1286
7416
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1287 ;; Activation:
3430
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1288 ((not active)
7416
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1289 (setq outline-explicitly-deactivated nil)
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1290 (if outline-old-style-prefixes
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1291 (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
1292 (outline-resumptions 'outline-primary-bullet '("*"))
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1293 (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
1294
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1295 (outline-infer-header-lead)
7527
1f09079e18c4 (outline-mode): Use outline-this-or-next-heading.
Richard M. Stallman <rms@gnu.org>
parents: 7476
diff changeset
1296 (outline-infer-body-reindent)
7416
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1297
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1298 (set-outline-regexp)
7416
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1299
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1300 ; Produce map from current version
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1301 ; of outline-keybindings-list:
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1302 (if (boundp 'minor-mode-map-alist)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1303
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1304 (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
1305 ; epoch, minor-mode key bindings:
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1306 (setq outline-mode-map
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1307 (produce-outline-mode-map outline-keybindings-list))
29490
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
1308 (produce-outline-mode-menubar-entries)
7416
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1309 (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
1310 ; 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
1311 ; if not already there:
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1312 (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
1313 minor-mode-map-alist))
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1314 (setq minor-mode-map-alist
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1315 (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
1316 minor-mode-map-alist))))
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1317
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1318 ; V18 minor-mode key bindings:
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1319 ; Stash record of added bindings
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1320 ; for later revocation:
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1321 (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
1322 (list outline-keybindings-list))
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1323 (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
1324 (list (current-local-map)))
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1325 ; and add them:
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1326 (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
1327 (current-local-map)))
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1328 )
15664
a50ebf4ac764 (outline-auto-activation, outline-layout)
Karl Heuer <kwzh@gnu.org>
parents: 15663
diff changeset
1329
7416
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1330 ; selective-display is the
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1331 ; emacs conditional exposure
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1332 ; mechanism:
3430
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1333 (outline-resumptions 'selective-display '(t))
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1334 (if outline-inhibit-protection
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1335 t
29490
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
1336 (outline-resumptions 'before-change-functions
7416
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1337 '(outline-before-change-protect)))
29490
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
1338 (add-hook 'pre-command-hook 'outline-pre-command-business)
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
1339 (add-hook 'post-command-hook 'outline-post-command-business)
7416
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1340 ; Temporarily set by any outline
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1341 ; 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
1342 ; deal properly with concealed text.
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1343 (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
1344 ; 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
1345 ; respect for topic headline,
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1346 ; hanging-indents, etc:
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1347 (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
1348 'auto-fill-hook
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1349 'auto-fill-function))
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1350 (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
1351 ;; 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
1352 (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
1353 ;; 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
1354 (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
1355 ;; Paragraphs are broken by topic headlines.
3430
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1356 (make-local-variable 'paragraph-start)
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1357 (outline-resumptions 'paragraph-start
29490
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
1358 (list (concat paragraph-start "\\|^\\("
7416
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1359 outline-regexp "\\)")))
3430
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1360 (make-local-variable 'paragraph-separate)
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1361 (outline-resumptions 'paragraph-separate
29490
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
1362 (list (concat paragraph-separate "\\|^\\("
7416
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1363 outline-regexp "\\)")))
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1364
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1365 (or (assq 'outline-mode minor-mode-alist)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1366 (setq minor-mode-alist
7416
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1367 (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
1368
29490
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
1369 (outline-setup-menubar)
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
1370
7416
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1371 (if outline-layout
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1372 (setq do-layout t))
3430
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1373
29490
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
1374 (if (and outline-isearch-dynamic-expose
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
1375 (not (fboundp 'outline-real-isearch-abort)))
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1376 (outline-enwrap-isearch))
7416
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1377
3430
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1378 (run-hooks 'outline-mode-hook)
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1379 (setq outline-mode t))
7416
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1380
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1381 ;; Reactivation:
7527
1f09079e18c4 (outline-mode): Use outline-this-or-next-heading.
Richard M. Stallman <rms@gnu.org>
parents: 7476
diff changeset
1382 ((setq do-layout t)
1f09079e18c4 (outline-mode): Use outline-this-or-next-heading.
Richard M. Stallman <rms@gnu.org>
parents: 7476
diff changeset
1383 (outline-infer-body-reindent))
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1384 ) ; cond
7416
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1385
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1386 (if (and do-layout
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1387 outline-auto-activation
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1388 (listp outline-layout)
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1389 (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
1390 (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
1391 (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
1392 (buffer-name)
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1393 outline-layout))
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1394 t
7527
1f09079e18c4 (outline-mode): Use outline-this-or-next-heading.
Richard M. Stallman <rms@gnu.org>
parents: 7476
diff changeset
1395 (message "Skipped %s layout." (buffer-name))
7416
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1396 nil)
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1397 t)))
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1398 (save-excursion
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1399 (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
1400 (goto-char 0)
7527
1f09079e18c4 (outline-mode): Use outline-this-or-next-heading.
Richard M. Stallman <rms@gnu.org>
parents: 7476
diff changeset
1401 (outline-this-or-next-heading)
1f09079e18c4 (outline-mode): Use outline-this-or-next-heading.
Richard M. Stallman <rms@gnu.org>
parents: 7476
diff changeset
1402 (condition-case err
15664
a50ebf4ac764 (outline-auto-activation, outline-layout)
Karl Heuer <kwzh@gnu.org>
parents: 15663
diff changeset
1403 (progn
7527
1f09079e18c4 (outline-mode): Use outline-this-or-next-heading.
Richard M. Stallman <rms@gnu.org>
parents: 7476
diff changeset
1404 (apply 'outline-expose-topic (list outline-layout))
1f09079e18c4 (outline-mode): Use outline-this-or-next-heading.
Richard M. Stallman <rms@gnu.org>
parents: 7476
diff changeset
1405 (message "Adjusting '%s' exposure... done." (buffer-name)))
1f09079e18c4 (outline-mode): Use outline-this-or-next-heading.
Richard M. Stallman <rms@gnu.org>
parents: 7476
diff changeset
1406 ;; Problem applying exposure - notify user, but don't
1f09079e18c4 (outline-mode): Use outline-this-or-next-heading.
Richard M. Stallman <rms@gnu.org>
parents: 7476
diff changeset
1407 ;; interrupt, eg, file visit:
1f09079e18c4 (outline-mode): Use outline-this-or-next-heading.
Richard M. Stallman <rms@gnu.org>
parents: 7476
diff changeset
1408 (error (message "%s" (car (cdr err)))
1f09079e18c4 (outline-mode): Use outline-this-or-next-heading.
Richard M. Stallman <rms@gnu.org>
parents: 7476
diff changeset
1409 (sit-for 1)))))
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1410 outline-mode
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1411 ) ; let*
7416
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1412 ) ; defun
29490
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
1413 ;;;_ > outline-minor-mode
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
1414 ;;; XXX released verion doesn't do this?
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
1415 (defalias 'outline-minor-mode 'outline-mode)
7416
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1416
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1417 ;;;_ #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
1418 ;;; 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
1419 ;;; 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
1420 ;;; `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
1421 ;;; 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
1422 ;;; 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
1423 ;;; 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
1424 ;;; 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
1425 ;;;_ = outline-recent-prefix-beginning
3430
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1426 (defvar outline-recent-prefix-beginning 0
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1427 "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
1428 (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
1429 ;;;_ = outline-recent-prefix-end
3430
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1430 (defvar outline-recent-prefix-end 0
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1431 "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
1432 (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
1433 ;;;_ = outline-recent-end-of-subtree
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1434 (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
1435 "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
1436 (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
1437 ;;;_ > outline-prefix-data (beg end)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1438 (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
1439 "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
1440
15664
a50ebf4ac764 (outline-auto-activation, outline-layout)
Karl Heuer <kwzh@gnu.org>
parents: 15663
diff changeset
1441 For reference by `outline-recent' funcs. Returns BEGINNING."
29490
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
1442 `(setq outline-recent-prefix-end ,end
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
1443 outline-recent-prefix-beginning ,beg))
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1444 ;;;_ > outline-recent-depth ()
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1445 (defmacro outline-recent-depth ()
7416
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1446 "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
1447
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1448 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
1449 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
1450 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
1451 to return the current depth."
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1452
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1453 '(max 1 (- outline-recent-prefix-end
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1454 outline-recent-prefix-beginning
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1455 outline-header-subtraction)))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1456 ;;;_ > outline-recent-prefix ()
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1457 (defmacro outline-recent-prefix ()
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1458 "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
1459
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1460 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
1461 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
1462 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
1463 to return the current depth."
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1464 '(buffer-substring outline-recent-prefix-beginning
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1465 outline-recent-prefix-end))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1466 ;;;_ > outline-recent-bullet ()
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1467 (defmacro outline-recent-bullet ()
7416
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1468 "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
1469
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1470 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
1471 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
1472 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
1473 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
1474 '(buffer-substring (1- outline-recent-prefix-end)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1475 outline-recent-prefix-end))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1476
7416
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1477 ;;;_ #4 Navigation
7218
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 ;;;_ - Position Assessment
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1480 ;;;_ : Location Predicates
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1481 ;;;_ > outline-on-current-heading-p ()
3430
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1482 (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
1483 "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
1484
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1485 Actually, returns prefix beginning point."
3430
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1486 (save-excursion
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1487 (beginning-of-line)
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1488 (and (looking-at outline-regexp)
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1489 (outline-prefix-data (match-beginning 0) (match-end 0)))))
29490
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
1490 ;;;_ > outline-on-heading-p ()
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
1491 (defalias 'outline-on-heading-p 'outline-on-current-heading-p)
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1492 ;;;_ > outline-e-o-prefix-p ()
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1493 (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
1494 "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
1495 (and (save-excursion (beginning-of-line)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1496 (looking-at outline-regexp))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1497 (= (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
1498 ;;;_ > outline-hidden-p ()
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1499 (defmacro outline-hidden-p ()
3430
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1500 "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
1501 '(save-excursion
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1502 (and (re-search-backward "[\n\r]" () t)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1503 (= ?\r (following-char)))))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1504 ;;;_ > outline-visible-p ()
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1505 (defmacro outline-visible-p ()
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1506 "True if point is not in hidden text."
3430
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1507 (interactive)
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1508 '(not (outline-hidden-p)))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1509 ;;;_ : Location attributes
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1510 ;;;_ > outline-depth ()
29490
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
1511 (defsubst outline-depth ()
7416
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1512 "Like outline-current-depth, but respects hidden as well as visible topics."
29490
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
1513 (save-excursion
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
1514 (if (outline-goto-prefix)
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
1515 (outline-recent-depth)
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
1516 (progn
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
1517 ;; Oops, no prefix, zero prefix data:
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
1518 (outline-prefix-data (point)(point))
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
1519 ;; ... and return 0:
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
1520 0))))
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1521 ;;;_ > outline-current-depth ()
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1522 (defmacro outline-current-depth ()
7416
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1523 "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
1524 '(save-excursion
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1525 (if (outline-back-to-current-heading)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1526 (max 1
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1527 (- outline-recent-prefix-end
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1528 outline-recent-prefix-beginning
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1529 outline-header-subtraction))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1530 0)))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1531 ;;;_ > outline-get-current-prefix ()
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1532 (defun outline-get-current-prefix ()
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1533 "Topic prefix of the current topic."
3430
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1534 (save-excursion
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1535 (if (outline-goto-prefix)
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1536 (outline-recent-prefix))))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1537 ;;;_ > outline-get-bullet ()
3430
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1538 (defun outline-get-bullet ()
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1539 "Return bullet of containing topic (visible or not)."
3430
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1540 (save-excursion
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1541 (and (outline-goto-prefix)
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1542 (outline-recent-bullet))))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1543 ;;;_ > outline-current-bullet ()
3430
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1544 (defun outline-current-bullet ()
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1545 "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
1546 (condition-case err
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1547 (save-excursion
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1548 (outline-back-to-current-heading)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1549 (buffer-substring (- outline-recent-prefix-end 1)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1550 outline-recent-prefix-end))
3430
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1551 ;; Quick and dirty provision, ostensibly for missing bullet:
29490
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
1552 ('args-out-of-range nil))
3430
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1553 )
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1554 ;;;_ > outline-get-prefix-bullet (prefix)
3430
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1555 (defun outline-get-prefix-bullet (prefix)
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1556 "Return the bullet of the header prefix string PREFIX."
3430
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1557 ;; 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
1558 ;; oughtn't be called then, so forget about it...
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1559 (if (string-match outline-regexp prefix)
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1560 (substring prefix (1- (match-end 0)) (match-end 0))))
29490
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
1561 ;;;_ > outline-sibling-index (&optional depth)
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
1562 (defun outline-sibling-index (&optional depth)
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
1563 "Item number of this prospective topic among its siblings.
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
1564
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
1565 If optional arg depth is greater than current depth, then we're
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
1566 opening a new level, and return 0.
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
1567
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
1568 If less than this depth, ascend to that depth and count..."
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
1569
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
1570 (save-excursion
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
1571 (cond ((and depth (<= depth 0) 0))
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
1572 ((or (not depth) (= depth (outline-depth)))
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
1573 (let ((index 1))
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
1574 (while (outline-previous-sibling (outline-recent-depth) nil)
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
1575 (setq index (1+ index)))
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
1576 index))
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
1577 ((< depth (outline-recent-depth))
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
1578 (outline-ascend-to-depth depth)
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
1579 (outline-sibling-index))
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
1580 (0))))
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
1581 ;;;_ > outline-topic-flat-index ()
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
1582 (defun outline-topic-flat-index ()
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
1583 "Return a list indicating point's numeric section.subsect.subsubsect...
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
1584 Outermost is first."
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
1585 (let* ((depth (outline-depth))
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
1586 (next-index (outline-sibling-index depth))
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
1587 (rev-sibls nil))
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
1588 (while (> next-index 0)
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
1589 (setq rev-sibls (cons next-index rev-sibls))
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
1590 (setq depth (1- depth))
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
1591 (setq next-index (outline-sibling-index depth)))
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
1592 rev-sibls)
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
1593 )
3430
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1594
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1595 ;;;_ - Navigation macros
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1596 ;;;_ > outline-next-heading ()
29490
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
1597 (defsubst outline-next-heading ()
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1598 "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
1599
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1600 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
1601
29490
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
1602 (if (and (bobp) (not (eobp)))
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1603 (forward-char 1))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1604
29490
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
1605 (if (re-search-forward outline-line-boundary-regexp nil 0)
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
1606 (outline-prefix-data ; Got valid location state - set vars:
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
1607 (goto-char (or (match-beginning 2)
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
1608 outline-recent-prefix-beginning))
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
1609 (or (match-end 2) outline-recent-prefix-end))))
7527
1f09079e18c4 (outline-mode): Use outline-this-or-next-heading.
Richard M. Stallman <rms@gnu.org>
parents: 7476
diff changeset
1610 ;;;_ : outline-this-or-next-heading
1f09079e18c4 (outline-mode): Use outline-this-or-next-heading.
Richard M. Stallman <rms@gnu.org>
parents: 7476
diff changeset
1611 (defun outline-this-or-next-heading ()
1f09079e18c4 (outline-mode): Use outline-this-or-next-heading.
Richard M. Stallman <rms@gnu.org>
parents: 7476
diff changeset
1612 "Position cursor on current or next heading."
1f09079e18c4 (outline-mode): Use outline-this-or-next-heading.
Richard M. Stallman <rms@gnu.org>
parents: 7476
diff changeset
1613 ;; A throwaway non-macro that is defined after outline-next-heading
1f09079e18c4 (outline-mode): Use outline-this-or-next-heading.
Richard M. Stallman <rms@gnu.org>
parents: 7476
diff changeset
1614 ;; and usable by outline-mode.
1f09079e18c4 (outline-mode): Use outline-this-or-next-heading.
Richard M. Stallman <rms@gnu.org>
parents: 7476
diff changeset
1615 (if (not (outline-goto-prefix)) (outline-next-heading)))
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1616 ;;;_ > outline-previous-heading ()
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1617 (defmacro outline-previous-heading ()
7416
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1618 "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
1619
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1620 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
1621
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1622 '(if (bobp)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1623 nil
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1624 (outline-goto-prefix)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1625 (if
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1626 ;; 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
1627 (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
1628 (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
1629 (progn ; Got valid location state - set vars:
15664
a50ebf4ac764 (outline-auto-activation, outline-layout)
Karl Heuer <kwzh@gnu.org>
parents: 15663
diff changeset
1630 (outline-prefix-data
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1631 (goto-char (or (match-beginning 2)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1632 outline-recent-prefix-beginning))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1633 (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
1634
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1635 ;;;_ - Subtree Charting
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1636 ;;;_ " 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
1637 ;;; 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
1638 ;;;
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1639 ;;; 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
1640 ;;; 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
1641 ;;; out the subtopic locations. The chart then serves as the basis
29490
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
1642 ;;; for assessment or adjustment of the subtree, without redundant
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
1643 ;;; traversal of the structure.
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1644
7416
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1645 ;;;_ > 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
1646 (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
1647 "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
1648
13964
4de229297f1f (outline-primary-bullet, outline-numbered-bullet,
Karl Heuer <kwzh@gnu.org>
parents: 13337
diff changeset
1649 Optional argument LEVELS specifies the depth \(relative to start
29490
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
1650 depth) for the chart. Subsequent optional args are not for public
7416
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1651 use.
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1652
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1653 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
1654 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
1655 for their elaborate manipulations.
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1656
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1657 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
1658 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
1659 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
1660 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
1661 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
1662 itself.
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1663
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1664 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
1665 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
1666 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
1667
15664
a50ebf4ac764 (outline-auto-activation, outline-layout)
Karl Heuer <kwzh@gnu.org>
parents: 15663
diff changeset
1668 (let ((original (not orig-depth)) ; `orig-depth' set only in recursion.
7416
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1669 chart curr-depth)
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1670
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1671 (if original ; Just starting?
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1672 ; Register initial settings and
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1673 ; position to first offspring:
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1674 (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
1675 (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
1676 (outline-next-heading)))
7416
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1677
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1678 ;; 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
1679 ;; 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
1680 ;; the typically quite constrained emacs max-lisp-eval-depth.
29490
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
1681 ;;
7416
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1682 ;; 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
1683 ;; operation rather than recursing for lower levels. Bah.
29490
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
1684
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1685 (while (and (not (eobp))
7416
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1686 ; Still within original topic?
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1687 (< 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
1688 (cond ((= prev-depth curr-depth)
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1689 ;; 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
1690 (setq chart (cons (point) chart))
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1691 (if (and levels (<= levels 1))
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1692 ;; At depth limit - skip sublevels:
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1693 (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
1694 ;; 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
1695 ;; next heading at lesser depth:
7676
5b8a573e9f69 (outline-chart-subtree): Include outline-next-heading in loop conditions
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
1696 (while (and (<= curr-depth
5b8a573e9f69 (outline-chart-subtree): Include outline-next-heading in loop conditions
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
1697 (outline-recent-depth))
5b8a573e9f69 (outline-chart-subtree): Include outline-next-heading in loop conditions
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
1698 (outline-next-heading))))
7416
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1699 (outline-next-heading)))
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1700
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1701 ((and (< prev-depth curr-depth)
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1702 (or (not levels)
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1703 (> levels 0)))
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1704 ;; 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
1705 (setq chart
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1706 (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
1707 (1- levels))
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1708 orig-depth
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1709 curr-depth)
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1710 chart))
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1711 ;; ... then continue with this one.
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1712 )
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1713
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1714 ;; ... 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
1715
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1716 )))
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 (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
1719 ; the original level. Position
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1720 ; to the end of it:
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1721 (progn (and (not (eobp)) (forward-char -1))
29490
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
1722 (and (memq (preceding-char) '(?\n ?\r))
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1723 (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
1724 (point))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1725 1)
29490
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
1726 '(?\n ?\r))
7416
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1727 (forward-char -1))
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1728 (setq outline-recent-end-of-subtree (point))))
15664
a50ebf4ac764 (outline-auto-activation, outline-layout)
Karl Heuer <kwzh@gnu.org>
parents: 15663
diff changeset
1729
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1730 chart ; (nreverse chart) not necessary,
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1731 ; and maybe not preferable.
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1732 ))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1733 ;;;_ > outline-chart-siblings (&optional start end)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1734 (defun outline-chart-siblings (&optional start end)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1735 "Produce a list of locations of this and succeeding sibling topics.
15664
a50ebf4ac764 (outline-auto-activation, outline-layout)
Karl Heuer <kwzh@gnu.org>
parents: 15663
diff changeset
1736 Effectively a top-level chart of siblings. See `outline-chart-subtree'
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1737 for an explanation of charts."
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1738 (save-excursion
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1739 (if (outline-goto-prefix)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1740 (let ((chart (list (point))))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1741 (while (outline-next-sibling)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1742 (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
1743 (if chart (setq chart (nreverse chart)))))))
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1744 ;;;_ > outline-chart-to-reveal (chart depth)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1745 (defun outline-chart-to-reveal (chart depth)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1746
7416
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1747 "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
1748
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1749 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
1750 start point."
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1751
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1752 (let (result here)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1753 (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
1754 chart)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1755 (setq here (car chart))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1756 (if (listp here)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1757 (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
1758 (1- depth)))))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1759 ;; 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
1760 ;; more depth to go:
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1761 (if further (setq result (append further result)))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1762 (setq chart (cdr chart)))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1763 (goto-char here)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1764 (if (= (preceding-char) ?\r)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1765 (setq result (cons here result)))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1766 (setq chart (cdr chart))))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1767 result))
7416
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1768 ;;;_ 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
1769 (defun outline-chart-spec (chart spec &optional exposing)
29490
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
1770 "Not yet \(if ever) implemented.
7416
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1771
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1772 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
1773
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1774 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
1775 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
1776 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
1777 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
1778 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
1779 bodies should be exposed.
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1780
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1781 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
1782 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
1783 exposed reside.
7416
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1784
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1785 - 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
1786 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
1787 including their entries.
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1788 - bare positive values indicate that this topic header should be
13964
4de229297f1f (outline-primary-bullet, outline-numbered-bullet,
Karl Heuer <kwzh@gnu.org>
parents: 13337
diff changeset
1789 opened.
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1790 - Lists signify the beginning and end points of regions that should
15664
a50ebf4ac764 (outline-auto-activation, outline-layout)
Karl Heuer <kwzh@gnu.org>
parents: 15663
diff changeset
1791 be flagged, and the flag to employ. (For concealment: `\(\?r\)', and
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1792 exposure:"
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1793 (while spec
15664
a50ebf4ac764 (outline-auto-activation, outline-layout)
Karl Heuer <kwzh@gnu.org>
parents: 15663
diff changeset
1794 (cond ((listp spec)
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1795 )
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1796 )
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1797 (setq spec (cdr spec)))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1798 )
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1799
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1800 ;;;_ - Within Topic
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1801 ;;;_ > outline-goto-prefix ()
3430
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1802 (defun outline-goto-prefix ()
29490
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
1803 "Put point at beginning of immediately containing outline topic.
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
1804
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
1805 Goes to most immediate subsequent topic if none immediately containing.
7416
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1806
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1807 Not sensitive to topic visibility.
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1808
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1809 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
1810
7416
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1811 (let (done)
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1812 (while (and (not done)
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1813 (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
1814 (forward-char 1)
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1815 (if (looking-at outline-regexp)
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1816 (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
1817 (match-end 0)))
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1818 (forward-char -1)))
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1819 (if (bobp)
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1820 (cond ((looking-at outline-regexp)
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1821 (outline-prefix-data (match-beginning 0)(match-end 0)))
29490
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
1822 ((outline-next-heading))
7416
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1823 (done))
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1824 done)))
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1825 ;;;_ > outline-end-of-prefix ()
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1826 (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
1827 "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
1828
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1829 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
1830 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
1831
3430
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1832 (if (not (outline-goto-prefix))
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1833 nil
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1834 (let ((match-data (match-data)))
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1835 (goto-char (match-end 0))
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1836 (if ignore-decorations
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1837 t
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1838 (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
1839 (if (and (not (eolp)) (looking-at "\\s-")) (forward-char 1)))
29490
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
1840 (store-match-data match-data))
3430
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1841 ;; Reestablish where we are:
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1842 (outline-current-depth)))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1843 ;;;_ > outline-current-bullet-pos ()
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1844 (defun outline-current-bullet-pos ()
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1845 "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
1846
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1847 (if (not (outline-current-depth))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1848 nil
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1849 (1- (match-end 0))))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1850 ;;;_ > outline-back-to-current-heading ()
3430
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1851 (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
1852 "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
1853
3430
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1854 (beginning-of-line)
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1855 (prog1 (or (outline-on-current-heading-p)
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1856 (and (re-search-backward (concat "^\\(" outline-regexp "\\)")
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1857 nil
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1858 'move)
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1859 (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
1860 (if (interactive-p) (outline-end-of-prefix))))
29490
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
1861 ;;;_ > outline-back-to-heading ()
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
1862 (defalias 'outline-back-to-heading 'outline-back-to-current-heading)
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1863 ;;;_ > outline-pre-next-preface ()
3430
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1864 (defun outline-pre-next-preface ()
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1865 "Skip forward to just before the next heading line.
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1866
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1867 Returns that character position."
3430
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1868
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1869 (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
1870 (prog1 (goto-char (match-beginning 0))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1871 (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
1872 ;;;_ > outline-end-of-current-subtree ()
3430
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1873 (defun outline-end-of-current-subtree ()
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1874 "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
1875 (interactive)
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1876 (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
1877 (let ((level (outline-recent-depth)))
3430
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1878 (outline-next-heading)
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1879 (while (and (not (eobp))
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1880 (> (outline-recent-depth) level))
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1881 (outline-next-heading))
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1882 (and (not (eobp)) (forward-char -1))
29490
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
1883 (and (memq (preceding-char) '(?\n ?\r))
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1884 (memq (aref (buffer-substring (max 1 (- (point) 3)) (point)) 1)
29490
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
1885 '(?\n ?\r))
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1886 (forward-char -1))
7416
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1887 (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
1888 ;;;_ > outline-beginning-of-current-entry ()
3430
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1889 (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
1890 "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
1891
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1892 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
1893 \(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
1894 (interactive)
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1895 (let ((start-point (point)))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1896 (outline-end-of-prefix)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1897 (if (and (interactive-p)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1898 (= (point) start-point))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1899 (goto-char (outline-current-bullet-pos)))))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1900 ;;;_ > outline-end-of-current-entry ()
3430
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1901 (defun outline-end-of-current-entry ()
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1902 "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
1903 (interactive)
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1904 (outline-show-entry)
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1905 (prog1 (outline-pre-next-preface)
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1906 (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
1907 (forward-char -1))))
29490
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
1908 ;;;_ > outline-end-of-current-heading ()
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
1909 (defun outline-end-of-current-heading ()
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
1910 (interactive)
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
1911 (outline-beginning-of-current-entry)
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
1912 (forward-line -1)
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
1913 (end-of-line))
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
1914 (defalias 'outline-end-of-heading 'outline-end-of-current-heading)
3430
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1915
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1916 ;;;_ - Depth-wise
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1917 ;;;_ > outline-ascend-to-depth (depth)
3430
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1918 (defun outline-ascend-to-depth (depth)
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1919 "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
1920 (if (and (> depth 0)(<= depth (outline-depth)))
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1921 (let ((last-good (point)))
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1922 (while (and (< depth (outline-depth))
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1923 (setq last-good (point))
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1924 (outline-beginning-of-level)
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1925 (outline-previous-heading)))
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1926 (if (= (outline-recent-depth) depth)
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1927 (progn (goto-char outline-recent-prefix-beginning)
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1928 depth)
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1929 (goto-char last-good)
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1930 nil))
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1931 (if (interactive-p) (outline-end-of-prefix))))
29490
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
1932 ;;;_ > outline-ascend ()
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
1933 (defun outline-ascend ()
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
1934 "Ascend one level, returning t if successful, nil if not."
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
1935 (prog1
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
1936 (if (outline-beginning-of-level)
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
1937 (outline-previous-heading))
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
1938 (if (interactive-p) (outline-end-of-prefix))))
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1939 ;;;_ > outline-descend-to-depth (depth)
3430
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1940 (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
1941 "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
1942
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1943 Returning depth if successful, nil if not."
3430
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1944 (let ((start-point (point))
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1945 (start-depth (outline-depth)))
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1946 (while
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1947 (and (> (outline-depth) 0)
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1948 (not (= depth (outline-recent-depth))) ; ... not there yet
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1949 (outline-next-heading) ; ... go further
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1950 (< start-depth (outline-recent-depth)))) ; ... still in topic
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1951 (if (and (> (outline-depth) 0)
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1952 (= (outline-recent-depth) depth))
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1953 depth
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1954 (goto-char start-point)
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1955 nil))
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1956 )
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1957 ;;;_ > outline-up-current-level (arg &optional dont-complain)
3430
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1958 (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
1959 "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
1960
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1961 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
1962 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
1963 DONT-COMPLAIN is non-nil."
3430
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1964 (interactive "p")
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1965 (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
1966 (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
1967 (last-good (point))
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1968 failed
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1969 return)
3430
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1970 ;; Loop for iterating arg:
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1971 (while (and (> (outline-recent-depth) 1)
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1972 (> arg 0)
7416
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1973 (not (bobp))
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1974 (not failed))
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1975 (setq last-good (point))
3430
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1976 ;; Loop for going back over current or greater depth:
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1977 (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
1978 (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
1979 (not (setq failed present-level)))))
3430
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1980 (setq present-level (outline-current-depth))
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1981 (setq arg (- arg 1)))
7416
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1982 (if (or failed
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1983 (> arg 0))
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1984 (progn (goto-char last-good)
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1985 (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
1986 (if (not dont-complain)
38431
853c3674f20a Fixes to follow coding conventions.
Pavel Janík <Pavel@Janik.cz>
parents: 38250
diff changeset
1987 (error "Can't ascend past outermost level")
7416
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1988 (if (interactive-p) (outline-end-of-prefix))
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1989 nil))
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1990 (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
1991 outline-recent-prefix-beginning)))
3430
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1992
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1993 ;;;_ - Linear
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1994 ;;;_ > outline-next-sibling (&optional depth backward)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1995 (defun outline-next-sibling (&optional depth backward)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1996 "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
1997
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1998 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
1999
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2000 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
2001
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2002 Return depth if successful, nil otherwise."
3430
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2003
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2004 (if (and backward (bobp))
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2005 nil
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2006 (let ((start-depth (or depth (outline-depth)))
3430
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2007 (start-point (point))
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2008 last-depth)
3430
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2009 (while (and (not (if backward (bobp) (eobp)))
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2010 (if backward (outline-previous-heading)
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2011 (outline-next-heading))
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2012 (> (setq last-depth (outline-recent-depth)) start-depth)))
3430
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2013 (if (and (not (eobp))
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2014 (and (> (or last-depth (outline-depth)) 0)
3430
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2015 (= (outline-recent-depth) start-depth)))
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2016 outline-recent-prefix-beginning
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2017 (goto-char start-point)
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2018 (if depth (outline-depth) start-depth)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2019 nil))))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2020 ;;;_ > outline-previous-sibling (&optional depth backward)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2021 (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
2022 "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
2023
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2024 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
2025
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2026 Optional BACKWARD reverses direction.
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2027
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2028 Return depth if successful, nil otherwise."
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2029 (outline-next-sibling depth (not backward))
3430
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2030 )
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2031 ;;;_ > outline-snug-back ()
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2032 (defun outline-snug-back ()
7416
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
2033 "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
2034
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
2035 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
2036 (if (or (bobp) (eobp))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2037 nil
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2038 (forward-char -1))
29490
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
2039 (if (or (bobp) (not (memq (preceding-char) '(?\n ?\r))))
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2040 nil
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2041 (forward-char -1)
29490
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
2042 (if (or (bobp) (not (memq (preceding-char) '(?\n ?\r))))
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2043 (forward-char -1)))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2044 (point))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2045 ;;;_ > outline-beginning-of-level ()
3430
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2046 (defun outline-beginning-of-level ()
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2047 "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
2048 (outline-end-of-level 'backward))
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2049 ;;;_ > outline-end-of-level (&optional backward)
3430
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2050 (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
2051 "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
2052
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2053 (let ((depth (outline-depth)))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2054 (while (outline-previous-sibling depth nil))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2055 (prog1 (outline-recent-depth)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2056 (if (interactive-p) (outline-end-of-prefix)))))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2057 ;;;_ > outline-next-visible-heading (arg)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2058 (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
2059 "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
2060
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
2061 Move as far as possible in indicated direction \(beginning or end of
29490
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
2062 buffer) if headings are exhausted."
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 (interactive "p")
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2065 (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
2066 (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
2067 (start-point (point))
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2068 prev got)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2069
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2070 (while (> arg 0) ; limit condition
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2071 (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
2072 ;; 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
2073 (< -1 (forward-line step))
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
2074 (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
2075 ;; 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
2076 (if got (setq prev got))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2077 (setq arg (1- arg)))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2078 (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
2079 (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
2080 (outline-end-of-prefix))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2081 (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
2082 (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
2083 ((not backward) (end-of-line) nil))))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2084 ;;;_ > outline-previous-visible-heading (arg)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2085 (defun outline-previous-visible-heading (arg)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2086 "Move to the previous heading line.
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2087
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2088 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
2089 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
2090 matches)."
3430
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2091 (interactive "p")
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2092 (outline-next-visible-heading (- arg)))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2093 ;;;_ > outline-forward-current-level (arg)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2094 (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
2095 "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
2096
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
2097 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
2098
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
2099 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
2100 (interactive "p")
7416
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
2101 (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
2102 (start-point (point))
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
2103 (start-arg arg)
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
2104 (backward (> 0 arg))
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
2105 last-depth
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
2106 (last-good (point))
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
2107 at-boundary)
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
2108 (if (= 0 start-depth)
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
2109 (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
2110 (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
2111 (while (not (or (zerop arg)
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
2112 at-boundary))
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
2113 (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
2114 (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
2115 (outline-next-visible-heading 1))
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
2116 (> (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
2117 (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
2118 (not (if backward (bobp) (eobp))))
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
2119 (setq last-good (point)
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
2120 arg (1- arg))
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
2121 (setq at-boundary t)))
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
2122 (if (and (not (eobp))
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
2123 (= arg 0)
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
2124 (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
2125 (= (outline-recent-depth) start-depth)))
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
2126 outline-recent-prefix-beginning
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
2127 (goto-char last-good)
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
2128 (if (not (interactive-p))
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
2129 nil
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
2130 (outline-end-of-prefix)
38431
853c3674f20a Fixes to follow coding conventions.
Pavel Janík <Pavel@Janik.cz>
parents: 38250
diff changeset
2131 (error "Hit %s level %d topic, traversed %d of %d requested"
7416
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
2132 (if backward "first" "last")
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
2133 (outline-recent-depth)
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
2134 (- (abs start-arg) arg)
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
2135 (abs start-arg))))))
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2136 ;;;_ > outline-backward-current-level (arg)
3430
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2137 (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
2138 "Inverse of `outline-forward-current-level'."
3430
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2139 (interactive "p")
7416
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
2140 (if (interactive-p)
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
2141 (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
2142 (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
2143 (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
2144
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
2145 ;;;_ #5 Alteration
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2146
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2147 ;;;_ - Fundamental
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2148 ;;;_ > outline-before-change-protect (beg end)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2149 (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
2150 "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
2151
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
2152 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
2153 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
2154 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
2155
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2156 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
2157 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
2158 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
2159 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
2160
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2161 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
2162 \(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
2163 writes, like crypt and zip modes.)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2164
29490
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
2165 Locally bound in outline buffers to `before-change-functions', which
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
2166 in emacs 19 is run before any change to the buffer.
15664
a50ebf4ac764 (outline-auto-activation, outline-layout)
Karl Heuer <kwzh@gnu.org>
parents: 15663
diff changeset
2167
a50ebf4ac764 (outline-auto-activation, outline-layout)
Karl Heuer <kwzh@gnu.org>
parents: 15663
diff changeset
2168 Any functions which set [`this-command' to `undo', or which set]
a50ebf4ac764 (outline-auto-activation, outline-layout)
Karl Heuer <kwzh@gnu.org>
parents: 15663
diff changeset
2169 `outline-override-protect' non-nil (as does, eg, outline-flag-chars)
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2170 are exempt from this restriction."
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2171 (if (and (outline-mode-p)
15664
a50ebf4ac764 (outline-auto-activation, outline-layout)
Karl Heuer <kwzh@gnu.org>
parents: 15663
diff changeset
2172 ; outline-override-protect
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2173 ; set by functions that know what
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2174 ; they're doing, eg outline internals:
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2175 (not outline-override-protect)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2176 (not outline-during-write-cue)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2177 (save-match-data ; Preserve operation position state.
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2178 ; Both beginning and end chars must
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2179 ; be exposed:
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2180 (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
2181 ;; Compensate for stupid emacs {new,
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2182 ;; open-}line display optimization:
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2183 (setq beg (1+ beg)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2184 end (1+ end)))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2185 (goto-char beg)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2186 (or (outline-hidden-p)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2187 (and (not (= beg end))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2188 (goto-char end)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2189 (outline-hidden-p))))))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2190 (save-match-data
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2191 (if (equal this-command 'undo)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2192 ;; Allow undo without inhibition.
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2193 ;; - 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
2194 ;; optimization (em 19 cmds.c, ~ line 200).
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2195 ;; - Presumably, undoing what was properly protected when
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2196 ;; done.
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2197 ;; - 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
2198 ;; So, expose what getting changed:
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2199 (progn (message "Undo! - exposing concealed target...")
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2200 (if (outline-hidden-p)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2201 (outline-show-children))
7416
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
2202 (message "Undo!"))
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2203 (let (response
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2204 (rehide-completely (save-excursion (outline-goto-prefix)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2205 (outline-hidden-p)))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2206 rehide-place)
15664
a50ebf4ac764 (outline-auto-activation, outline-layout)
Karl Heuer <kwzh@gnu.org>
parents: 15663
diff changeset
2207
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2208 (save-excursion
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2209 (if (condition-case err
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2210 ;; 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
2211 (progn
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2212 ; Give them a peek where
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2213 (save-excursion
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2214 (if (eolp) (setq rehide-place
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2215 (outline-goto-prefix)))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2216 (outline-show-entry))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2217 ; Present the message, but...
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2218 ; leave the cursor at the location
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2219 ; until they respond:
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2220 ; Then interpret the response:
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2221 (while
15664
a50ebf4ac764 (outline-auto-activation, outline-layout)
Karl Heuer <kwzh@gnu.org>
parents: 15663
diff changeset
2222 (progn
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2223 (message (concat "Change inside concealed"
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2224 " region - do it? "
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2225 "(n or 'y'/'r'eclose)"))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2226 (setq response (read-char))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2227 (not
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2228 (cond ((memq response '(?r ?R))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2229 (setq response 'reclose))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2230 ((memq response '(?y ?Y ? ))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2231 (setq response t))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2232 ((memq response '(?n ?N 127))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2233 (setq response nil)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2234 t)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2235 ((eq response ??)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2236 (message
15664
a50ebf4ac764 (outline-auto-activation, outline-layout)
Karl Heuer <kwzh@gnu.org>
parents: 15663
diff changeset
2237 "`r' means `yes, then reclose'")
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2238 nil)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2239 (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
2240 (sit-for 1)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2241 nil)))))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2242 response)
29490
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
2243 ('quit nil))
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2244 ; Continue:
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2245 (if (eq response 'reclose)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2246 (save-excursion
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2247 (if rehide-place (goto-char rehide-place))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2248 (if rehide-completely
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2249 (outline-hide-current-entry-completely)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2250 (outline-hide-current-entry)))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2251 (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
2252 (outline-show-children)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2253 (outline-show-to-offshoot)))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2254 ; Prevent:
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2255 (if rehide-completely
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2256 (save-excursion
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2257 (if rehide-place (goto-char rehide-place))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2258 (outline-hide-current-entry-completely))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2259 (outline-hide-current-entry))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2260 (error (concat
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2261 "Change within concealed region prevented.")))))))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2262 ) ; if
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2263 ) ; defun
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2264 ;;;_ = outline-post-goto-bullet
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2265 (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
2266 "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
2267
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
2268 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
2269 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
2270 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
2271 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
2272 outline-mode-map.")
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2273 (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
2274 ;;;_ > outline-post-command-business ()
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2275 (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
2276 "Outline post-command-hook function.
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
2277
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
2278 - 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
2279
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
2280 - 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
2281 outline commands.
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2282
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2283 - 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
2284 aggregated. This kludge compensates for lack of undo bunching when
29490
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
2285 before-change-functions is used."
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2286
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2287 ; 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
2288 (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
2289 nil
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
2290 (setq outline-override-protect nil)
29490
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
2291 (if outline-isearch-dynamic-expose
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
2292 (outline-isearch-rectification))
7416
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
2293 (if outline-during-write-cue
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
2294 ;; 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
2295 (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
2296 ;; Undo bunching business:
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
2297 (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
2298 (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
2299 (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
2300 (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
2301 (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
2302 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
2303 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
2304 (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
2305 (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
2306 (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
2307 (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
2308 (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
2309
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
2310 ;; 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
2311 (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
2312 (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
2313 (= 1 (- cur-to cur-from))
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
2314
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
2315 ;; 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
2316 ;; insertions:
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
2317 (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
2318 (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
2319 ; Below threshold:
7416
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
2320 (> 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
2321 (setq buffer-undo-list
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
2322 (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
2323 (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
2324 ;; 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
2325 (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
2326 (outline-current-bullet-pos))
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
2327 (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
2328 (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
2329 ))
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2330 ;;;_ > outline-pre-command-business ()
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2331 (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
2332 "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
2333 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
2334
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2335 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
2336 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
2337 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
2338 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
2339
29490
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
2340 The upshot is that you can get easy, single (ie, unmodified) key
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
2341 outline maneuvering operations by positioning the cursor on the bullet
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
2342 char. You stay in this mode until you use some regular
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
2343 cursor-positioning command to relocate the cursor off of a bullet
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
2344 char."
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
2345
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
2346 (if (not (outline-mode-p))
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
2347 ;; Shouldn't be invoked if not in allout outline-mode, but just in case:
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
2348 nil
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
2349 ;; Register isearch status:
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
2350 (if (and (boundp 'isearch-mode) isearch-mode)
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
2351 (setq outline-pre-was-isearching t)
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
2352 (setq outline-pre-was-isearching nil))
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
2353 ;; Hot-spot navigation provisions:
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
2354 (if (and (eq this-command 'self-insert-command)
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
2355 (eq (point)(outline-current-bullet-pos)))
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
2356 (let* ((this-key-num (cond
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
2357 ((numberp last-command-char)
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
2358 last-command-char)
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
2359 ;; XXX Only xemacs has characterp.
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
2360 ((and (fboundp 'characterp)
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
2361 (characterp last-command-char))
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
2362 (char-to-int last-command-char))
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
2363 (t 0)))
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
2364 mapped-binding)
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
2365 (if (zerop this-key-num)
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
2366 nil
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2367 ; Map upper-register literals
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2368 ; to lower register:
29490
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
2369 (if (<= 96 this-key-num)
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
2370 (setq this-key-num (- this-key-num 32)))
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2371 ; Check if we have a literal:
29490
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
2372 (if (and (<= 64 this-key-num)
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
2373 (>= 96 this-key-num))
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
2374 (setq mapped-binding
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
2375 (lookup-key 'outline-mode-map
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
2376 (concat outline-command-prefix
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
2377 (char-to-string (- this-key-num
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
2378 64))))))
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
2379 (if mapped-binding
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
2380 (setq outline-post-goto-bullet t
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
2381 this-command mapped-binding)))))))
7416
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
2382 ;;;_ > outline-find-file-hook ()
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
2383 (defun outline-find-file-hook ()
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
2384 "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
2385
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
2386 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
2387 (if (and outline-auto-activation
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
2388 (not (outline-mode-p))
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
2389 outline-layout)
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
2390 (outline-mode t)))
29490
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
2391 ;;;_ > outline-isearch-rectification
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
2392 (defun outline-isearch-rectification ()
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
2393 "Rectify outline exposure before, during, or after isearch.
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
2394
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
2395 Called as part of outline-post-command-business."
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
2396
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
2397 (let ((isearching (and (boundp 'isearch-mode) isearch-mode)))
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
2398 (cond ((and isearching (not outline-pre-was-isearching))
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
2399 (outline-isearch-expose 'start))
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
2400 ((and isearching outline-pre-was-isearching)
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
2401 (outline-isearch-expose 'continue))
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
2402 ((and (not isearching) outline-pre-was-isearching)
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
2403 (outline-isearch-expose 'final))
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
2404 ;; Not and wasn't isearching:
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
2405 (t (setq outline-isearch-prior-pos nil)
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
2406 (setq outline-isearch-did-quit nil)))))
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
2407 ;;;_ = outline-isearch-was-font-lock
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
2408 (defvar outline-isearch-was-font-lock
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
2409 (and (boundp 'font-lock-mode) font-lock-mode))
36390
495ba6e137c7 (outline-flag-region): Move macro in front of first
Gerd Moellmann <gerd@gnu.org>
parents: 29490
diff changeset
2410
495ba6e137c7 (outline-flag-region): Move macro in front of first
Gerd Moellmann <gerd@gnu.org>
parents: 29490
diff changeset
2411 ;;;_ > outline-flag-region (from to flag)
495ba6e137c7 (outline-flag-region): Move macro in front of first
Gerd Moellmann <gerd@gnu.org>
parents: 29490
diff changeset
2412 (defmacro outline-flag-region (from to flag)
495ba6e137c7 (outline-flag-region): Move macro in front of first
Gerd Moellmann <gerd@gnu.org>
parents: 29490
diff changeset
2413 "Hide or show lines from FROM to TO, via emacs selective-display FLAG char.
495ba6e137c7 (outline-flag-region): Move macro in front of first
Gerd Moellmann <gerd@gnu.org>
parents: 29490
diff changeset
2414 Ie, text following flag C-m \(carriage-return) is hidden until the
495ba6e137c7 (outline-flag-region): Move macro in front of first
Gerd Moellmann <gerd@gnu.org>
parents: 29490
diff changeset
2415 next C-j (newline) char.
495ba6e137c7 (outline-flag-region): Move macro in front of first
Gerd Moellmann <gerd@gnu.org>
parents: 29490
diff changeset
2416
495ba6e137c7 (outline-flag-region): Move macro in front of first
Gerd Moellmann <gerd@gnu.org>
parents: 29490
diff changeset
2417 Returns the endpoint of the region."
495ba6e137c7 (outline-flag-region): Move macro in front of first
Gerd Moellmann <gerd@gnu.org>
parents: 29490
diff changeset
2418 `(let ((buffer-read-only nil)
495ba6e137c7 (outline-flag-region): Move macro in front of first
Gerd Moellmann <gerd@gnu.org>
parents: 29490
diff changeset
2419 (outline-override-protect t))
495ba6e137c7 (outline-flag-region): Move macro in front of first
Gerd Moellmann <gerd@gnu.org>
parents: 29490
diff changeset
2420 (subst-char-in-region ,from ,to
495ba6e137c7 (outline-flag-region): Move macro in front of first
Gerd Moellmann <gerd@gnu.org>
parents: 29490
diff changeset
2421 (if (= ,flag ?\n) ?\r ?\n)
495ba6e137c7 (outline-flag-region): Move macro in front of first
Gerd Moellmann <gerd@gnu.org>
parents: 29490
diff changeset
2422 ,flag t)))
495ba6e137c7 (outline-flag-region): Move macro in front of first
Gerd Moellmann <gerd@gnu.org>
parents: 29490
diff changeset
2423
29490
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
2424 ;;;_ > outline-isearch-expose (mode)
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
2425 (defun outline-isearch-expose (mode)
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
2426 "Mode is either 'clear, 'start, 'continue, or 'final."
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
2427 ;; outline-isearch-prior-pos encodes exposure status of prior pos:
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
2428 ;; (pos was-vis header-pos end-pos)
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
2429 ;; pos - point of concern
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
2430 ;; was-vis - t, else 'topic if entire topic was exposed, 'entry otherwise
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
2431 ;; Do reclosure or prior pos, as necessary:
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
2432 (if (eq mode 'start)
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
2433 (setq outline-isearch-was-font-lock (and (boundp 'font-lock-mode)
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
2434 font-lock-mode)
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
2435 font-lock-mode nil)
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
2436 (if (eq mode 'final)
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
2437 (setq font-lock-mode outline-isearch-was-font-lock))
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
2438 (if (and outline-isearch-prior-pos
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
2439 (listp outline-isearch-prior-pos))
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
2440 ;; Conceal prior peek:
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
2441 (outline-flag-region (car (cdr outline-isearch-prior-pos))
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
2442 (car (cdr (cdr outline-isearch-prior-pos)))
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
2443 ?\r)))
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
2444 (if (outline-visible-p)
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
2445 (setq outline-isearch-prior-pos nil)
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
2446 (if (not (eq mode 'final))
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
2447 (setq outline-isearch-prior-pos (cons (point) (outline-show-entry)))
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
2448 (if outline-isearch-did-quit
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
2449 nil
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
2450 (setq outline-isearch-prior-pos nil)
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
2451 (outline-show-children))))
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
2452 (setq outline-isearch-did-quit nil))
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
2453 ;;;_ > outline-enwrap-isearch ()
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
2454 (defun outline-enwrap-isearch ()
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
2455 "Impose outline-mode isearch-abort wrapper for dynamic exposure in isearch.
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
2456
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
2457 The function checks to ensure that the rebinding is done only once."
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
2458
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
2459 (add-hook 'isearch-mode-end-hook 'outline-isearch-rectification)
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
2460 (if (fboundp 'outline-real-isearch-abort)
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
2461 ;;
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
2462 nil
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
2463 ; Ensure load of isearch-mode:
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
2464 (if (or (and (fboundp 'isearch-mode)
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
2465 (fboundp 'isearch-abort))
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
2466 (condition-case error
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
2467 (load-library "isearch-mode")
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
2468 ('file-error (message
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
2469 "Skipping isearch-mode provisions - %s '%s'"
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
2470 (car (cdr error))
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
2471 (car (cdr (cdr error))))
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
2472 (sit-for 1)
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
2473 ;; Inhibit subsequent tries and return nil:
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
2474 (setq outline-isearch-dynamic-expose nil))))
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
2475 ;; Isearch-mode loaded, encapsulate specific entry points for
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
2476 ;; outline dynamic-exposure business:
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
2477 (progn
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
2478 ;; stash crucial isearch-mode funcs under known, private
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
2479 ;; names, then register wrapper functions under the old
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
2480 ;; names, in their stead:
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
2481 (fset 'outline-real-isearch-abort (symbol-function 'isearch-abort))
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
2482 (fset 'isearch-abort 'outline-isearch-abort)))))
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
2483 ;;;_ > outline-isearch-abort ()
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
2484 (defun outline-isearch-abort ()
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
2485 "Wrapper for outline-real-isearch-abort \(which see), to register
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
2486 actual quits."
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
2487 (interactive)
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
2488 (setq outline-isearch-did-quit nil)
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
2489 (condition-case what
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
2490 (outline-real-isearch-abort)
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
2491 ('quit (setq outline-isearch-did-quit t)
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
2492 (signal 'quit nil))))
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
2493
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
2494 ;;; Prevent unnecessary font-lock while isearching!
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
2495 (defvar isearch-was-font-locking nil)
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
2496 (defun isearch-inhibit-font-lock ()
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
2497 "Inhibit font-lock while isearching - for use on isearch-mode-hook."
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
2498 (if (and (outline-mode-p) (boundp 'font-lock-mode) font-lock-mode)
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
2499 (setq isearch-was-font-locking t
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
2500 font-lock-mode nil)))
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
2501 (add-hook 'isearch-mode-hook 'isearch-inhibit-font-lock)
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
2502 (defun isearch-reenable-font-lock ()
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
2503 "Reenable font-lock after isearching - for use on isearch-mode-end-hook."
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
2504 (if (and (boundp 'font-lock-mode) font-lock-mode)
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
2505 (if (and (outline-mode-p) isearch-was-font-locking)
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
2506 (setq isearch-was-font-locking nil
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
2507 font-lock-mode t))))
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
2508 (add-hook 'isearch-mode-end-hook 'isearch-reenable-font-lock)
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2509
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2510 ;;;_ - Topic Format Assessment
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2511 ;;;_ > outline-solicit-alternate-bullet (depth &optional current-bullet)
3430
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2512 (defun outline-solicit-alternate-bullet (depth &optional current-bullet)
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2513
7416
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
2514 "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
2515
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
2516 Offer one suitable for current depth DEPTH as default."
3430
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2517
29490
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
2518 (let* ((default-bullet (or (and (stringp current-bullet) current-bullet)
3430
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2519 (outline-bullet-for-depth depth)))
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2520 (sans-escapes (regexp-sans-escapes outline-bullets-string))
29490
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
2521 choice)
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
2522 (save-excursion
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
2523 (goto-char (outline-current-bullet-pos))
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
2524 (setq choice (solicit-char-in-string
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
2525 (format "Select bullet: %s ('%s' default): "
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
2526 sans-escapes
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
2527 default-bullet)
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
2528 sans-escapes
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
2529 t)))
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
2530 (message "")
3430
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2531 (if (string= choice "") default-bullet choice))
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2532 )
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2533 ;;;_ > outline-distinctive-bullet (bullet)
3430
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2534 (defun outline-distinctive-bullet (bullet)
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2535 "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
2536 (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
2537 ;;;_ > outline-numbered-type-prefix (&optional prefix)
3430
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2538 (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
2539 "True if current header prefix bullet is numbered bullet."
3430
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2540 (and outline-numbered-bullet
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2541 (string= outline-numbered-bullet
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2542 (if prefix
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2543 (outline-get-prefix-bullet prefix)
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2544 (outline-get-bullet)))))
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2545 ;;;_ > outline-bullet-for-depth (&optional depth)
3430
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2546 (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
2547 "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
2548 ;; Find bullet in plain-bullets-string modulo DEPTH.
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2549 (if outline-stylish-prefixes
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2550 (char-to-string (aref outline-plain-bullets-string
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2551 (% (max 0 (- depth 2))
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2552 outline-plain-bullets-string-len)))
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2553 outline-primary-bullet)
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2554 )
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2555
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2556 ;;;_ - Topic Production
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2557 ;;;_ > outline-make-topic-prefix (&optional prior-bullet
3430
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2558 (defun outline-make-topic-prefix (&optional prior-bullet
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2559 new
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2560 depth
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2561 solicit
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2562 number-control
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2563 index)
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2564 ;; 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
2565 ;; 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
2566 ;; changing level of current topic.
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2567 ;; Solicit dominates specified bullet-char.
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2568 ;;;_ . Doc string:
7416
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
2569 "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
2570
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2571 All the arguments are optional.
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2572
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2573 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
2574 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
2575 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
2576 for instance.
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2577
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2578 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
2579 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
2580 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
2581 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
2582 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
2583 bullet or previous sibling.
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2584
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2585 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
2586 the current topics' depth.
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2587
29490
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
2588 If SOLICIT is non-nil, then the choice of bullet is solicited from
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
2589 user. If it's a character, then that character is offered as the
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
2590 default, otherwise the one suited to the context \(according to
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
2591 distinction or depth) is offered. \(This overrides other options,
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
2592 including, eg, a distinctive PRIOR-BULLET.) If non-nil, then the
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
2593 context-specific bullet is used.
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2594
15664
a50ebf4ac764 (outline-auto-activation, outline-layout)
Karl Heuer <kwzh@gnu.org>
parents: 15663
diff changeset
2595 Fifth arg, NUMBER-CONTROL, matters only if `outline-numbered-bullet'
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2596 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
2597 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
2598 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
2599
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2600 \(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
2601
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2602 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
2603 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
2604 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
2605 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
2606 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
2607 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
2608 number is used as the index for the numbered prefix (allowing, eg,
13964
4de229297f1f (outline-primary-bullet, outline-numbered-bullet,
Karl Heuer <kwzh@gnu.org>
parents: 13337
diff changeset
2609 sequential renumbering to not require this function counting back the
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2610 index for each successive sibling)."
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2611 ;;;_ . Code:
3430
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2612 ;; The options are ordered in likely frequence of use, most common
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2613 ;; highest, least lowest. Ie, more likely to be doing prefix
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2614 ;; adjustments than soliciting, and yet more than numbering.
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2615 ;; Current prefix is least dominant, but most likely to be commonly
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2616 ;; specified...
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2617
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2618 (let* (body
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2619 numbering
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2620 denumbering
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2621 (depth (or depth (outline-depth)))
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2622 (header-lead outline-header-prefix)
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2623 (bullet-char
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2624
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2625 ;; Getting value for bullet char is practically the whole job:
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2626
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2627 (cond
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2628 ; Simplest situation - level 1:
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2629 ((<= depth 1) (setq header-lead "") outline-primary-bullet)
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2630 ; Simple, too: all asterisks:
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2631 (outline-old-style-prefixes
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2632 ;; Cheat - make body the whole thing, null out header-lead and
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2633 ;; bullet-char:
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2634 (setq body (make-string depth
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2635 (string-to-char outline-primary-bullet)))
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2636 (setq header-lead "")
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2637 "")
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2638
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2639 ;; (Neither level 1 nor old-style, so we're space padding.
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2640 ;; 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
2641
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2642 ;; Solicitation overrides numbering and other cases:
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2643 ((progn (setq body (make-string (- depth 2) ?\ ))
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2644 ;; The actual condition:
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2645 solicit)
29490
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
2646 (let* ((got (outline-solicit-alternate-bullet depth solicit)))
3430
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2647 ;; Gotta check whether we're numbering and got a numbered bullet:
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2648 (setq numbering (and outline-numbered-bullet
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2649 (not (and number-control (not index)))
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2650 (string= got outline-numbered-bullet)))
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2651 ;; Now return what we got, regardless:
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2652 got))
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2653
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2654 ;; Numbering invoked through args:
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2655 ((and outline-numbered-bullet number-control)
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2656 (if (setq numbering (not (setq denumbering (not index))))
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2657 outline-numbered-bullet
7416
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
2658 (if (and prior-bullet
3430
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2659 (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
2660 prior-bullet)))
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
2661 prior-bullet
3430
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2662 (outline-bullet-for-depth depth))))
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2663
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2664 ;;; Neither soliciting nor controlled numbering ;;;
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2665 ;;; (may be controlled denumbering, tho) ;;;
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2666
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2667 ;; Check wrt previous sibling:
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2668 ((and new ; only check for new prefixes
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2669 (<= depth (outline-depth))
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2670 outline-numbered-bullet ; ... & numbering enabled
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2671 (not denumbering)
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2672 (let ((sibling-bullet
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2673 (save-excursion
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2674 ;; Locate correct sibling:
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2675 (or (>= depth (outline-depth))
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2676 (outline-ascend-to-depth depth))
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2677 (outline-get-bullet))))
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2678 (if (and sibling-bullet
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2679 (string= outline-numbered-bullet sibling-bullet))
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2680 (setq numbering sibling-bullet)))))
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2681
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2682 ;; Distinctive prior bullet?
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2683 ((and prior-bullet
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2684 (outline-distinctive-bullet prior-bullet)
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2685 ;; Either non-numbered:
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2686 (or (not (and outline-numbered-bullet
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2687 (string= prior-bullet outline-numbered-bullet)))
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2688 ;; or numbered, and not denumbering:
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2689 (setq numbering (not denumbering)))
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2690 ;; Here 'tis:
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2691 prior-bullet))
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2692
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2693 ;; Else, standard bullet per depth:
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2694 ((outline-bullet-for-depth depth)))))
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2695
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2696 (concat header-lead
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2697 body
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2698 bullet-char
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2699 (if numbering
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2700 (format "%d" (cond ((and index (numberp index)) index)
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2701 (new (1+ (outline-sibling-index depth)))
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2702 ((outline-sibling-index))))))
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2703 )
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2704 )
29490
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
2705 ;;;_ > outline-open-topic (relative-depth &optional before use_sib_bullet)
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
2706 (defun outline-open-topic (relative-depth &optional before use_sib_bullet)
7416
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
2707 "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
2708
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
2709 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
2710 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
2711 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
2712
29490
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
2713 If USE_SIB_BULLET is true, use the bullet of the prior sibling.
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
2714
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2715 Nuances:
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2716
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2717 - 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
2718 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
2719
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2720 - 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
2721 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
2722 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
2723 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
2724 deliberately dividing topic bodies.
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2725
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2726 - 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
2727 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
2728 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
2729 single-spacing is used.
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2730
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2731 - 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
2732 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
2733 can easily create a sibling in front of the current topic without
13964
4de229297f1f (outline-primary-bullet, outline-numbered-bullet,
Karl Heuer <kwzh@gnu.org>
parents: 13337
diff changeset
2734 having to go to its preceding sibling, and then open forward
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2735 from there."
3430
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2736
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2737 (let* ((depth (+ (outline-current-depth) relative-depth))
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2738 (opening-on-blank (if (looking-at "^\$")
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2739 (not (setq before nil))))
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2740 opening-numbered ; Will get while computing ref-topic, below
29490
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
2741 ref-depth ; Will get while computing ref-topic, below
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
2742 ref-bullet ; Will get while computing ref-topic, next
3430
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2743 (ref-topic (save-excursion
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2744 (cond ((< relative-depth 0)
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2745 (outline-ascend-to-depth depth))
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2746 ((>= relative-depth 1) nil)
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2747 (t (outline-back-to-current-heading)))
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2748 (setq ref-depth (outline-recent-depth))
29490
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
2749 (setq ref-bullet
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
2750 (if (> outline-recent-prefix-end 1)
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
2751 (outline-recent-bullet)
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
2752 ""))
3430
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2753 (setq opening-numbered
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2754 (save-excursion
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2755 (and outline-numbered-bullet
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2756 (or (<= relative-depth 0)
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2757 (outline-descend-to-depth depth))
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2758 (if (outline-numbered-type-prefix)
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2759 outline-numbered-bullet))))
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2760 (point)))
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2761 dbl-space
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2762 doing-beginning)
3430
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2763
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2764 (if (not opening-on-blank)
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2765 ; Positioning and vertical
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2766 ; padding - only if not
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2767 ; opening-on-blank:
15664
a50ebf4ac764 (outline-auto-activation, outline-layout)
Karl Heuer <kwzh@gnu.org>
parents: 15663
diff changeset
2768 (progn
3430
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2769 (goto-char ref-topic)
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2770 (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
2771 (or (and (<= relative-depth 0) ; not descending;
3430
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2772 (save-excursion
13964
4de229297f1f (outline-primary-bullet, outline-numbered-bullet,
Karl Heuer <kwzh@gnu.org>
parents: 13337
diff changeset
2773 ;; at b-o-b or preceded by a blank line?
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2774 (or (> 0 (forward-line -1))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2775 (looking-at "^\\s-*$")
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2776 (bobp)))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2777 (save-excursion
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2778 ;; succeeded by a blank line?
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2779 (outline-end-of-current-subtree)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2780 (bolp)))
3430
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2781 (and (= ref-depth 1)
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2782 (or before
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2783 (= depth 1)
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2784 (save-excursion
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2785 ;; Don't already have following
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2786 ;; vertical padding:
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2787 (not (outline-pre-next-preface)))))))
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2788
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2789 ; Position to prior heading,
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2790 ; if inserting backwards, and
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2791 ; not going outwards:
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2792 (if (and before (>= relative-depth 0))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2793 (progn (outline-back-to-current-heading)
3430
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2794 (setq doing-beginning (bobp))
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2795 (if (not (bobp))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2796 (outline-previous-heading)))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2797 (if (and before (bobp))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2798 (outline-unprotected (open-line 1))))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2799
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2800 (if (<= relative-depth 0)
3430
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2801 ;; Not going inwards, don't snug up:
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2802 (if doing-beginning
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2803 (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
2804 (if before
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2805 (progn (end-of-line)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2806 (outline-pre-next-preface)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2807 (while (= ?\r (following-char))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2808 (forward-char 1))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2809 (if (not (looking-at "^$"))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2810 (outline-unprotected (open-line 1))))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2811 (outline-end-of-current-subtree)))
3430
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2812 ;; Going inwards - double-space if first offspring is,
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2813 ;; otherwise snug up.
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2814 (end-of-line) ; So we skip any concealed progeny.
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2815 (outline-pre-next-preface)
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2816 (if (bolp)
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2817 ;; Blank lines between current header body and next
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2818 ;; header - get to last substantive (non-white-space)
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2819 ;; line in body:
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2820 (re-search-backward "[^ \t\n]" nil t))
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2821 (if (save-excursion
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2822 (outline-next-heading)
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2823 (if (> (outline-recent-depth) ref-depth)
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2824 ;; This is an offspring.
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2825 (progn (forward-line -1)
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2826 (looking-at "^\\s-*$"))))
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2827 (progn (forward-line 1)
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2828 (outline-unprotected (open-line 1))))
3430
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2829 (end-of-line))
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2830 ;;(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
2831 (if (not (bobp))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2832 (progn (if (and (not (> depth ref-depth))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2833 (not before))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2834 (outline-unprotected (open-line 1))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2835 (if (> depth ref-depth)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2836 (outline-unprotected (newline 1))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2837 (if dbl-space
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2838 (outline-unprotected (open-line 1))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2839 (if (not before)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2840 (outline-unprotected (newline 1))))))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2841 (if dbl-space
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2842 (outline-unprotected (newline 1)))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2843 (if (and (not (eobp))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2844 (not (bolp)))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2845 (forward-char 1))))
3430
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2846 ))
41571
2902b21d2034 (outline-version, outline-open-topic)
Pavel Janík <Pavel@Janik.cz>
parents: 38431
diff changeset
2847 (insert (concat (outline-make-topic-prefix opening-numbered
2902b21d2034 (outline-version, outline-open-topic)
Pavel Janík <Pavel@Janik.cz>
parents: 38431
diff changeset
2848 t
2902b21d2034 (outline-version, outline-open-topic)
Pavel Janík <Pavel@Janik.cz>
parents: 38431
diff changeset
2849 depth)
2902b21d2034 (outline-version, outline-open-topic)
Pavel Janík <Pavel@Janik.cz>
parents: 38431
diff changeset
2850 " "))
3430
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2851
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2852 ;;(if doing-beginning (save-excursion (newline (if dbl-space 2 1))))
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2853
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2854
29490
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
2855 (outline-rebullet-heading (and use_sib_bullet ref-bullet);;; solicit
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
2856 depth ;;; depth
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
2857 nil ;;; number-control
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
2858 nil ;;; index
3430
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2859 t) (end-of-line)
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2860 )
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2861 )
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2862 ;;;_ . open-topic contingencies
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2863 ;;;_ ; 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
2864 ;;;_ , beginning char
13964
4de229297f1f (outline-primary-bullet, outline-numbered-bullet,
Karl Heuer <kwzh@gnu.org>
parents: 13337
diff changeset
2865 ;;;_ , amount of space before will be used, unless opening in place
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2866 ;;;_ , 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
2867 ;;;_ ; absolute depth of new topic
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2868 ;;;_ ! insert in place - overrides most stuff
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2869 ;;;_ ; relative depth of new re base
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2870 ;;;_ ; before or after base topic
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2871 ;;;_ ; 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
2872 ;;;_ ; 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
2873 ;;;_ ; 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
2874 ;;;_ ; location of new topic
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2875 ;;;_ > outline-open-subtopic (arg)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2876 (defun outline-open-subtopic (arg)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2877 "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
2878
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2879 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
2880 prior to the current one."
3430
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2881 (interactive "p")
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2882 (outline-open-topic 1 (> 0 arg)))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2883 ;;;_ > outline-open-sibtopic (arg)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2884 (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
2885 "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
2886
29490
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
2887 Positive universal arg means to use the bullet of the prior sibling.
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
2888
7416
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
2889 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
2890 one."
3430
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2891 (interactive "p")
29490
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
2892 (outline-open-topic 0 (> 0 arg) (< 1 arg)))
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2893 ;;;_ > outline-open-supertopic (arg)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2894 (defun outline-open-supertopic (arg)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2895 "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
2896
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2897 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
2898 topic prior to the current one."
3430
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2899
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2900 (interactive "p")
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2901 (outline-open-topic -1 (> 0 arg)))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2902
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2903 ;;;_ - Outline Alteration
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2904 ;;;_ : Topic Modification
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2905 ;;;_ = outline-former-auto-filler
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2906 (defvar outline-former-auto-filler nil
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2907 "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
2908 ;;;_ > outline-auto-fill ()
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2909 (defun outline-auto-fill ()
7416
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
2910 "Outline-mode autofill function.
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
2911
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
2912 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
2913 `outline-use-hanging-indents' is set."
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2914 (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
2915 ;; Check for topic header indentation:
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2916 (save-excursion
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2917 (beginning-of-line)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2918 (if (looking-at outline-regexp)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2919 ;; ... construct indentation to account for
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2920 ;; length of topic prefix:
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2921 (make-string (progn (outline-end-of-prefix)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2922 (current-column))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2923 ?\ ))))))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2924 (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
2925 (do-auto-fill))))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2926 ;;;_ > 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
2927 (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
2928 "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
2929
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2930 Optional arg NUMBER indicates numbering is being added, and it must
13964
4de229297f1f (outline-primary-bullet, outline-numbered-bullet,
Karl Heuer <kwzh@gnu.org>
parents: 13337
diff changeset
2931 be accommodated.
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2932
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2933 Note that refill of indented paragraphs is not done."
3430
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2934
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2935 (save-excursion
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2936 (outline-end-of-prefix)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2937 (let* ((new-margin (current-column))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2938 excess old-indent-begin old-indent-end
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2939 curr-ind
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2940 ;; 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
2941 ;; *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
2942 ;; 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
2943 (old-margin (+ old-depth (- new-margin new-depth))))
15664
a50ebf4ac764 (outline-auto-activation, outline-layout)
Karl Heuer <kwzh@gnu.org>
parents: 15663
diff changeset
2944
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2945 ;; 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
2946 (outline-unprotected
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2947 (save-match-data
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2948 (while
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2949 (and (re-search-forward "[\n\r]\\(\\s-*\\)"
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2950 nil
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2951 t)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2952 ;; Register the indent data, before we reset the
15664
a50ebf4ac764 (outline-auto-activation, outline-layout)
Karl Heuer <kwzh@gnu.org>
parents: 15663
diff changeset
2953 ;; match data with a subsequent `looking-at':
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2954 (setq old-indent-begin (match-beginning 1)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2955 old-indent-end (match-end 1))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2956 (not (looking-at outline-regexp)))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2957 (if (> 0 (setq excess (- (current-column)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2958 old-margin)))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2959 ;; 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
2960 nil
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2961 ;; 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
2962 ;; reindent it, preserving its existing indentation
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2963 ;; beyond the old margin:
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2964 (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
2965 (indent-to (+ new-margin excess)))))))))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2966 ;;;_ > outline-rebullet-current-heading (arg)
3430
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2967 (defun outline-rebullet-current-heading (arg)
29490
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
2968 "Solicit new bullet for current visible heading."
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
2969 (interactive "p")
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
2970 (let ((initial-col (current-column))
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
2971 (on-bullet (eq (point)(outline-current-bullet-pos)))
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
2972 (backwards (if (< arg 0)
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
2973 (setq arg (* arg -1)))))
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
2974 (while (> arg 0)
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
2975 (save-excursion (outline-back-to-current-heading)
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
2976 (outline-end-of-prefix)
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
2977 (outline-rebullet-heading t ;;; solicit
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
2978 nil ;;; depth
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
2979 nil ;;; number-control
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
2980 nil ;;; index
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
2981 t)) ;;; do-successors
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
2982 (setq arg (1- arg))
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
2983 (if (<= arg 0)
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
2984 nil
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
2985 (setq initial-col nil) ; Override positioning back to init col
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
2986 (if (not backwards)
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
2987 (outline-next-visible-heading 1)
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
2988 (outline-goto-prefix)
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
2989 (outline-next-visible-heading -1))))
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
2990 (message "Done.")
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
2991 (cond (on-bullet (goto-char (outline-current-bullet-pos)))
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
2992 (initial-col (move-to-column initial-col)))))
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2993 ;;;_ > outline-rebullet-heading (&optional solicit ...)
3430
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2994 (defun outline-rebullet-heading (&optional solicit
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2995 new-depth
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2996 number-control
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2997 index
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2998 do-successors)
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2999
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3000 "Adjust bullet of current topic prefix.
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3001
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3002 All args are optional.
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3003
29490
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
3004 If SOLICIT is non-nil, then the choice of bullet is solicited from
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
3005 user. If it's a character, then that character is offered as the
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
3006 default, otherwise the one suited to the context \(according to
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
3007 distinction or depth) is offered. If non-nil, then the
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
3008 context-specific bullet is just used.
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3009
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3010 Second arg DEPTH forces the topic prefix to that depth, regardless
29490
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
3011 of the topic's current depth.
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3012
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3013 Third arg NUMBER-CONTROL can force the prefix to or away from
15664
a50ebf4ac764 (outline-auto-activation, outline-layout)
Karl Heuer <kwzh@gnu.org>
parents: 15663
diff changeset
3014 numbered form. It has effect only if `outline-numbered-bullet' is
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3015 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
3016 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
3017 of the forth arg, INDEX.
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3018
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3019 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
3020 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
3021 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
3022 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
3023 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
3024 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
3025 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
3026
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3027 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
3028 siblings.
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3029
15664
a50ebf4ac764 (outline-auto-activation, outline-layout)
Karl Heuer <kwzh@gnu.org>
parents: 15663
diff changeset
3030 Cf vars `outline-stylish-prefixes', `outline-old-style-prefixes',
a50ebf4ac764 (outline-auto-activation, outline-layout)
Karl Heuer <kwzh@gnu.org>
parents: 15663
diff changeset
3031 and `outline-numbered-bullet', which all affect the behavior of
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3032 this function."
3430
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3033
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3034 (let* ((current-depth (outline-depth))
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3035 (new-depth (or new-depth current-depth))
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3036 (mb outline-recent-prefix-beginning)
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3037 (me outline-recent-prefix-end)
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3038 (current-bullet (buffer-substring (- me 1) me))
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3039 (new-prefix (outline-make-topic-prefix current-bullet
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3040 nil
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3041 new-depth
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3042 solicit
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3043 number-control
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3044 index)))
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3045
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3046 ;; Is new one is identical to old?
3430
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3047 (if (and (= current-depth new-depth)
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3048 (string= current-bullet
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3049 (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
3050 ;; Nothing to do:
3430
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3051 t
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3052
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3053 ;; New prefix probably different from old:
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3054 ; get rid of old one:
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3055 (outline-unprotected (delete-region mb me))
3430
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3056 (goto-char mb)
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3057 ; Dispense with number if
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3058 ; numbered-bullet prefix:
3430
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3059 (if (and outline-numbered-bullet
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3060 (string= outline-numbered-bullet current-bullet)
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3061 (looking-at "[0-9]+"))
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3062 (outline-unprotected
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3063 (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
3064
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3065 ; Put in new prefix:
41571
2902b21d2034 (outline-version, outline-open-topic)
Pavel Janík <Pavel@Janik.cz>
parents: 38431
diff changeset
3066 (outline-unprotected (insert new-prefix))
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3067
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3068 ;; 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
3069 (if (and outline-reindent-bodies
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3070 (not (= new-depth current-depth)))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3071 (outline-reindent-body current-depth new-depth))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3072
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3073 ;; 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
3074 ;; caller elected for it:
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3075 (if do-successors
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3076 (save-excursion
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3077 (while (outline-next-sibling new-depth nil)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3078 (setq index
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3079 (cond ((numberp index) (1+ index))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3080 ((not number-control) (outline-sibling-index))))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3081 (if (outline-numbered-type-prefix)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3082 (outline-rebullet-heading nil ;;; solicit
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3083 new-depth ;;; new-depth
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3084 number-control;;; number-control
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3085 index ;;; index
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3086 nil))))) ;;;(dont!)do-successors
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3087 ) ; (if (and (= current-depth new-depth)...))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3088 ) ; let* ((current-depth (outline-depth))...)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3089 ) ; defun
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3090 ;;;_ > outline-rebullet-topic (arg)
3430
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3091 (defun outline-rebullet-topic (arg)
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3092 "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
3093
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3094 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
3095
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3096 With repeat count, shift topic depth by that amount."
3430
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3097 (interactive "P")
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3098 (let ((start-col (current-column))
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3099 (was-eol (eolp)))
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3100 (save-excursion
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3101 ;; Normalize arg:
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3102 (cond ((null arg) (setq arg 0))
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3103 ((listp arg) (setq arg (car arg))))
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3104 ;; 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
3105 (if (not (zerop arg)) (message "Shifting..."))
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3106 (outline-back-to-current-heading)
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3107 (if (<= (+ (outline-recent-depth) arg) 0)
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3108 (error "Attempt to shift topic below level 1"))
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3109 (outline-rebullet-topic-grunt arg)
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3110 (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
3111 (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
3112 ;;;_ > outline-rebullet-topic-grunt (&optional relative-depth ...)
3430
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3113 (defun outline-rebullet-topic-grunt (&optional relative-depth
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3114 starting-depth
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3115 starting-point
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3116 index
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3117 do-successors)
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3118
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3119 "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
3120 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
3121 behavior.
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3122
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3123 All arguments are optional.
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 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
3126 topic that amount.
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 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
3129 itself. The are STARTING-DEPTH, STARTING-POINT, and INDEX."
3430
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3130
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3131 (let* ((relative-depth (or relative-depth 0))
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3132 (new-depth (outline-depth))
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3133 (starting-depth (or starting-depth new-depth))
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3134 (on-starting-call (null starting-point))
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3135 (index (or index
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3136 ;; Leave index null on starting call, so rebullet-heading
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3137 ;; calculates it at what might be new depth:
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3138 (and (or (zerop relative-depth)
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3139 (not on-starting-call))
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3140 (outline-sibling-index))))
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3141 (moving-outwards (< 0 relative-depth))
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3142 (starting-point (or starting-point (point))))
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3143
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3144 ;; Sanity check for excessive promotion done only on starting call:
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3145 (and on-starting-call
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3146 moving-outwards
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3147 (> 0 (+ starting-depth relative-depth))
38431
853c3674f20a Fixes to follow coding conventions.
Pavel Janík <Pavel@Janik.cz>
parents: 38250
diff changeset
3148 (error "Attempt to shift topic out beyond level 1")) ;;; ====>
3430
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3149
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3150 (cond ((= starting-depth new-depth)
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3151 ;; We're at depth to work on this one:
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3152 (outline-rebullet-heading nil ;;; solicit
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3153 (+ starting-depth ;;; starting-depth
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3154 relative-depth)
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3155 nil ;;; number
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3156 index ;;; index
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3157 ;; Every contained topic will get hit,
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3158 ;; and we have to get to outside ones
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3159 ;; deliberately:
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3160 nil) ;;; do-successors
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3161 ;; ... and work on subsequent ones which are at greater depth:
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3162 (setq index 0)
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3163 (outline-next-heading)
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3164 (while (and (not (eobp))
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3165 (< starting-depth (outline-recent-depth)))
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3166 (setq index (1+ index))
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3167 (outline-rebullet-topic-grunt relative-depth ;;; relative-depth
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3168 (1+ starting-depth);;;starting-depth
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3169 starting-point ;;; starting-point
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3170 index))) ;;; index
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3171
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3172 ((< starting-depth new-depth)
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3173 ;; Rare case - subtopic more than one level deeper than parent.
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3174 ;; Treat this one at an even deeper level:
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3175 (outline-rebullet-topic-grunt relative-depth ;;; relative-depth
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3176 new-depth ;;; starting-depth
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3177 starting-point ;;; starting-point
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3178 index))) ;;; index
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3179
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3180 (if on-starting-call
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3181 (progn
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3182 ;; Rectify numbering of former siblings of the adjusted topic,
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3183 ;; if topic has changed depth
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3184 (if (or do-successors
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3185 (and (not (zerop relative-depth))
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3186 (or (= (outline-recent-depth) starting-depth)
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3187 (= (outline-recent-depth) (+ starting-depth
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3188 relative-depth)))))
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3189 (outline-rebullet-heading nil nil nil nil t))
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3190 ;; Now rectify numbering of new siblings of the adjusted topic,
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3191 ;; if depth has been changed:
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3192 (progn (goto-char starting-point)
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3193 (if (not (zerop relative-depth))
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3194 (outline-rebullet-heading nil nil nil nil t)))))
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3195 )
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3196 )
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3197 ;;;_ > outline-renumber-to-depth (&optional depth)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3198 (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
3199 "Renumber siblings at current depth.
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
3200
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
3201 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
3202
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3203 Returns final depth."
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3204
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3205 ;; 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
3206 ;; 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
3207
29490
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
3208 (let ((ascender (outline-depth))
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
3209 was-eobp)
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3210 (while (and (not (eobp))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3211 (outline-depth)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3212 (>= (outline-recent-depth) depth)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3213 (>= ascender depth))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3214 ; Skip over all topics at
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3215 ; lesser depths, which can not
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3216 ; have been disturbed:
29490
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
3217 (while (and (not (setq was-eobp (eobp)))
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3218 (> (outline-recent-depth) ascender))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3219 (outline-next-heading))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3220 ; Prime ascender for ascension:
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3221 (setq ascender (1- (outline-recent-depth)))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3222 (if (>= (outline-recent-depth) depth)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3223 (outline-rebullet-heading nil ;;; solicit
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3224 nil ;;; depth
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3225 nil ;;; number-control
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3226 nil ;;; index
29490
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
3227 t)) ;;; do-successors
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
3228 (if was-eobp (goto-char (point-max)))))
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3229 (outline-recent-depth))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3230 ;;;_ > outline-number-siblings (&optional denumber)
3430
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3231 (defun outline-number-siblings (&optional denumber)
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3232 "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
3233
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3234 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
3235 topic and its siblings.
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 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
3238 rebulleting each topic at this level."
3430
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3239
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3240 (interactive "P")
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3241
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3242 (save-excursion
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3243 (outline-back-to-current-heading)
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3244 (outline-beginning-of-level)
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3245 (let ((depth (outline-recent-depth))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3246 (index (if (not denumber) 1))
3430
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3247 (use-bullet (equal '(16) denumber))
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3248 (more t))
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3249 (while more
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3250 (outline-rebullet-heading use-bullet ;;; solicit
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3251 depth ;;; depth
3430
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3252 t ;;; number-control
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3253 index ;;; index
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3254 nil) ;;; do-successors
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3255 (if index (setq index (1+ index)))
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3256 (setq more (outline-next-sibling depth nil))))))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3257 ;;;_ > outline-shift-in (arg)
3430
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3258 (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
3259 "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
3260 (interactive "p")
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3261 (outline-rebullet-topic arg))
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3262 ;;;_ > outline-shift-out (arg)
3430
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3263 (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
3264 "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
3265 (interactive "p")
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3266 (outline-rebullet-topic (* arg -1)))
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3267 ;;;_ : 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
3268 ;;;_ > outline-kill-line (&optional arg)
3430
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3269 (defun outline-kill-line (&optional arg)
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3270 "Kill line, adjusting subsequent lines suitably for outline mode."
3430
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3271
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3272 (interactive "*P")
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3273 (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
3274 outline-numbered-bullet ; numbers may need adjustment,
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3275 (bolp) ; may be clipping topic head,
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3276 (looking-at outline-regexp))) ; are clipping topic head.
3430
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3277 ;; Above conditions do not obtain - just do a regular kill:
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3278 (kill-line arg)
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3279 ;; 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
3280 (let* ((depth (outline-depth)))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3281 ; Do the kill:
3430
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3282 (kill-line arg)
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3283 ; Provide some feedback:
3430
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3284 (sit-for 0)
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3285 (save-excursion
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3286 ; Start with the topic
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3287 ; following killed line:
3430
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3288 (if (not (looking-at outline-regexp))
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3289 (outline-next-heading))
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3290 (outline-renumber-to-depth depth)))))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3291 ;;;_ > outline-kill-topic ()
3430
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3292 (defun outline-kill-topic ()
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3293 "Kill topic together with subtopics.
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 Leaves primary topic's trailing vertical whitespace, if any."
3430
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3296
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3297 ;; Some finagling is done to make complex topic kills appear faster
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3298 ;; than they actually are. A redisplay is performed immediately
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3299 ;; after the region is disposed of, though the renumbering process
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3300 ;; 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
3301 ;; a lag *after* the kill has been performed.
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3302
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3303 (interactive)
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3304 (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
3305 (depth (outline-recent-depth)))
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3306 (outline-end-of-current-subtree)
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3307 (if (not (eobp))
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3308 (if (or (not (looking-at "^$"))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3309 ;; 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
3310 ;; 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
3311 ;; 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
3312 ;; containing topic:
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3313 (save-excursion
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3314 (and (outline-next-heading)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3315 (>= (outline-recent-depth) depth))))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3316 (forward-char 1)))
15664
a50ebf4ac764 (outline-auto-activation, outline-layout)
Karl Heuer <kwzh@gnu.org>
parents: 15663
diff changeset
3317
3430
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3318 (kill-region beg (point))
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3319 (sit-for 0)
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3320 (save-excursion
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3321 (outline-renumber-to-depth depth))))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3322 ;;;_ > outline-yank-processing ()
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3323 (defun outline-yank-processing (&optional arg)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3324
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3325 "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
3326
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3327 Does depth adjustment of yanked topics, when:
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3328
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3329 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
3330 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
3331 topic prefix.
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3332
13964
4de229297f1f (outline-primary-bullet, outline-numbered-bullet,
Karl Heuer <kwzh@gnu.org>
parents: 13337
diff changeset
3333 Also, adjusts numbering of subsequent siblings when appropriate.
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3334
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3335 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
3336 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
3337 header into which it's being yanked.
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3338
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3339 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
3340 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
3341 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
3342
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3343 (interactive "*P")
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3344 ; Get to beginning, leaving
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3345 ; region around subject:
29490
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
3346 (if (< (my-mark-marker t) (point))
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3347 (exchange-point-and-mark))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3348 (let* ((subj-beg (point))
29490
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
3349 (subj-end (my-mark-marker t))
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
3350 ;; 'resituate' if yanking an entire topic into topic header:
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3351 (resituate (and (outline-e-o-prefix-p)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3352 (looking-at (concat "\\(" outline-regexp "\\)"))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3353 (outline-prefix-data (match-beginning 1)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3354 (match-end 1))))
15664
a50ebf4ac764 (outline-auto-activation, outline-layout)
Karl Heuer <kwzh@gnu.org>
parents: 15663
diff changeset
3355 ;; `rectify-numbering' if resituating (where several topics may
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3356 ;; 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
3357 (rectify-numbering (or resituate
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3358 (and (bolp) (looking-at outline-regexp)))))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3359 (if resituate
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3360 ; The yanked stuff is a topic:
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3361 (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
3362 (subj-depth (outline-recent-depth))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3363 (prefix-bullet (outline-recent-bullet))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3364 (adjust-to-depth
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3365 ;; 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
3366 ;; adjustment should be made:
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3367 (save-excursion
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3368 (and (goto-char subj-end)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3369 (eolp)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3370 (goto-char subj-beg)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3371 (and (looking-at outline-regexp)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3372 (progn
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3373 (beginning-of-line)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3374 (not (= (point) subj-beg)))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3375 (looking-at outline-regexp)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3376 (outline-prefix-data (match-beginning 0)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3377 (match-end 0)))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3378 (outline-recent-depth))))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3379 done
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3380 (more t))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3381 (setq rectify-numbering outline-numbered-bullet)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3382 (if adjust-to-depth
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3383 ; Do the adjustment:
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3384 (progn
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3385 (message "... yanking") (sit-for 0)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3386 (save-restriction
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3387 (narrow-to-region subj-beg subj-end)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3388 ; Trim off excessive blank
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3389 ; line at end, if any:
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3390 (goto-char (point-max))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3391 (if (looking-at "^$")
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3392 (outline-unprotected (delete-char -1)))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3393 ; Work backwards, with each
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3394 ; shallowest level,
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3395 ; successively excluding the
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3396 ; last processed topic from
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3397 ; the narrow region:
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3398 (while more
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3399 (outline-back-to-current-heading)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3400 ; 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
3401 (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
3402 (save-excursion
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3403 (outline-rebullet-topic-grunt (- adjust-to-depth
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3404 subj-depth))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3405 (outline-depth))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3406 (if (setq more (not (bobp)))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3407 (progn (widen)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3408 (forward-char -1)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3409 (narrow-to-region subj-beg (point))))))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3410 (message "")
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3411 ;; 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
3412 ;; use old one:
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3413 (if (string-match (regexp-quote prefix-bullet)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3414 outline-distinctive-bullets-string)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3415 ; Delete from bullet of old to
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3416 ; before bullet of new:
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3417 (progn
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3418 (beginning-of-line)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3419 (delete-region (point) subj-beg)
29490
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
3420 (set-marker (my-mark-marker t) subj-end)
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3421 (goto-char subj-beg)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3422 (outline-end-of-prefix))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3423 ; Delete base subj prefix,
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3424 ; leaving old one:
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3425 (delete-region (point) (+ (point)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3426 prefix-len
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3427 (- adjust-to-depth subj-depth)))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3428 ; and delete residual subj
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3429 ; prefix digits and space:
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3430 (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
3431 (if (looking-at " ") (delete-char 1))))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3432 (exchange-point-and-mark))))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3433 (if rectify-numbering
15664
a50ebf4ac764 (outline-auto-activation, outline-layout)
Karl Heuer <kwzh@gnu.org>
parents: 15663
diff changeset
3434 (progn
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3435 (save-excursion
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3436 ; Give some preliminary feedback:
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3437 (message "... reconciling numbers") (sit-for 0)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3438 ; ... and renumber, in case necessary:
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3439 (goto-char subj-beg)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3440 (if (outline-goto-prefix)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3441 (outline-rebullet-heading nil ;;; solicit
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3442 (outline-depth) ;;; depth
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3443 nil ;;; number-control
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3444 nil ;;; index
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3445 t))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3446 (message ""))))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3447 (if (not resituate)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3448 (exchange-point-and-mark))))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3449 ;;;_ > outline-yank (&optional arg)
3430
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3450 (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
3451 "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
3452
13964
4de229297f1f (outline-primary-bullet, outline-numbered-bullet,
Karl Heuer <kwzh@gnu.org>
parents: 13337
diff changeset
3453 Non-topic yanks work no differently than normal yanks.
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3454
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3455 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
3456 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
3457
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3458 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
3459 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
3460 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
3461 topic prefix.
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3462
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3463 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
3464 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
3465 header into which it's being yanked.
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3466
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3467 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
3468 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
3469 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
3470 exactly like normal yanks.
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3471
13964
4de229297f1f (outline-primary-bullet, outline-numbered-bullet,
Karl Heuer <kwzh@gnu.org>
parents: 13337
diff changeset
3472 Numbering of yanked topics, and the successive siblings at the depth
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3473 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
3474
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3475 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
3476 works with normal yank in non-outline buffers."
3430
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3477
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3478 (interactive "*P")
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3479 (setq this-command 'yank)
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3480 (yank arg)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3481 (if (outline-mode-p)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3482 (outline-yank-processing)))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3483 ;;;_ > outline-yank-pop (&optional arg)
3430
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3484 (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
3485 "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
3486
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
3487 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
3488
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3489 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
3490 by pops to non-distinctive yanks. Bug..."
3430
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3491
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3492 (interactive "*p")
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3493 (setq this-command 'yank)
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3494 (yank-pop arg)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3495 (if (outline-mode-p)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3496 (outline-yank-processing)))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3497
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3498 ;;;_ - Specialty bullet functions
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3499 ;;;_ : File Cross references
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3500 ;;;_ > outline-resolve-xref ()
3430
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3501 (defun outline-resolve-xref ()
7416
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
3502 "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
3503
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
3504 \(Works according to setting of `outline-file-xref-bullet')."
3430
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3505 (interactive)
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3506 (if (not outline-file-xref-bullet)
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3507 (error
15664
a50ebf4ac764 (outline-auto-activation, outline-layout)
Karl Heuer <kwzh@gnu.org>
parents: 15663
diff changeset
3508 "outline cross references disabled - no `outline-file-xref-bullet'")
3430
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3509 (if (not (string= (outline-current-bullet) outline-file-xref-bullet))
15664
a50ebf4ac764 (outline-auto-activation, outline-layout)
Karl Heuer <kwzh@gnu.org>
parents: 15663
diff changeset
3510 (error "current heading lacks cross-reference bullet `%s'"
3430
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3511 outline-file-xref-bullet)
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3512 (let (file-name)
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3513 (save-excursion
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3514 (let* ((text-start outline-recent-prefix-end)
15663
4f762e6ae80a (outline-resolve-xref): Do not mistake a blank line
Karl Heuer <kwzh@gnu.org>
parents: 14416
diff changeset
3515 (heading-end (progn (end-of-line) (point))))
3430
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3516 (goto-char text-start)
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3517 (setq file-name
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3518 (if (re-search-forward "\\s-\\(\\S-*\\)" heading-end t)
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3519 (buffer-substring (match-beginning 1) (match-end 1))))))
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3520 (setq file-name
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3521 (if (not (= (aref file-name 0) ?:))
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3522 (expand-file-name file-name)
15664
a50ebf4ac764 (outline-auto-activation, outline-layout)
Karl Heuer <kwzh@gnu.org>
parents: 15663
diff changeset
3523 ; A registry-files ref, strip the `:'
3430
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3524 ; and try to follow it:
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3525 (let ((reg-ref (reference-registered-file
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3526 (substring file-name 1) nil t)))
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3527 (if reg-ref (car (cdr reg-ref))))))
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3528 (if (or (file-exists-p file-name)
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3529 (if (file-writable-p file-name)
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3530 (y-or-n-p (format "%s not there, create one? "
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3531 file-name))
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3532 (error "%s not found and can't be created" file-name)))
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3533 (condition-case failure
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3534 (find-file-other-window file-name)
29490
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
3535 ('error failure))
3430
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3536 (error "%s not found" file-name))
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3537 )
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3538 )
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3539 )
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3540 )
7416
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
3541
29490
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
3542 ;;;_ #6 Exposure Control
7218
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 ;;;_ - Fundamental
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3545 ;;;_ > outline-flag-current-subtree (flag)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3546 (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
3547 "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
3548
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
3549 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
3550
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3551 (save-excursion
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3552 (outline-back-to-current-heading)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3553 (outline-flag-region (point)
7416
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
3554 (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
3555 flag)))
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3556
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3557 ;;;_ - Topic-specific
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3558 ;;;_ > outline-show-entry ()
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3559 (defun outline-show-entry ()
7416
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
3560 "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
3561
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3562 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
3563 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
3564 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
3565 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
3566
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3567 (interactive)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3568 (save-excursion
29490
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
3569 (let ((at (point))
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
3570 beg end)
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
3571 (outline-goto-prefix)
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
3572 (setq beg (if (= (preceding-char) ?\r) (1- (point)) (point)))
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
3573 (re-search-forward "[\n\r]" nil t)
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
3574 (setq end (1- (if (< at (point))
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
3575 ;; We're on topic head line - show only it:
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
3576 (point)
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
3577 ;; or we're in body - include it:
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
3578 (max beg (or (outline-pre-next-preface) (point))))))
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
3579 (outline-flag-region beg end ?\n)
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
3580 (list beg end))))
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3581 ;;;_ > outline-show-children (&optional level strict)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3582 (defun outline-show-children (&optional level strict)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3583
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3584 "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
3585
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3586 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
3587
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3588 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
3589 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
3590
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3591 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
3592 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
3593 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
3594 it.
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
3595
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
3596 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
3597 point of non-opened subtree?)"
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3598
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3599 (interactive "p")
7416
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
3600 (let (max-pos)
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
3601 (if (and (not strict)
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
3602 (outline-hidden-p))
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
3603
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
3604 (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
3605 ; expose it.
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
3606 ;; 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
3607 ;; infinite regress:
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
3608 (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
3609
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
3610 (save-excursion
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
3611 (save-restriction
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
3612 (let* ((start-pt (point))
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
3613 (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
3614 (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
3615 (goto-char start-pt)
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
3616 (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
3617 ;; 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
3618 ;; unless strict was set.
29490
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
3619 (progn
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
3620 (outline-flag-region (point) (outline-snug-back) ?\n)
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
3621 (if outline-show-bodies
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
3622 (progn (goto-char (car to-reveal))
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
3623 (outline-show-current-entry)))))
7416
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
3624 (while to-reveal
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
3625 (goto-char (car to-reveal))
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
3626 (outline-flag-region (point) (outline-snug-back) ?\n)
29490
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
3627 (if outline-show-bodies
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
3628 (progn (goto-char (car to-reveal))
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
3629 (outline-show-current-entry)))
7416
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
3630 (setq to-reveal (cdr to-reveal)))))))))
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3631 ;;;_ > outline-hide-point-reconcile ()
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3632 (defun outline-hide-reconcile ()
7416
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
3633 "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
3634
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3635 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
3636 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
3637 (interactive)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3638 (save-excursion
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3639 (outline-goto-prefix)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3640 (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
3641 (progn (outline-pre-next-preface)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3642 (if (= ?\r (following-char))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3643 (point)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3644 (1- (point))))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3645 ?\r)))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3646 ;;;_ > outline-show-to-offshoot ()
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3647 (defun outline-show-to-offshoot ()
29490
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
3648 "Like outline-show-entry, but reveals all concealed ancestors, as well.
7416
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
3649
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
3650 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
3651 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
3652
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3653 (interactive)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3654 (save-excursion
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3655 (let ((orig-pt (point))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3656 (orig-pref (outline-goto-prefix))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3657 (last-at (point))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3658 bag-it)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3659 (while (or bag-it (= (preceding-char) ?\r))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3660 (beginning-of-line)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3661 (if (= last-at (setq last-at (point)))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3662 ;; 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
3663 ;; topic completely, and bag this try.
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3664 (progn (beginning-of-line)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3665 (outline-show-current-subtree)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3666 (goto-char orig-pt)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3667 (setq bag-it t)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3668 (beep)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3669 (message "%s: %s"
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3670 "outline-show-to-offshoot: "
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3671 "Aberrant nesting encountered.")))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3672 (outline-show-children)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3673 (goto-char orig-pref))
7416
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
3674 (goto-char orig-pt)))
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
3675 (if (outline-hidden-p)
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
3676 (outline-show-entry)))
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3677 ;;;_ > outline-hide-current-entry ()
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3678 (defun outline-hide-current-entry ()
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3679 "Hide the body directly following this heading."
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3680 (interactive)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3681 (outline-back-to-current-heading)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3682 (save-excursion
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3683 (outline-flag-region (point)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3684 (progn (outline-end-of-current-entry) (point))
29490
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
3685 ?\r)))
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3686 ;;;_ > outline-show-current-entry (&optional arg)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3687 (defun outline-show-current-entry (&optional arg)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3688
7416
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
3689 "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
3690
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3691 (interactive "P")
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3692 (if arg
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3693 (outline-hide-current-entry)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3694 (save-excursion
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3695 (outline-flag-region (point)
7416
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
3696 (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
3697 ?\n))))
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3698 ;;;_ > outline-hide-current-entry-completely ()
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3699 ; ... 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
3700 (defun outline-hide-current-entry-completely ()
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3701 "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
3702
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3703 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
3704 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
3705 (interactive)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3706 (save-excursion
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3707 (outline-goto-prefix)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3708 (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
3709 (progn (outline-pre-next-preface)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3710 (if (= ?\r (following-char))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3711 (point)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3712 (1- (point))))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3713 ?\r)))
7416
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
3714 ;;;_ > 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
3715 (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
3716 "Show everything within the current topic. With a repeat-count,
15664
a50ebf4ac764 (outline-auto-activation, outline-layout)
Karl Heuer <kwzh@gnu.org>
parents: 15663
diff changeset
3717 expose this topic and its siblings."
7416
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
3718 (interactive "P")
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
3719 (save-excursion
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
3720 (if (<= (outline-current-depth) 0)
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
3721 ;; 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
3722 (if (not (outline-next-heading))
38431
853c3674f20a Fixes to follow coding conventions.
Pavel Janík <Pavel@Janik.cz>
parents: 38250
diff changeset
3723 (error "No topics")
7416
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
3724 ;; 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
3725 (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
3726 (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
3727 (if (not arg)
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
3728 (outline-flag-current-subtree ?\n)
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
3729 (outline-beginning-of-level)
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
3730 (outline-expose-topic '(* :))))))
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3731 ;;;_ > outline-hide-current-subtree (&optional just-close)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3732 (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
3733 "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
3734
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
3735 If this topic is closed and it's a top level topic, close this topic
15664
a50ebf4ac764 (outline-auto-activation, outline-layout)
Karl Heuer <kwzh@gnu.org>
parents: 15663
diff changeset
3736 and its siblings.
7416
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
3737
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
3738 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
3739 siblings, even if the target topic is already closed."
3430
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3740
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3741 (interactive)
7416
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
3742 (let ((from (point))
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
3743 (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
3744 (if (not (outline-goto-prefix))
38431
853c3674f20a Fixes to follow coding conventions.
Pavel Janík <Pavel@Janik.cz>
parents: 38250
diff changeset
3745 (error "No topics found")
7416
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
3746 (end-of-line)(point)))))
29490
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
3747 (outline-flag-current-subtree ?\r)
7416
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
3748 (goto-char from)
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
3749 (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
3750 (end-of-line)
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
3751 (point)))
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
3752 (not just-close)
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3753 ;; 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
3754 (goto-char from)
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
3755 (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
3756 t
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
3757 (goto-char 0)
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
3758 (let ((msg
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
3759 "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
3760 (message msg)
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
3761 (outline-expose-topic '(0 :))
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
3762 (message (concat msg " Done.")))
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
3763 nil)
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
3764 (/= (outline-recent-depth) 0))
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
3765 (outline-hide-current-subtree))
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
3766 (goto-char from)))
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3767 ;;;_ > outline-show-current-branches ()
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3768 (defun outline-show-current-branches ()
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3769 "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
3770 (interactive)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3771 (beginning-of-line)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3772 (outline-show-children t))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3773 ;;;_ > outline-hide-current-leaves ()
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3774 (defun outline-hide-current-leaves ()
15664
a50ebf4ac764 (outline-auto-activation, outline-layout)
Karl Heuer <kwzh@gnu.org>
parents: 15663
diff changeset
3775 "Hide the bodies of the current topic and all its offspring."
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3776 (interactive)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3777 (outline-back-to-current-heading)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3778 (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
3779 (point))))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3780
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3781 ;;;_ - Region and beyond
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3782 ;;;_ > outline-show-all ()
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3783 (defun outline-show-all ()
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3784 "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
3785 (interactive)
7416
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
3786 (message "Exposing entire buffer...")
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
3787 (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
3788 (message "Exposing entire buffer... Done."))
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3789 ;;;_ > outline-hide-bodies ()
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3790 (defun outline-hide-bodies ()
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3791 "Hide all of buffer except headings."
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3792 (interactive)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3793 (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
3794 ;;;_ > outline-hide-region-body (start end)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3795 (defun outline-hide-region-body (start end)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3796 "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
3797 (save-excursion
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3798 (save-restriction
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3799 (narrow-to-region start end)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3800 (goto-char (point-min))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3801 (while (not (eobp))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3802 (outline-flag-region (point)
29490
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
3803 (progn (outline-pre-next-preface) (point)) ?\r)
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3804 (if (not (eobp))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3805 (forward-char
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3806 (if (looking-at "[\n\r][\n\r]")
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3807 2 1)))))))
7416
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
3808
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
3809 ;;;_ > outline-expose-topic (spec)
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
3810 (defun outline-expose-topic (spec)
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
3811 "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
3812
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
3813 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
3814 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
3815 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
3816 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
3817
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3818 Cursor is left at start position.
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3819
7416
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
3820 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
3821
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
3822 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
3823
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3824 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
3825 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
3826
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
3827 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
3828 subtopics of the current topic.
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
3829
15664
a50ebf4ac764 (outline-auto-activation, outline-layout)
Karl Heuer <kwzh@gnu.org>
parents: 15663
diff changeset
3830 The `:' repeat spec is used to specify exposure for any number of
7416
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
3831 successive siblings, up to the trailing ones for which there are
15664
a50ebf4ac764 (outline-auto-activation, outline-layout)
Karl Heuer <kwzh@gnu.org>
parents: 15663
diff changeset
3832 explicit specs following the `:'.
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3833
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3834 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
3835
7416
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
3836 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
3837 - 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
3838 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
3839 that level.
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
3840 - 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
3841 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
3842 - 0 means to close topic - hide all offspring.
15664
a50ebf4ac764 (outline-auto-activation, outline-layout)
Karl Heuer <kwzh@gnu.org>
parents: 15663
diff changeset
3843 : - `repeat'
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3844 apply prior element to all siblings at current level, *up to*
15664
a50ebf4ac764 (outline-auto-activation, outline-layout)
Karl Heuer <kwzh@gnu.org>
parents: 15663
diff changeset
3845 those siblings that would be covered by specs following the `:'
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3846 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
3847 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
3848 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
3849 * - 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
3850 + - 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
3851 - - 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
3852
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3853 Examples:
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3854 \(outline-expose-topic '(-1 : 0))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3855 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
3856 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
3857 at this current level completely.
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3858 \(outline-expose-topic '(-1 () : 1 0))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3859 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
3860 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
3861 close the last one.
7416
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
3862 \(outline-expose-topic '(-2 : -1 *))
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3863 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
3864 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
3865 last and completely open the last one."
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3866
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3867 (interactive "xExposure spec: ")
7416
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
3868 (if (not (listp spec))
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
3869 nil
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
3870 (let ((depth (outline-depth))
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
3871 (max-pos 0)
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
3872 prev-elem curr-elem
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
3873 stay done
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
3874 snug-back
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
3875 )
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
3876 (while spec
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
3877 (setq prev-elem curr-elem
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
3878 curr-elem (car spec)
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
3879 spec (cdr spec))
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
3880 (cond ; Do current element:
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
3881 ((null curr-elem) nil)
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
3882 ((symbolp curr-elem)
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
3883 (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
3884 (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
3885 (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
3886 ((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
3887 (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
3888 (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
3889 ((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
3890 ((eq curr-elem ':)
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
3891 (setq stay t)
15664
a50ebf4ac764 (outline-auto-activation, outline-layout)
Karl Heuer <kwzh@gnu.org>
parents: 15663
diff changeset
3892 ;; Expand the `repeat' spec to an explicit version,
7416
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
3893 ;; w.r.t. remaining siblings:
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
3894 (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
3895 ;; 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
3896 (- (length (outline-chart-siblings))
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
3897 (length spec))))
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
3898 (if (< 0 residue)
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
3899 ;; 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
3900 (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
3901 spec)))))))
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
3902 ((numberp curr-elem)
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
3903 (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
3904 (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
3905 (if (> 0 curr-elem)
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
3906 nil
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
3907 (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
3908 (setq max-pos
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
3909 outline-recent-end-of-subtree)))))
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
3910 (if (> (abs curr-elem) 0)
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
3911 (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
3912 (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
3913 (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
3914 ((listp curr-elem)
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
3915 (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
3916 (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
3917 (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
3918 (cond (stay (setq stay nil))
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
3919 ((listp (car spec)) nil)
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
3920 ((> max-pos (point))
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
3921 ;; 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
3922 (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
3923 (outline-next-heading)))
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
3924 ((outline-next-sibling depth))))
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
3925 max-pos)))
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3926 ;;;_ > outline-old-expose-topic (spec &rest followers)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3927 (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
3928
7416
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
3929 "Deprecated. Use outline-expose-topic \(with different schema
29490
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
3930 format) instead.
7416
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
3931
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
3932 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
3933
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3934 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
3935 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
3936
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3937 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
3938 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
3939 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
3940 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
3941 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
3942
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3943 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
3944
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3945 - 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
3946 - 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
3947 absolute value of the number.
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3948 - 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
3949 - 0 just closes
15664
a50ebf4ac764 (outline-auto-activation, outline-layout)
Karl Heuer <kwzh@gnu.org>
parents: 15663
diff changeset
3950 - `*' completely opens the topic, including bodies.
a50ebf4ac764 (outline-auto-activation, outline-layout)
Karl Heuer <kwzh@gnu.org>
parents: 15663
diff changeset
3951 - `+' shows all the sub headers, but not the bodies
a50ebf4ac764 (outline-auto-activation, outline-layout)
Karl Heuer <kwzh@gnu.org>
parents: 15663
diff changeset
3952 - `-' exposes the body and immediate offspring of the corresponding topic.
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3953
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3954 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
3955 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
3956 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
3957 for the corresponding offspring of the topic.
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3958
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3959 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
3960
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3961 (interactive "xExposure spec: ")
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3962 (let ((depth (outline-current-depth))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3963 done
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3964 max-pos)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3965 (cond ((null spec) nil)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3966 ((symbolp spec)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3967 (if (eq spec '*) (outline-show-current-subtree))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3968 (if (eq spec '+) (outline-show-current-branches))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3969 (if (eq spec '-) (outline-show-current-entry)))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3970 ((numberp spec)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3971 (if (>= 0 spec)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3972 (save-excursion (outline-hide-current-subtree t)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3973 (end-of-line)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3974 (if (or (not max-pos)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3975 (> (point) max-pos))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3976 (setq max-pos (point)))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3977 (if (> 0 spec)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3978 (setq spec (* -1 spec)))))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3979 (if (> spec 0)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3980 (outline-show-children spec)))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3981 ((listp spec)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3982 ;(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
3983 ; (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
3984 ; (setq max-pos got)))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3985 (let ((new-depth (+ (outline-current-depth) 1))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3986 got)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3987 (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
3988 (setq spec (cdr spec))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3989 (if (and spec
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3990 (outline-descend-to-depth new-depth)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3991 (not (outline-hidden-p)))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3992 (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
3993 (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
3994 (setq max-pos got)))))))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3995 (while (and followers
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3996 (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
3997 (progn (goto-char max-pos)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3998 (setq max-pos nil)))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3999 (end-of-line)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4000 (outline-next-sibling depth)))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4001 (outline-old-expose-topic (car followers))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4002 (setq followers (cdr followers)))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4003 max-pos))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4004 ;;;_ > outline-new-exposure '()
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4005 (defmacro outline-new-exposure (&rest spec)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4006 "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
4007 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
4008 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
4009
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4010 Cursor is left at start position.
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4011
15664
a50ebf4ac764 (outline-auto-activation, outline-layout)
Karl Heuer <kwzh@gnu.org>
parents: 15663
diff changeset
4012 Use this instead of obsolete `outline-exposure'.
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4013
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4014 Examples:
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4015 \(outline-exposure (-1 () () () 1) 0)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4016 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
4017 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
4018 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
4019 \(outline-exposure : -1 0)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4020 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
4021 immediate children, except for the last topic at the current
15664
a50ebf4ac764 (outline-auto-activation, outline-layout)
Karl Heuer <kwzh@gnu.org>
parents: 15663
diff changeset
4022 level, in which even its immediate children are hidden.
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4023 \(outline-exposure -2 : -1 *)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4024 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
4025 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
4026 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
4027 (list 'save-excursion
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4028 '(if (not (or (outline-goto-prefix)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4029 (outline-next-heading)))
38431
853c3674f20a Fixes to follow coding conventions.
Pavel Janík <Pavel@Janik.cz>
parents: 38250
diff changeset
4030 (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
4031 (list 'outline-expose-topic (list 'quote spec))))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4032 ;;;_ > outline-exposure '()
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4033 (defmacro outline-exposure (&rest spec)
15664
a50ebf4ac764 (outline-auto-activation, outline-layout)
Karl Heuer <kwzh@gnu.org>
parents: 15663
diff changeset
4034 "Being deprecated - use more recent `outline-new-exposure' instead.
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4035
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4036 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
4037 and retains start position."
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4038 (list 'save-excursion
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4039 '(if (not (or (outline-goto-prefix)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4040 (outline-next-heading)))
38431
853c3674f20a Fixes to follow coding conventions.
Pavel Janík <Pavel@Janik.cz>
parents: 38250
diff changeset
4041 (error "Can't find any outline topics"))
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4042 (cons 'outline-old-expose-topic
29490
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
4043 (mapcar (function (lambda (x) (list 'quote x))) spec))))
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
4044
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
4045 ;;;_ #7 Systematic outline presentation - copying, printing, flattening
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
4046
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
4047 ;;;_ - Mapping and processing of topics
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
4048 ;;;_ ( See also Subtree Charting, in Navigation code.)
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
4049 ;;;_ > outline-stringify-flat-index (flat-index)
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
4050 (defun outline-stringify-flat-index (flat-index &optional context)
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
4051 "Convert list representing section/subsection/... to document string.
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
4052
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
4053 Optional arg CONTEXT indicates interior levels to include."
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
4054 (let ((delim ".")
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
4055 result
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
4056 numstr
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
4057 (context-depth (or (and context 2) 1)))
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
4058 ;; Take care of the explicit context:
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
4059 (while (> context-depth 0)
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
4060 (setq numstr (int-to-string (car flat-index))
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
4061 flat-index (cdr flat-index)
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
4062 result (if flat-index
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
4063 (cons delim (cons numstr result))
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
4064 (cons numstr result))
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
4065 context-depth (if flat-index (1- context-depth) 0)))
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
4066 (setq delim " ")
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
4067 ;; Take care of the indentation:
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
4068 (if flat-index
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
4069 (progn
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
4070 (while flat-index
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
4071 (setq result
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
4072 (cons delim
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
4073 (cons (make-string
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
4074 (1+ (truncate (if (zerop (car flat-index))
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
4075 1
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
4076 (log10 (car flat-index)))))
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
4077 ? )
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
4078 result)))
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
4079 (setq flat-index (cdr flat-index)))
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
4080 ;; Dispose of single extra delim:
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
4081 (setq result (cdr result))))
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
4082 (apply 'concat result)))
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
4083 ;;;_ > outline-stringify-flat-index-plain (flat-index)
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
4084 (defun outline-stringify-flat-index-plain (flat-index)
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
4085 "Convert list representing section/subsection/... to document string."
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
4086 (let ((delim ".")
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
4087 result)
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
4088 (while flat-index
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
4089 (setq result (cons (int-to-string (car flat-index))
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
4090 (if result
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
4091 (cons delim result))))
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
4092 (setq flat-index (cdr flat-index)))
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
4093 (apply 'concat result)))
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
4094 ;;;_ > outline-stringify-flat-index-indented (flat-index)
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
4095 (defun outline-stringify-flat-index-indented (flat-index)
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
4096 "Convert list representing section/subsection/... to document string."
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
4097 (let ((delim ".")
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
4098 result
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
4099 numstr)
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
4100 ;; Take care of the explicit context:
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
4101 (setq numstr (int-to-string (car flat-index))
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
4102 flat-index (cdr flat-index)
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
4103 result (if flat-index
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
4104 (cons delim (cons numstr result))
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
4105 (cons numstr result)))
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
4106 (setq delim " ")
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
4107 ;; Take care of the indentation:
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
4108 (if flat-index
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
4109 (progn
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
4110 (while flat-index
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
4111 (setq result
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
4112 (cons delim
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
4113 (cons (make-string
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
4114 (1+ (truncate (if (zerop (car flat-index))
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
4115 1
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
4116 (log10 (car flat-index)))))
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
4117 ? )
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
4118 result)))
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
4119 (setq flat-index (cdr flat-index)))
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
4120 ;; Dispose of single extra delim:
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
4121 (setq result (cdr result))))
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
4122 (apply 'concat result)))
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
4123 ;;;_ > outline-listify-exposed (&optional start end format)
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
4124 (defun outline-listify-exposed (&optional start end format)
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
4125
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
4126 "Produce a list representing exposed topics in current region.
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
4127
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
4128 This list can then be used by `outline-process-exposed' to manipulate
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
4129 the subject region.
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
4130
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
4131 Optional START and END indicate bounds of region.
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
4132
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
4133 optional arg, FORMAT, designates an alternate presentation form for
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
4134 the prefix:
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
4135
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
4136 list - Present prefix as numeric section.subsection..., starting with
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
4137 section indicated by the list, innermost nesting first.
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
4138 `indent' \(symbol) - Convert header prefixes to all white space,
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
4139 except for distinctive bullets.
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
4140
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
4141 The elements of the list produced are lists that represents a topic
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
4142 header and body. The elements of that list are:
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
4143
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
4144 - a number representing the depth of the topic,
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
4145 - a string representing the header-prefix, including trailing whitespace and
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
4146 bullet.
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
4147 - a string representing the bullet character,
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
4148 - and a series of strings, each containing one line of the exposed
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
4149 portion of the topic entry."
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
4150
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
4151 (interactive "r")
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
4152 (save-excursion
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
4153 (let*
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
4154 ;; state vars:
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
4155 (strings prefix pad result depth new-depth out gone-out bullet beg
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
4156 next done)
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
4157
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
4158 (goto-char start)
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
4159 (beginning-of-line)
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
4160 ;; Goto initial topic, and register preceeding stuff, if any:
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
4161 (if (> (outline-goto-prefix) start)
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
4162 ;; First topic follows beginning point - register preliminary stuff:
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
4163 (setq result (list (list 0 "" nil
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
4164 (buffer-substring start (1- (point)))))))
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
4165 (while (and (not done)
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
4166 (not (eobp)) ; Loop until we've covered the region.
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
4167 (not (> (point) end)))
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
4168 (setq depth (outline-recent-depth) ; Current topics depth,
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
4169 bullet (outline-recent-bullet) ; ... bullet,
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
4170 prefix (outline-recent-prefix)
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
4171 beg (progn (outline-end-of-prefix t) (point))) ; and beginning.
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
4172 (setq done ; The boundary for the current topic:
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
4173 (not (outline-next-visible-heading 1)))
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
4174 (setq new-depth (outline-recent-depth))
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
4175 (setq gone-out out
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
4176 out (< new-depth depth))
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
4177 (beginning-of-line)
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
4178 (setq next (point))
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
4179 (goto-char beg)
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
4180 (setq strings nil)
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
4181 (while (> next (point)) ; Get all the exposed text in
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
4182 (setq strings
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
4183 (cons (buffer-substring
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
4184 beg
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
4185 ;To hidden text or end of line:
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
4186 (progn
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
4187 (search-forward "\r"
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
4188 (save-excursion (end-of-line)
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
4189 (point))
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
4190 1)
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
4191 (if (= (preceding-char) ?\r)
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
4192 (1- (point))
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
4193 (point))))
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
4194 strings))
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
4195 (if (< (point) next) ; Resume from after hid text, if any.
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
4196 (forward-line 1))
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
4197 (setq beg (point)))
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
4198 ;; Accumulate list for this topic:
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
4199 (setq strings (nreverse strings))
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
4200 (setq result
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
4201 (cons
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
4202 (if format
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
4203 (let ((special (if (string-match
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
4204 (regexp-quote bullet)
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
4205 outline-distinctive-bullets-string)
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
4206 bullet)))
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
4207 (cond ((listp format)
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
4208 (list depth
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
4209 (if outline-abbreviate-flattened-numbering
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
4210 (outline-stringify-flat-index format
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
4211 gone-out)
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
4212 (outline-stringify-flat-index-plain
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
4213 format))
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
4214 strings
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
4215 special))
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
4216 ((eq format 'indent)
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
4217 (if special
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
4218 (list depth
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
4219 (concat (make-string (1+ depth) ? )
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
4220 (substring prefix -1))
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
4221 strings)
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
4222 (list depth
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
4223 (make-string depth ? )
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
4224 strings)))
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
4225 (t (error "outline-listify-exposed: %s %s"
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
4226 "invalid format" format))))
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
4227 (list depth prefix strings))
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
4228 result))
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
4229 ;; Reasses format, if any:
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
4230 (if (and format (listp format))
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
4231 (cond ((= new-depth depth)
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
4232 (setq format (cons (1+ (car format))
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
4233 (cdr format))))
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
4234 ((> new-depth depth) ; descending - assume by 1:
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
4235 (setq format (cons 1 format)))
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
4236 (t
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
4237 ; Pop the residue:
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
4238 (while (< new-depth depth)
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
4239 (setq format (cdr format))
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
4240 (setq depth (1- depth)))
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
4241 ; And increment the current one:
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
4242 (setq format
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
4243 (cons (1+ (or (car format)
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
4244 -1))
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
4245 (cdr format)))))))
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
4246 ;; Put the list with first at front, to last at back:
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
4247 (nreverse result))))
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
4248 ;;;_ > outline-process-exposed (&optional func from to frombuf
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
4249 ;;; tobuf format)
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
4250 (defun outline-process-exposed (&optional func from to frombuf tobuf
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
4251 format &optional start-num)
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
4252 "Map function on exposed parts of current topic; results to another buffer.
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
4253
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
4254 All args are options; default values itemized below.
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
4255
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
4256 Apply FUNCTION to exposed portions FROM position TO position in buffer
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
4257 FROMBUF to buffer TOBUF. Sixth optional arg, FORMAT, designates an
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
4258 alternate presentation form:
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
4259
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
4260 `flat' - Present prefix as numeric section.subsection..., starting with
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
4261 section indicated by the start-num, innermost nesting first.
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
4262 X`flat-indented' - Prefix is like `flat' for first topic at each
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
4263 X level, but subsequent topics have only leaf topic
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
4264 X number, padded with blanks to line up with first.
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
4265 `indent' \(symbol) - Convert header prefixes to all white space,
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
4266 except for distinctive bullets.
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
4267
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
4268 Defaults:
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
4269 FUNCTION: `outline-insert-listified'
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
4270 FROM: region start, if region active, else start of buffer
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
4271 TO: region end, if region active, else end of buffer
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
4272 FROMBUF: current buffer
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
4273 TOBUF: buffer name derived: \"*current-buffer-name exposed*\"
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
4274 FORMAT: nil"
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
4275
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
4276 ; Resolve arguments,
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
4277 ; defaulting if necessary:
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
4278 (if (not func) (setq func 'outline-insert-listified))
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
4279 (if (not (and from to))
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
4280 (if (my-region-active-p)
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
4281 (setq from (region-beginning) to (region-end))
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
4282 (setq from (point-min) to (point-max))))
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
4283 (if frombuf
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
4284 (if (not (bufferp frombuf))
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
4285 ;; Specified but not a buffer - get it:
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
4286 (let ((got (get-buffer frombuf)))
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
4287 (if (not got)
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
4288 (error (concat "outline-process-exposed: source buffer "
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
4289 frombuf
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
4290 " not found."))
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
4291 (setq frombuf got))))
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
4292 ;; not specified - default it:
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
4293 (setq frombuf (current-buffer)))
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
4294 (if tobuf
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
4295 (if (not (bufferp tobuf))
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
4296 (setq tobuf (get-buffer-create tobuf)))
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
4297 ;; not specified - default it:
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
4298 (setq tobuf (concat "*" (buffer-name frombuf) " exposed*")))
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
4299 (if (listp format)
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
4300 (nreverse format))
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
4301
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
4302 (let* ((listified
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
4303 (progn (set-buffer frombuf)
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
4304 (outline-listify-exposed from to format))))
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
4305 (set-buffer tobuf)
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
4306 (mapcar func listified)
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
4307 (pop-to-buffer tobuf)))
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4308
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4309 ;;;_ - Copy exposed
29490
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
4310 ;;;_ > outline-insert-listified (listified)
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
4311 (defun outline-insert-listified (listified)
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
4312 "Insert contents of listified outline portion in current buffer.
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
4313
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
4314 Listified is a list representing each topic header and body:
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
4315
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
4316 \`(depth prefix text)'
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
4317
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
4318 or \`(depth prefix text bullet-plus)'
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
4319
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
4320 If `bullet-plus' is specified, it is inserted just after the entire prefix."
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
4321 (setq listified (cdr listified))
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
4322 (let ((prefix (prog1
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
4323 (car listified)
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
4324 (setq listified (cdr listified))))
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
4325 (text (prog1
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
4326 (car listified)
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
4327 (setq listified (cdr listified))))
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
4328 (bullet-plus (car listified)))
41571
2902b21d2034 (outline-version, outline-open-topic)
Pavel Janík <Pavel@Janik.cz>
parents: 38431
diff changeset
4329 (insert prefix)
2902b21d2034 (outline-version, outline-open-topic)
Pavel Janík <Pavel@Janik.cz>
parents: 38431
diff changeset
4330 (if bullet-plus (insert (concat " " bullet-plus)))
29490
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
4331 (while text
41571
2902b21d2034 (outline-version, outline-open-topic)
Pavel Janík <Pavel@Janik.cz>
parents: 38431
diff changeset
4332 (insert (car text))
29490
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
4333 (if (setq text (cdr text))
41571
2902b21d2034 (outline-version, outline-open-topic)
Pavel Janík <Pavel@Janik.cz>
parents: 38431
diff changeset
4334 (insert "\n")))
2902b21d2034 (outline-version, outline-open-topic)
Pavel Janík <Pavel@Janik.cz>
parents: 38431
diff changeset
4335 (insert "\n")))
29490
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
4336 ;;;_ > outline-copy-exposed-to-buffer (&optional arg tobuf format)
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
4337 (defun outline-copy-exposed-to-buffer (&optional arg tobuf format)
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
4338 "Duplicate exposed portions of current outline to another buffer.
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
4339
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
4340 Other buffer has current buffers name with \" exposed\" appended to it.
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
4341
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
4342 With repeat count, copy the exposed parts of only the current topic.
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
4343
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
4344 Optional second arg TOBUF is target buffer name.
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
4345
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
4346 Optional third arg FORMAT, if non-nil, symbolically designates an
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
4347 alternate presentation format for the outline:
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
4348
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
4349 `flat' - Convert topic header prefixes to numeric
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
4350 section.subsection... identifiers.
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
4351 `indent' - Convert header prefixes to all white space, except for
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
4352 distinctive bullets.
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
4353 `indent-flat' - The best of both - only the first of each level has
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
4354 the full path, the rest have only the section number
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
4355 of the leaf, preceded by the right amount of indentation."
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4356
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4357 (interactive "P")
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4358 (if (not tobuf)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4359 (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
4360 (let* ((start-pt (point))
29490
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
4361 (beg (if arg (outline-back-to-current-heading) (point-min)))
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
4362 (end (if arg (outline-end-of-current-subtree) (point-max)))
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
4363 (buf (current-buffer))
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
4364 (start-list ()))
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
4365 (if (eq format 'flat)
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
4366 (setq format (if arg (save-excursion
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
4367 (goto-char beg)
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
4368 (outline-topic-flat-index))
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
4369 '(1))))
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4370 (save-excursion (set-buffer tobuf)(erase-buffer))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4371 (outline-process-exposed 'outline-insert-listified
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4372 beg
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4373 end
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4374 (current-buffer)
29490
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
4375 tobuf
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
4376 format start-list)
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4377 (goto-char (point-min))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4378 (pop-to-buffer buf)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4379 (goto-char start-pt)))
29490
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
4380 ;;;_ > outline-flatten-exposed-to-buffer (&optional arg tobuf)
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
4381 (defun outline-flatten-exposed-to-buffer (&optional arg tobuf)
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
4382 "Present numeric outline of outline's exposed portions in another buffer.
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
4383
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
4384 The resulting outline is not compatable with outline mode - use
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
4385 `outline-copy-exposed-to-buffer' if you want that.
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
4386
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
4387 Use `outline-indented-exposed-to-buffer' for indented presentation.
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
4388
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
4389 With repeat count, copy the exposed portions of only current topic.
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
4390
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
4391 Other buffer has current buffers name with \" exposed\" appended to
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
4392 it, unless optional second arg TOBUF is specified, in which case it is
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
4393 used verbatim."
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
4394 (interactive "P")
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
4395 (outline-copy-exposed-to-buffer arg tobuf 'flat))
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
4396 ;;;_ > outline-indented-exposed-to-buffer (&optional arg tobuf)
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
4397 (defun outline-indented-exposed-to-buffer (&optional arg tobuf)
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
4398 "Present indented outline of outline's exposed portions in another buffer.
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
4399
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
4400 The resulting outline is not compatable with outline mode - use
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
4401 `outline-copy-exposed-to-buffer' if you want that.
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
4402
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
4403 Use `outline-flatten-exposed-to-buffer' for numeric sectional presentation.
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
4404
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
4405 With repeat count, copy the exposed portions of only current topic.
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
4406
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
4407 Other buffer has current buffers name with \" exposed\" appended to
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
4408 it, unless optional second arg TOBUF is specified, in which case it is
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
4409 used verbatim."
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
4410 (interactive "P")
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
4411 (outline-copy-exposed-to-buffer arg tobuf 'indent))
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4412
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4413 ;;;_ - LaTeX formatting
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4414 ;;;_ > outline-latex-verb-quote (str &optional flow)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4415 (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
4416 "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
4417 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
4418 string across latex processing."
29490
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
4419 (mapconcat (function
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
4420 (lambda (char)
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4421 (cond ((memq char '(?\\ ?$ ?% ?# ?& ?{ ?} ?_ ?^ ?- ?*))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4422 (concat "\\char" (number-to-string char) "{}"))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4423 ((= char ?\n) "\\\\")
29490
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
4424 (t (char-to-string char)))))
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4425 str
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4426 ""))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4427 ;;;_ > outline-latex-verbatim-quote-curr-line ()
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4428 (defun outline-latex-verbatim-quote-curr-line ()
29490
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
4429 "Express line for exact \(literal) representation across latex processing.
7416
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
4430
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
4431 Adjust line contents so it is unaltered \(from the original line)
15664
a50ebf4ac764 (outline-auto-activation, outline-layout)
Karl Heuer <kwzh@gnu.org>
parents: 15663
diff changeset
4432 across latex processing, within the context of a `verbatim'
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4433 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
4434 (beginning-of-line)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4435 (let ((beg (point))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4436 (end (progn (end-of-line)(point))))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4437 (goto-char beg)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4438 (while (re-search-forward "\\\\"
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4439 ;;"\\\\\\|\\{\\|\\}\\|\\_\\|\\$\\|\\\"\\|\\&\\|\\^\\|\\-\\|\\*\\|#"
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4440 end ; bounded by end-of-line
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4441 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
4442 (goto-char (match-beginning 0))
41571
2902b21d2034 (outline-version, outline-open-topic)
Pavel Janík <Pavel@Janik.cz>
parents: 38431
diff changeset
4443 (insert "\\")
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4444 (setq end (1+ end))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4445 (goto-char (1+ (match-end 0))))))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4446 ;;;_ > outline-insert-latex-header (buf)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4447 (defun outline-insert-latex-header (buf)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4448 "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
4449 ;; 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
4450 ;; the TeXBook, pg 421.
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4451 (set-buffer buf)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4452 (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
4453 "report"))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4454 (page-numbering (if outline-number-pages
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4455 "\\pagestyle{empty}\n"
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4456 ""))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4457 (linesdef (concat "\\def\\beginlines{"
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4458 "\\par\\begingroup\\nobreak\\medskip"
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4459 "\\parindent=0pt\n"
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4460 " \\kern1pt\\nobreak \\obeylines \\obeyspaces "
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4461 "\\everypar{\\strut}}\n"
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4462 "\\def\\endlines{"
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4463 "\\kern1pt\\endgroup\\medbreak\\noindent}\n"))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4464 (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
4465 outline-title-style))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4466 (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
4467 outline-label-style))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4468 (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
4469 outline-head-line-style))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4470 (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
4471 outline-body-line-style))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4472 (setlength (format "%s%s%s%s"
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4473 "\\newlength{\\stepsize}\n"
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4474 "\\setlength{\\stepsize}{"
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4475 outline-indent
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4476 "}\n"))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4477 (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
4478 "\\newcommand{\\OneHeadLine}[3]{%\n"
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4479 "\\noindent%\n"
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4480 "\\hspace*{#2\\stepsize}%\n"
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4481 "\\labelcmd{#1}\\hspace*{.2cm}"
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4482 "\\headlinecmd{#3}\\\\["
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4483 outline-line-skip
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4484 "]\n}\n"))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4485 (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
4486 "\\newcommand{\\OneBodyLine}[2]{%\n"
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4487 "\\noindent%\n"
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4488 "\\hspace*{#1\\stepsize}%\n"
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4489 "\\bodylinecmd{#2}\\\\["
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4490 outline-line-skip
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4491 "]\n}\n"))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4492 (begindoc "\\begin{document}\n\\begin{center}\n")
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4493 (title (format "%s%s%s%s"
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4494 "\\titlecmd{"
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4495 (outline-latex-verb-quote (if outline-title
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4496 (condition-case err
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4497 (eval outline-title)
29490
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
4498 ('error "<unnamed buffer>"))
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4499 "Unnamed Outline"))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4500 "}\n"
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4501 "\\end{center}\n\n"))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4502 (hsize "\\hsize = 7.5 true in\n")
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4503 (hoffset "\\hoffset = -1.5 true in\n")
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4504 (vspace "\\vspace{.1cm}\n\n"))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4505 (insert (concat doc-style
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4506 page-numbering
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4507 titlecmd
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4508 labelcmd
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4509 headlinecmd
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4510 bodylinecmd
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4511 setlength
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4512 oneheadline
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4513 onebodyline
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4514 begindoc
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4515 title
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4516 hsize
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4517 hoffset
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4518 vspace)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4519 )))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4520 ;;;_ > outline-insert-latex-trailer (buf)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4521 (defun outline-insert-latex-trailer (buf)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4522 "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
4523 (set-buffer buf)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4524 (insert "\n\\end{document}\n"))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4525 ;;;_ > 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
4526 (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
4527 "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
4528
29490
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
4529 Args are the topics numeric DEPTH, the header PREFIX lead string, the
7416
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
4530 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
4531 (let* ((head-line (if text (car text)))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4532 (body-lines (cdr text))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4533 (curr-line)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4534 body-content bop)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4535 ; Do the head line:
41571
2902b21d2034 (outline-version, outline-open-topic)
Pavel Janík <Pavel@Janik.cz>
parents: 38431
diff changeset
4536 (insert (concat "\\OneHeadLine{\\verb\1 "
2902b21d2034 (outline-version, outline-open-topic)
Pavel Janík <Pavel@Janik.cz>
parents: 38431
diff changeset
4537 (outline-latex-verb-quote bullet)
2902b21d2034 (outline-version, outline-open-topic)
Pavel Janík <Pavel@Janik.cz>
parents: 38431
diff changeset
4538 "\1}{"
2902b21d2034 (outline-version, outline-open-topic)
Pavel Janík <Pavel@Janik.cz>
parents: 38431
diff changeset
4539 depth
2902b21d2034 (outline-version, outline-open-topic)
Pavel Janík <Pavel@Janik.cz>
parents: 38431
diff changeset
4540 "}{\\verb\1 "
2902b21d2034 (outline-version, outline-open-topic)
Pavel Janík <Pavel@Janik.cz>
parents: 38431
diff changeset
4541 (if head-line
2902b21d2034 (outline-version, outline-open-topic)
Pavel Janík <Pavel@Janik.cz>
parents: 38431
diff changeset
4542 (outline-latex-verb-quote head-line)
2902b21d2034 (outline-version, outline-open-topic)
Pavel Janík <Pavel@Janik.cz>
parents: 38431
diff changeset
4543 "")
2902b21d2034 (outline-version, outline-open-topic)
Pavel Janík <Pavel@Janik.cz>
parents: 38431
diff changeset
4544 "\1}\n"))
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4545 (if (not body-lines)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4546 nil
41571
2902b21d2034 (outline-version, outline-open-topic)
Pavel Janík <Pavel@Janik.cz>
parents: 38431
diff changeset
4547 ;;(insert "\\beginlines\n")
2902b21d2034 (outline-version, outline-open-topic)
Pavel Janík <Pavel@Janik.cz>
parents: 38431
diff changeset
4548 (insert "\\begin{verbatim}\n")
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4549 (while body-lines
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4550 (setq curr-line (car body-lines))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4551 (if (and (not body-content)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4552 (not (string-match "^\\s-*$" curr-line)))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4553 (setq body-content t))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4554 ; Mangle any occurrences of
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4555 ; "\end{verbatim}" in text,
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4556 ; it's special:
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4557 (if (and body-content
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4558 (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
4559 (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
4560 ">"
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4561 (substring curr-line bop))))
41571
2902b21d2034 (outline-version, outline-open-topic)
Pavel Janík <Pavel@Janik.cz>
parents: 38431
diff changeset
4562 ;;(insert "|" (car body-lines) "|")
2902b21d2034 (outline-version, outline-open-topic)
Pavel Janík <Pavel@Janik.cz>
parents: 38431
diff changeset
4563 (insert curr-line)
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4564 (outline-latex-verbatim-quote-curr-line)
41571
2902b21d2034 (outline-version, outline-open-topic)
Pavel Janík <Pavel@Janik.cz>
parents: 38431
diff changeset
4565 (insert "\n")
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4566 (setq body-lines (cdr body-lines)))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4567 (if body-content
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4568 (setq body-content nil)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4569 (forward-char -1)
41571
2902b21d2034 (outline-version, outline-open-topic)
Pavel Janík <Pavel@Janik.cz>
parents: 38431
diff changeset
4570 (insert "\\ ")
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4571 (forward-char 1))
41571
2902b21d2034 (outline-version, outline-open-topic)
Pavel Janík <Pavel@Janik.cz>
parents: 38431
diff changeset
4572 ;;(insert "\\endlines\n")
2902b21d2034 (outline-version, outline-open-topic)
Pavel Janík <Pavel@Janik.cz>
parents: 38431
diff changeset
4573 (insert "\\end{verbatim}\n")
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4574 )))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4575 ;;;_ > outline-latexify-exposed (arg &optional tobuf)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4576 (defun outline-latexify-exposed (arg &optional tobuf)
29490
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
4577 "Format current topics exposed portions to TOBUF for latex processing.
7416
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
4578 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
4579 with \"*\" prepended and \" latex-formed*\" appended.
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4580
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4581 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
4582
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4583 (interactive "P")
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4584 (if (not tobuf)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4585 (setq tobuf
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4586 (get-buffer-create (concat "*" (buffer-name) " latexified*"))))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4587 (let* ((start-pt (point))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4588 (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
4589 (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
4590 (buf (current-buffer)))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4591 (set-buffer tobuf)
3430
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4592 (erase-buffer)
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4593 (outline-insert-latex-header tobuf)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4594 (goto-char (point-max))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4595 (outline-process-exposed 'outline-latexify-one-item
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4596 beg
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4597 end
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4598 buf
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4599 tobuf)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4600 (goto-char (point-max))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4601 (outline-insert-latex-trailer tobuf)
3430
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4602 (goto-char (point-min))
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4603 (pop-to-buffer buf)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4604 (goto-char start-pt)))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4605
29490
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
4606 ;;;_ #8 miscellaneous
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4607 ;;;_ > outline-mark-topic ()
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4608 (defun outline-mark-topic ()
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4609 "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
4610 (interactive)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4611 (beginning-of-line)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4612 (outline-goto-prefix)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4613 (push-mark (point))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4614 (outline-end-of-current-subtree)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4615 (exchange-point-and-mark))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4616 ;;;_ > outlineify-sticky ()
7416
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
4617 ;; 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
4618 (defalias 'outlinify-sticky 'outlineify-sticky)
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4619 (defun outlineify-sticky (&optional arg)
13964
4de229297f1f (outline-primary-bullet, outline-numbered-bullet,
Karl Heuer <kwzh@gnu.org>
parents: 13337
diff changeset
4620 "Activate outline mode and establish file var so it is started subsequently.
7416
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
4621
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
4622 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
4623 setup for auto-startup."
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
4624
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
4625 (interactive "P")
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
4626
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
4627 (outline-mode t)
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
4628
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
4629 (save-excursion
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
4630 (goto-char (point-min))
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
4631 (if (looking-at outline-regexp)
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
4632 t
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
4633 (outline-open-topic 2)
41571
2902b21d2034 (outline-version, outline-open-topic)
Pavel Janík <Pavel@Janik.cz>
parents: 38431
diff changeset
4634 (insert (concat "Dummy outline topic header - see"
2902b21d2034 (outline-version, outline-open-topic)
Pavel Janík <Pavel@Janik.cz>
parents: 38431
diff changeset
4635 "`outline-mode' docstring: `^Hm'."))
29490
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
4636 (forward-line 1)
3430
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4637 (goto-char (point-max))
29490
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
4638 (open-line 1)
7416
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
4639 (outline-open-topic 0)
41571
2902b21d2034 (outline-version, outline-open-topic)
Pavel Janík <Pavel@Janik.cz>
parents: 38431
diff changeset
4640 (insert "Local emacs vars.\n")
7416
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
4641 (outline-open-topic 1)
41571
2902b21d2034 (outline-version, outline-open-topic)
Pavel Janík <Pavel@Janik.cz>
parents: 38431
diff changeset
4642 (insert "(`outline-layout' is for allout.el outline-mode)\n")
7416
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
4643 (outline-open-topic 0)
41571
2902b21d2034 (outline-version, outline-open-topic)
Pavel Janík <Pavel@Janik.cz>
parents: 38431
diff changeset
4644 (insert "Local variables:\n")
7416
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
4645 (outline-open-topic 0)
41571
2902b21d2034 (outline-version, outline-open-topic)
Pavel Janík <Pavel@Janik.cz>
parents: 38431
diff changeset
4646 (insert (format "outline-layout: %s\n"
7416
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
4647 (or outline-layout
29490
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
4648 '(-1 : 0))))
7416
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
4649 (outline-open-topic 0)
41571
2902b21d2034 (outline-version, outline-open-topic)
Pavel Janík <Pavel@Janik.cz>
parents: 38431
diff changeset
4650 (insert "End:\n"))))
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4651 ;;;_ > solicit-char-in-string (prompt string &optional do-defaulting)
3430
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4652 (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
4653 "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
4654
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4655 Optional arg DO-DEFAULTING indicates to accept empty input (CR)."
3430
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4656
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4657 (let ((new-prompt prompt)
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4658 got)
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4659
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4660 (while (not got)
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4661 (message "%s" new-prompt)
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4662
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4663 ;; We do our own reading here, so we can circumvent, eg, special
29490
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
4664 ;; treatment for `?' character. (Oughta use minibuffer keymap instead.)
3430
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4665 (setq got
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4666 (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
4667
29490
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
4668 (setq got
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
4669 (cond ((string-match (regexp-quote got) string) got)
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
4670 ((and do-defaulting (string= got "\r"))
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
4671 ;; Return empty string to default:
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
4672 "")
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
4673 ((string= got "\C-g") (signal 'quit nil))
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
4674 (t
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
4675 (setq new-prompt (concat prompt
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
4676 got
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
4677 " ...pick from: "
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
4678 string
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
4679 ""))
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
4680 nil))))
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
4681 ;; got something out of loop - return it:
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
4682 got)
3430
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4683 )
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4684 ;;;_ > regexp-sans-escapes (string)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4685 (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
4686 "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
4687
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4688 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
4689 single backslash.
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4690
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4691 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
4692
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4693 (if (string= regexp "")
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4694 ""
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4695 ;; 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
4696 ;; backslash, or else to nil:
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4697 (setq successive-backslashes
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4698 (if (= (aref regexp 0) ?\\)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4699 (if successive-backslashes (1+ successive-backslashes) 1)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4700 nil))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4701 (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
4702 ;; Include first char:
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4703 (concat (substring regexp 0 1)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4704 (regexp-sans-escapes (substring regexp 1)))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4705 ;; Exclude first char, but maintain count:
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4706 (regexp-sans-escapes (substring regexp 1) successive-backslashes))))
29490
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
4707 ;;;_ > my-region-active-p ()
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
4708 (defmacro my-region-active-p ()
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
4709 (if (fboundp 'region-active-p)
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
4710 '(region-active-p)
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
4711 'mark-active))
7416
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
4712 ;;;_ - add-hook definition for divergent emacsen
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4713 ;;;_ > add-hook (hook function &optional append)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4714 (if (not (fboundp 'add-hook))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4715 (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
4716 "Add to the value of HOOK the function FUNCTION unless already present.
15664
a50ebf4ac764 (outline-auto-activation, outline-layout)
Karl Heuer <kwzh@gnu.org>
parents: 15663
diff changeset
4717 \(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
4718 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
4719 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
4720 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
4721 (or (boundp hook) (set hook nil))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4722 (or (if (consp function)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4723 ;; 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
4724 ;; is equal to anything in the hook.
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4725 (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
4726 (equal function tail))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4727 (memq function (symbol-value hook)))
15664
a50ebf4ac764 (outline-auto-activation, outline-layout)
Karl Heuer <kwzh@gnu.org>
parents: 15663
diff changeset
4728 (set hook
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4729 (if append
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4730 (nconc (symbol-value hook) (list function))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4731 (cons function (symbol-value hook)))))))
29490
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
4732 ;;;_ : my-mark-marker to accomodate divergent emacsen:
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
4733 (defun my-mark-marker (&optional force buffer)
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
4734 "Accomodate the different signature for mark-marker across emacsen.
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
4735
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
4736 GNU XEmacs takes two optional args, while mainline GNU Emacs does not,
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
4737 so pass them along when appropriate."
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
4738 (if (string-match " XEmacs " emacs-version)
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
4739 (mark-marker force buffer)
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
4740 (mark-marker)))
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
4741
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
4742 ;;;_ #9 Under development
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4743 ;;;_ > outline-bullet-isearch (&optional bullet)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4744 (defun outline-bullet-isearch (&optional bullet)
29490
81725432199b New version from Manheimer.
Dave Love <fx@gnu.org>
parents: 27269
diff changeset
4745 "Isearch \(regexp) for topic with bullet BULLET."
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4746 (interactive)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4747 (if (not bullet)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4748 (setq bullet (solicit-char-in-string
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4749 "ISearch for topic with bullet: "
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4750 (regexp-sans-escapes outline-bullets-string))))
15664
a50ebf4ac764 (outline-auto-activation, outline-layout)
Karl Heuer <kwzh@gnu.org>
parents: 15663
diff changeset
4751
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4752 (let ((isearch-regexp t)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4753 (isearch-string (concat "^"
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4754 outline-header-prefix
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4755 "[ \t]*"
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4756 bullet)))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4757 (isearch-repeat 'forward)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4758 (isearch-mode t)))
7416
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
4759 ;;;_ ? Re hooking up with isearch - use isearch-op-fun rather than
15664
a50ebf4ac764 (outline-auto-activation, outline-layout)
Karl Heuer <kwzh@gnu.org>
parents: 15663
diff changeset
4760 ;;; wrapping the isearch functions.
3430
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4761
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4762 ;;;_* Local emacs vars.
7416
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
4763 ;;; 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
4764 ;;; - 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
4765 ;;; - 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
4766 ;;; - 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
4767 ;;; - 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
4768 ;;;Local variables:
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
4769 ;;;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
4770 ;;;End:
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
4771
38431
853c3674f20a Fixes to follow coding conventions.
Pavel Janík <Pavel@Janik.cz>
parents: 38250
diff changeset
4772 ;;; allout.el ends here