annotate lisp/allout.el @ 14584:6674e3119d9e

(vip-event-key): ignore consp events.
author Michael Kifer <kifer@cs.stonybrook.edu>
date Fri, 16 Feb 1996 19:01:53 +0000
parents 3ec65c6789eb
children 4f762e6ae80a
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
13337
84acc3adcd63 Comment change.
Richard M. Stallman <rms@gnu.org>
parents: 11661
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
7527
1f09079e18c4 (outline-mode): Use outline-this-or-next-heading.
Richard M. Stallman <rms@gnu.org>
parents: 7476
diff changeset
3 ;; Copyright (C) 1992, 1993, 1994 Free Software Foundation, Inc.
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
5 ;; Author: Ken Manheimer <klm@nist.gov>
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
6 ;; Maintainer: Ken Manheimer <klm@nist.gov>
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
7 ;; Created: Dec 1991 - first release to usenet
7527
1f09079e18c4 (outline-mode): Use outline-this-or-next-heading.
Richard M. Stallman <rms@gnu.org>
parents: 7476
diff changeset
8 ;; Version: Id: allout.el,v 4.3 1994/05/12 17:43:08 klm Exp ||
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
9 ;; Keywords: outline mode
3430
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
7416
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
28 ;;;_* Commentary:
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
29
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
30 ;; Allout outline mode provides extensive outline formatting and
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
31 ;; manipulation capabilities, subsuming and well beyond that of
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
32 ;; standard emacs outline mode. It is specifically aimed at
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
33 ;; supporting outline structuring and manipulation of syntax-
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
34 ;; sensitive text, eg programming languages. (For an example, see the
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
35 ;; allout code itself, which is organized in outline structure.)
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
36 ;;
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
37 ;; It also includes such things as topic-oriented repositioning, cut, and
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
38 ;; paste; integral outline exposure-layout; incremental search with
13964
4de229297f1f (outline-primary-bullet, outline-numbered-bullet,
Karl Heuer <kwzh@gnu.org>
parents: 13337
diff changeset
39 ;; dynamic exposure/concealment of concealed text; automatic topic-number
7416
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
40 ;; maintenance; and many other features.
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
41 ;;
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
42 ;; See the docstring of the variables `outline-layout' and
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
43 ;; `outline-auto-activation' for details on automatic activation of
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
44 ;; allout outline-mode as a minor mode. (It has changed since allout
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
45 ;; 3.x, for those of you that depend on the old method.)
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
46 ;;
7416
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
47 ;; Note - the lines beginning with ';;;_' are outline topic headers.
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
48 ;; Just 'ESC-x eval-current-buffer' to give it a whirl.
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
49
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
50 ;;Ken Manheimer 301 975-3539
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
51 ;;ken.manheimer@nist.gov FAX: 301 963-9137
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
52 ;;
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
53 ;;Computer Systems and Communications Division
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
54 ;;
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
55 ;; Nat'l Institute of Standards and Technology
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
56 ;; Technology A151
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
57 ;; Gaithersburg, MD 20899
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
58
7416
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
59 ;;;_* Provide
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
60 (provide 'outline)
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
61 (provide 'allout)
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
62
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
63 ;;;_* USER CUSTOMIZATION VARIABLES:
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
64
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
65 ;;;_ + 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
66
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
67 ;;;_ = outline-auto-activation
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
68 (defvar outline-auto-activation nil
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
69 "*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
70
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
71 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
72 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
73 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
74 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
75
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
76 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
77 \(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
78 `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
79
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
80 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
81 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
82
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
83 With value `activate', only auto-mode-activation is enabled, auto-
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
84 layout is not.
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 `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
87 enabled.
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
88
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
89 See the docstring for `outline-init' for the proper interface to
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
90 this variable.")
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
91 ;;;_ = outline-layout
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
92 (defvar outline-layout nil
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
93 "*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
94
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
95 Buffer-specific.
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
96
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
97 A list value specifies a default layout for the current buffer, to be
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
98 applied upon activation of allout outline-mode. Any non-nil value
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
99 will automatically trigger allout outline-mode, provided `outline-
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
100 init' has been called to enable it.
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
101
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
102 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
103 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
104 the layout specification.
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
105
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
106 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
107 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
108 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
109
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
110 ;;;Local variables:
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
111 ;;;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
112 ;;;End:
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
113
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
114 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
115 activated when the file is visited, followed by the equivalent of
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
116 `\(outline-expose-topic 0 : -1 -1 0\)'. \(This is the layout used for
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
117 the allout.el, itself.)
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
118
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
119 Also, allout's mode-specific provisions will make topic prefixes
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
120 default to the comment-start string, if any, of the language of the
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
121 file. This is modulo the setting of `outline-use-mode-specific-
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
122 leader', which see.")
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
123 (make-variable-buffer-local 'outline-layout)
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
124
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
125 ;;;_ = outline-header-prefix
3430
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
126 (defvar outline-header-prefix "."
7416
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
127 "*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
128
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
129 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
130 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
131 \(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
132 character, which is typically set to the outline-primary-bullet. Many
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
133 outlines start at level 2 to avoid this discrepancy.")
3430
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
134 (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
135 ;;;_ = outline-primary-bullet
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
136 (defvar outline-primary-bullet "*"
7416
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
137 "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
138
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
139 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
140 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
141 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
142
13964
4de229297f1f (outline-primary-bullet, outline-numbered-bullet,
Karl Heuer <kwzh@gnu.org>
parents: 13337
diff changeset
143 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
144 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
145 and outline-distinctive-bullets-string for the range of available
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
146 bullets.")
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
147 (make-variable-buffer-local 'outline-primary-bullet)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
148 ;;;_ = outline-plain-bullets-string
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
149 (defvar outline-plain-bullets-string (concat outline-primary-bullet
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
150 "+-:.;,")
7416
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
151 "*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
152
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
153 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
154 bullets.
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
155
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
156 DO NOT include the close-square-bracket, ']', as a bullet.
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
157
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
158 Outline mode has to be reactivated in order for changes to the value
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
159 of this var to take effect.")
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
160 (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
161 ;;;_ = outline-distinctive-bullets-string
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
162 (defvar outline-distinctive-bullets-string "=>([{}&!?#%\"X@$~\\"
7416
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
163 "*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
164
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
165 These bullets are not offered among the regular, level-specific
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
166 rotation, and are not altered by automatic rebulleting, as when
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
167 shifting the level of a topic. See `outline-plain-bullets-string' for
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
168 the selection of alternating bullets.
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
169
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
170 You must run 'set-outline-regexp' in order for changes
7416
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
171 to the value of this var to effect outline-mode operation.
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
172
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
173 DO NOT include the close-square-bracket, ']', on either of the bullet
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
174 strings.")
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
175 (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
176
7416
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
177 ;;;_ = outline-use-mode-specific-leader
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
178 (defvar outline-use-mode-specific-leader t
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
179 "*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
180
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
181 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
182 and/or comment-start string, if any, to lead the topic prefix string,
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
183 so topic headers look like comments in the programming language.
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
184
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
185 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
186
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
187 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
188 alist, then use comment-start string, if any, then use default \(`.').
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
189 \(See note about use of comment-start strings, below.\)
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
190
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
191 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
192 `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
193
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
194 Value `nil' means to always use the default \(`.'\).
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
195
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
196 comment-start strings that do not end in spaces are tripled, and an
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
197 '_' underscore is tacked on the end, to distinguish them from regular
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
198 comment strings. comment-start strings that do end in spaces are not
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
199 tripled, but an underscore is substituted for the space. \[This
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
200 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
201 can use `outline-mode-leaders' to override this behavior, when
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
202 incorrect.\]")
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
203 ;;;_ = outline-mode-leaders
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
204 (defvar outline-mode-leaders '()
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
205 "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
206
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
207 Entries will be used in the stead (or lieu) of mode-specific
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
208 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
209
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
210 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
211 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
212 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
213 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
214
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
215 ;;;_ = outline-old-style-prefixes
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
216 (defvar outline-old-style-prefixes nil
7416
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
217 "*When non-nil, use only old-and-crusty outline-mode '*' topic prefixes.
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
218
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
219 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
220 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
221 like the original emacs-outline style prefixes.
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
222
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
223 Whatever the setting of this variable, both old and new style prefixes
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
224 are always respected by the topic maneuvering functions.")
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
225 (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
226 ;;;_ = outline-stylish-prefixes - alternating bullets
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
227 (defvar outline-stylish-prefixes t
7416
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
228 "*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
229
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
230 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
231 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
232 depth) just preceding the start of the topic text) according to level.
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
233 Otherwise, only asterisks ('*') and distinctive bullets are used.
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
234
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
235 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
236 prefixes:
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
237
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
238 * Top level
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
239 .* A topic
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
240 . + One level 3 subtopic
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
241 . . One level 4 subtopic
7416
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
242 . . A second 4 subtopic
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
243 . + Another level 3 subtopic
7416
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
244 . #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
245 . #2 Another
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
246 . ! 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
247 . #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
248
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
249 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
250 numbered and other distinctive bullets retained):
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
251
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
252 * Top level
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
253 .* A topic
7416
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
254 . * One level 3 subtopic
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
255 . * One level 4 subtopic
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
256 . * A second 4 subtopic
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
257 . * Another level 3 subtopic
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
258 . #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
259 . #2 Another
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
260 . ! 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
261 . #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
262
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
263 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
264 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
265 this variable setting.
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
266
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
267 The setting of this var is not relevant when outline-old-style-prefixes
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
268 is non-nil.")
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
269 (make-variable-buffer-local 'outline-stylish-prefixes)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
270
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
271 ;;;_ = outline-numbered-bullet
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
272 (defvar outline-numbered-bullet "#"
7416
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
273 "*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
274
13964
4de229297f1f (outline-primary-bullet, outline-numbered-bullet,
Karl Heuer <kwzh@gnu.org>
parents: 13337
diff changeset
275 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
276 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
277 to \"#\", you can set it to a bullet of your choice. A nil value
13964
4de229297f1f (outline-primary-bullet, outline-numbered-bullet,
Karl Heuer <kwzh@gnu.org>
parents: 13337
diff changeset
278 disables numbering maintenance.")
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
279 (make-variable-buffer-local 'outline-numbered-bullet)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
280 ;;;_ = outline-file-xref-bullet
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
281 (defvar outline-file-xref-bullet "@"
7416
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
282 "*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
283
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
284 Set this var to the bullet you want to use for file cross-references.
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
285 Set it 'nil' if you want to inhibit this capability.")
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
286
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
287 ;;;_ + LaTeX formatting
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
288 ;;;_ - outline-number-pages
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
289 (defvar outline-number-pages nil
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
290 "*Non-nil turns on page numbering for LaTeX formatting of an outline.")
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
291 ;;;_ - outline-label-style
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
292 (defvar outline-label-style "\\large\\bf"
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
293 "*Font and size of labels for LaTeX formatting of an outline.")
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
294 ;;;_ - outline-head-line-style
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
295 (defvar outline-head-line-style "\\large\\sl "
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
296 "*Font and size of entries for LaTeX formatting of an outline.")
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
297 ;;;_ - outline-body-line-style
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
298 (defvar outline-body-line-style " "
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
299 "*Font and size of entries for LaTeX formatting of an outline.")
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
300 ;;;_ - outline-title-style
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
301 (defvar outline-title-style "\\Large\\bf"
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
302 "*Font and size of titles for LaTeX formatting of an outline.")
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
303 ;;;_ - outline-title
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
304 (defvar outline-title '(or buffer-file-name (current-buffer-name))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
305 "*Expression to be evaluated to determine the title for LaTeX
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
306 formatted copy.")
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
307 ;;;_ - outline-line-skip
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
308 (defvar outline-line-skip ".05cm"
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
309 "*Space between lines for LaTeX formatting of an outline.")
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
310 ;;;_ - outline-indent
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
311 (defvar outline-indent ".3cm"
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
312 "*LaTeX formatted depth-indent spacing.")
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
313
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
314 ;;;_ + Miscellaneous customization
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 ;;;_ = outline-keybindings-list
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
317 ;;; You have to reactivate outline-mode - '(outline-mode t)' - to
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
318 ;;; institute changes to this var.
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
319 (defvar outline-keybindings-list ()
7416
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
320 "*List of outline-mode key / function bindings.
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
321
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
322 These bindings will be locally bound on the outline-mode-map. The
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
323 keys will be prefixed by outline-command-prefix, unless the cell
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
324 contains a third, no-nil element, in which case the initial string
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
325 will be used as is.")
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
326 (setq outline-keybindings-list
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
327 '(
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
328 ; Motion commands:
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
329 ("?t" outline-latexify-exposed)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
330 ("\C-n" outline-next-visible-heading)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
331 ("\C-p" outline-previous-visible-heading)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
332 ("\C-u" outline-up-current-level)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
333 ("\C-f" outline-forward-current-level)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
334 ("\C-b" outline-backward-current-level)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
335 ("\C-a" outline-beginning-of-current-entry)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
336 ("\C-e" outline-end-of-current-entry)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
337 ;;("\C-n" outline-next-line-or-topic)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
338 ;;("\C-p" outline-previous-line-or-topic)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
339 ; Exposure commands:
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
340 ("\C-i" outline-show-children)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
341 ("\C-s" outline-show-current-subtree)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
342 ("\C-h" outline-hide-current-subtree)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
343 ("\C-o" outline-show-current-entry)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
344 ("!" outline-show-all)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
345 ; Alteration commands:
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
346 (" " outline-open-sibtopic)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
347 ("." outline-open-subtopic)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
348 ("," outline-open-supertopic)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
349 ("'" outline-shift-in)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
350 (">" outline-shift-in)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
351 ("<" outline-shift-out)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
352 ("\C-m" outline-rebullet-topic)
11661
9ac485495712 (outline-rebullet-current-heading): Change to C-c *.
Karl Heuer <kwzh@gnu.org>
parents: 11034
diff changeset
353 ("*" outline-rebullet-current-heading)
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
354 ("#" outline-number-siblings)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
355 ("\C-k" outline-kill-line t)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
356 ("\C-y" outline-yank t)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
357 ("\M-y" outline-yank-pop t)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
358 ("\C-k" outline-kill-topic)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
359 ; Miscellaneous commands:
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
360 ("\C-@" outline-mark-topic)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
361 ("@" outline-resolve-xref)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
362 ("?c" outline-copy-exposed)))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
363
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
364 ;;;_ = outline-command-prefix
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
365 (defvar outline-command-prefix "\C-c"
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
366 "*Key sequence to be used as prefix for outline mode command key bindings.")
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
367
7416
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
368 ;;;_ = outline-enwrap-isearch-mode
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
369 (defvar outline-enwrap-isearch-mode t
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
370 "*Set non-nil to enable automatic exposure of concealed isearch targets.
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
371
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
372 If non-nil, isearch will expose hidden text encountered in the course
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
373 of a search, and to reconceal it if the search is continued past it.")
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
374
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
375 ;;;_ = outline-use-hanging-indents
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
376 (defvar outline-use-hanging-indents t
7416
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
377 "*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
378 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
379 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
380 where auto-fill occurs.
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
381
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
382 [This feature no longer depends in any way on the 'filladapt.el'
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
383 lisp-archive package.]")
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
384 (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
385
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
386 ;;;_ = outline-reindent-bodies
7527
1f09079e18c4 (outline-mode): Use outline-this-or-next-heading.
Richard M. Stallman <rms@gnu.org>
parents: 7476
diff changeset
387 (defvar outline-reindent-bodies (if outline-use-hanging-indents
1f09079e18c4 (outline-mode): Use outline-this-or-next-heading.
Richard M. Stallman <rms@gnu.org>
parents: 7476
diff changeset
388 'text)
7416
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
389 "*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
390
7527
1f09079e18c4 (outline-mode): Use outline-this-or-next-heading.
Richard M. Stallman <rms@gnu.org>
parents: 7476
diff changeset
391 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
392 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
393 the header.
1f09079e18c4 (outline-mode): Use outline-this-or-next-heading.
Richard M. Stallman <rms@gnu.org>
parents: 7476
diff changeset
394
1f09079e18c4 (outline-mode): Use outline-this-or-next-heading.
Richard M. Stallman <rms@gnu.org>
parents: 7476
diff changeset
395 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
396 those that do not have the variable `comment-start' set. A value of
1f09079e18c4 (outline-mode): Use outline-this-or-next-heading.
Richard M. Stallman <rms@gnu.org>
parents: 7476
diff changeset
397 `force' enables reindent whether or not `comment-start' is set.")
1f09079e18c4 (outline-mode): Use outline-this-or-next-heading.
Richard M. Stallman <rms@gnu.org>
parents: 7476
diff changeset
398
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
399 (make-variable-buffer-local 'outline-reindent-bodies)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
400
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
401 ;;;_ = outline-inhibit-protection
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
402 (defvar outline-inhibit-protection nil
7416
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
403 "*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
404
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
405 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
406 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
407 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
408
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
409 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
410 deactivate and then reactivate the mode if you want to toggle the
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
411 behavior.")
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
412
7416
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
413 ;;;_* CODE - no user customizations below.
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
414
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
415 ;;;_ #1 Internal Outline Formatting and Configuration
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
416 ;;;_ - Version
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
417 ;;;_ = outline-version
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
418 (defvar outline-version
7527
1f09079e18c4 (outline-mode): Use outline-this-or-next-heading.
Richard M. Stallman <rms@gnu.org>
parents: 7476
diff changeset
419 (let ((rcs-rev "Revision: 4.3"))
7416
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
420 (condition-case err
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
421 (save-match-data
7527
1f09079e18c4 (outline-mode): Use outline-this-or-next-heading.
Richard M. Stallman <rms@gnu.org>
parents: 7476
diff changeset
422 (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
423 (substring rcs-rev (match-beginning 1) (match-end 1)))
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
424 (error rcs-rev)))
7527
1f09079e18c4 (outline-mode): Use outline-this-or-next-heading.
Richard M. Stallman <rms@gnu.org>
parents: 7476
diff changeset
425 "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
426 ;;;_ > outline-version
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
427 (defun outline-version (&optional here)
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
428 "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
429 (interactive "P")
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
430 (let ((msg (concat "Allout Outline Mode v " outline-version)))
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
431 (if here (insert-string msg))
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
432 (message "%s" msg)
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
433 msg))
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
434 ;;;_ - Topic header format
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
435 ;;;_ = outline-regexp
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
436 (defvar outline-regexp ""
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
437 "*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
438
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
439 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
440 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
441 by set-outline-regexp.")
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
442 (make-variable-buffer-local 'outline-regexp)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
443 ;;;_ = outline-bullets-string
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
444 (defvar outline-bullets-string ""
7416
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
445 "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
446
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
447 This var should *not* be set by the user - it is set by 'set-outline-regexp',
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
448 and is produced from the elements of 'outline-plain-bullets-string'
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
449 and 'outline-distinctive-bullets-string'.")
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
450 (make-variable-buffer-local 'outline-bullets-string)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
451 ;;;_ = outline-bullets-string-len
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
452 (defvar outline-bullets-string-len 0
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
453 "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
454 (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
455 ;;;_ = outline-line-boundary-regexp
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
456 (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
457 "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
458
7639
67b7d1ea7b2e Doc fix.
Richard M. Stallman <rms@gnu.org>
parents: 7527
diff changeset
459 \(Ie, C-j, *or* C-m, for prefixes of hidden topics). This is properly
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
460 set when outline-regexp is produced by 'set-outline-regexp', so
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
461 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
462 (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
463 ;;;_ = outline-bob-regexp
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
464 (defvar outline-bob-regexp ()
7416
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
465 "Like outline-line-boundary-regexp, for headers at beginning of buffer.
7639
67b7d1ea7b2e Doc fix.
Richard M. Stallman <rms@gnu.org>
parents: 7527
diff changeset
466 \(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
467 (make-variable-buffer-local 'outline-bob-regexp)
3430
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
468 ;;;_ = outline-header-subtraction
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
469 (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
470 "Outline-header prefix length to subtract when computing topic depth.")
3430
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
471 (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
472 ;;;_ = outline-plain-bullets-string-len
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
473 (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
474 "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
475 (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
476
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
477
7527
1f09079e18c4 (outline-mode): Use outline-this-or-next-heading.
Richard M. Stallman <rms@gnu.org>
parents: 7476
diff changeset
478 ;;;_ X outline-reset-header-lead (header-lead)
3430
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
479 (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
480 "*Reset the leading string used to identify topic headers."
3430
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
481 (interactive "sNew lead string: ")
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
482 (setq outline-header-prefix header-lead)
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
483 (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
484 (set-outline-regexp))
7527
1f09079e18c4 (outline-mode): Use outline-this-or-next-heading.
Richard M. Stallman <rms@gnu.org>
parents: 7476
diff changeset
485 ;;;_ X outline-lead-with-comment-string (header-lead)
3430
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
486 (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
487 "*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
488
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
489 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
490 language comments. Returns the leading string."
3430
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
491
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
492 (interactive "P")
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
493 (if (not (stringp header-lead))
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
494 (setq header-lead (read-string
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
495 "String prefix for topic headers: ")))
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
496 (setq outline-reindent-bodies nil)
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
497 (outline-reset-header-lead header-lead)
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
498 header-lead)
7527
1f09079e18c4 (outline-mode): Use outline-this-or-next-heading.
Richard M. Stallman <rms@gnu.org>
parents: 7476
diff changeset
499 ;;;_ > outline-infer-header-lead ()
1f09079e18c4 (outline-mode): Use outline-this-or-next-heading.
Richard M. Stallman <rms@gnu.org>
parents: 7476
diff changeset
500 (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
501 "Determine appropriate `outline-header-prefix'.
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
502
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
503 Works according to settings of:
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
504
7527
1f09079e18c4 (outline-mode): Use outline-this-or-next-heading.
Richard M. Stallman <rms@gnu.org>
parents: 7476
diff changeset
505 `comment-start'
7416
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
506 `outline-header-prefix' (default)
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
507 `outline-use-mode-specific-leader'
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
508 and `outline-mode-leaders'.
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
509
7527
1f09079e18c4 (outline-mode): Use outline-this-or-next-heading.
Richard M. Stallman <rms@gnu.org>
parents: 7476
diff changeset
510 Apply this via \(re\)activation of `outline-mode', rather than
1f09079e18c4 (outline-mode): Use outline-this-or-next-heading.
Richard M. Stallman <rms@gnu.org>
parents: 7476
diff changeset
511 invoking it directly."
7416
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
512 (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
513 (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
514 (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
515 '(outline-mode-leaders
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
516 comment-start
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
517 t)))
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
518 outline-use-mode-specific-leader
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
519 ;; 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
520 t)))
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
521 (leader
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
522 (cond
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
523 ((not use-leader) nil)
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
524 ;; Use the explicitly designated leader:
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
525 ((stringp use-leader) use-leader)
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
526 (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
527 ;; 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
528 (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
529 ;; ... 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
530 (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
531 comment-start
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
532 ;; Use comment-start, maybe tripled, and with
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
533 ;; underscore:
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
534 (concat
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
535 (if (string= " "
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
536 (substring comment-start
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
537 (1- (length comment-start))))
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
538 ;; 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
539 (substring comment-start 0 -1)
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
540 (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
541 ;; ... and append underscore, whichever:
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
542 "_")))))))
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
543 (if (not leader)
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
544 nil
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
545 (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
546 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
547 (setq outline-header-prefix leader)
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
548 outline-header-prefix))))
7527
1f09079e18c4 (outline-mode): Use outline-this-or-next-heading.
Richard M. Stallman <rms@gnu.org>
parents: 7476
diff changeset
549 ;;;_ > outline-infer-body-reindent ()
1f09079e18c4 (outline-mode): Use outline-this-or-next-heading.
Richard M. Stallman <rms@gnu.org>
parents: 7476
diff changeset
550 (defun outline-infer-body-reindent ()
1f09079e18c4 (outline-mode): Use outline-this-or-next-heading.
Richard M. Stallman <rms@gnu.org>
parents: 7476
diff changeset
551 "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
552
1f09079e18c4 (outline-mode): Use outline-this-or-next-heading.
Richard M. Stallman <rms@gnu.org>
parents: 7476
diff changeset
553 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
554 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
555 file is programming code."
1f09079e18c4 (outline-mode): Use outline-this-or-next-heading.
Richard M. Stallman <rms@gnu.org>
parents: 7476
diff changeset
556 (if (and outline-reindent-bodies
1f09079e18c4 (outline-mode): Use outline-this-or-next-heading.
Richard M. Stallman <rms@gnu.org>
parents: 7476
diff changeset
557 comment-start
1f09079e18c4 (outline-mode): Use outline-this-or-next-heading.
Richard M. Stallman <rms@gnu.org>
parents: 7476
diff changeset
558 (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
559 (setq outline-reindent-bodies nil)))
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
560 ;;;_ > set-outline-regexp ()
3430
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
561 (defun set-outline-regexp ()
7416
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
562 "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
563
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
564 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
565 `outline-distinctive-bullets-string'."
3430
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
566
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
567 (interactive)
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
568 ;; Derive outline-bullets-string from user configured components:
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
569 (setq outline-bullets-string "")
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
570 (let ((strings (list 'outline-plain-bullets-string
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
571 'outline-distinctive-bullets-string))
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
572 cur-string
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
573 cur-len
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
574 cur-char
3430
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
575 cur-char-string
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
576 index
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
577 new-string)
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
578 (while strings
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
579 (setq new-string "") (setq index 0)
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
580 (setq cur-len (length (setq cur-string (symbol-value (car strings)))))
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
581 (while (< index cur-len)
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
582 (setq cur-char (aref cur-string index))
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
583 (setq outline-bullets-string
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
584 (concat outline-bullets-string
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
585 (cond
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
586 ; Single dash would denote a
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
587 ; sequence, repeated denotes
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
588 ; a dash:
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
589 ((eq cur-char ?-) "--")
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
590 ; literal close-square-bracket
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
591 ; doesn't work right in the
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
592 ; expr, exclude it:
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
593 ((eq cur-char ?\]) "")
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
594 (t (regexp-quote (char-to-string cur-char))))))
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
595 (setq index (1+ index)))
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
596 (setq strings (cdr strings)))
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
597 )
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
598 ;; Derive next for repeated use in outline-pending-bullet:
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
599 (setq outline-plain-bullets-string-len (length outline-plain-bullets-string))
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
600 (setq outline-header-subtraction (1- (length outline-header-prefix)))
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
601 ;; Produce the new outline-regexp:
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
602 (setq outline-regexp (concat "\\(\\"
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
603 outline-header-prefix
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
604 "[ \t]*["
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
605 outline-bullets-string
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
606 "]\\)\\|\\"
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
607 outline-primary-bullet
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
608 "+\\|\^l"))
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
609 (setq outline-line-boundary-regexp
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
610 (concat "\\([\n\r]\\)\\(" outline-regexp "\\)"))
3430
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
611 (setq outline-bob-regexp
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
612 (concat "\\(\\`\\)\\(" outline-regexp "\\)"))
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
613 )
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
614 ;;;_ - Key bindings
7416
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
615 ;;;_ = outline-mode-map
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
616 (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
617 ;;;_ > 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
618 (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
619 "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
620
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
621 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
622 See doc string for outline-keybindings-list for format of binding list."
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
623 (let ((map (or base-map (make-sparse-keymap))))
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
624 (mapcar (lambda (cell)
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
625 (apply 'define-key map (if (null (cdr (cdr cell)))
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
626 (cons (concat outline-command-prefix
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
627 (car cell))
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
628 (cdr cell))
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
629 (list (car cell) (car (cdr cell))))))
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
630 keymap-list)
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
631 map))
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
632 ;;;_ = outline-prior-bindings - being deprecated.
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
633 (defvar outline-prior-bindings nil
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
634 "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
635 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
636 activation. Being deprecated.")
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
637 ;;;_ = outline-added-bindings - being deprecated
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
638 (defvar outline-added-bindings nil
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
639 "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
640 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
641 activation. Being deprecated.")
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
642 ;;;_ - Mode-Specific Variable Maintenance Utilities
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
643 ;;;_ = outline-mode-prior-settings
3430
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
644 (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
645 "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
646 (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
647 ;;;_ > outline-resumptions (name &optional value)
3430
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
648 (defun outline-resumptions (name &optional value)
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
649
7416
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
650 "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
651
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
652 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
653 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
654 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
655 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
656 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
657 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
658 from the list."
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 (let ((on-list (assq name outline-mode-prior-settings))
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
661 prior-capsule ; By 'capsule' i mean a list
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
662 ; containing a value, so we can
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
663 ; distinguish nil from no value.
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
664 )
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
665
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
666 (if value
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
667
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
668 ;; Registering:
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
669 (progn
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
670 (if on-list
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
671 nil ; Already preserved prior value - don't mess with it.
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
672 ;; Register the old value, or nil if previously unbound:
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
673 (setq outline-mode-prior-settings
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
674 (cons (list name
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
675 (if (boundp name) (list (symbol-value name))))
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
676 outline-mode-prior-settings)))
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
677 ; And impose the new value, locally:
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
678 (progn (make-local-variable name)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
679 (set name (car value))))
3430
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
680
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
681 ;; Relinquishing:
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
682 (if (not on-list)
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
683
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
684 ;; Oops, not registered - leave it be:
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
685 nil
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
686
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
687 ;; Some registration:
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
688 ; reestablish it:
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
689 (setq prior-capsule (car (cdr on-list)))
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
690 (if prior-capsule
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
691 (set name (car prior-capsule)) ; Some prior value - reestablish it.
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
692 (makunbound name)) ; Previously unbound - demolish var.
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
693 ; Remove registration:
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
694 (let (rebuild)
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
695 (while outline-mode-prior-settings
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
696 (if (not (eq (car outline-mode-prior-settings)
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
697 on-list))
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
698 (setq rebuild
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
699 (cons (car outline-mode-prior-settings)
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
700 rebuild)))
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
701 (setq outline-mode-prior-settings
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
702 (cdr outline-mode-prior-settings)))
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
703 (setq outline-mode-prior-settings rebuild)))))
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
704 )
7416
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
705 ;;;_ - Mode-specific incidentals
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
706 ;;;_ = outline-during-write-cue nil
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
707 (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
708 "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
709
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
710 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
711 `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
712 functions.")
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
713 ;;;_ = outline-override-protect nil
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
714 (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
715 "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
716
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
717 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
718 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
719 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
720 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
721 (make-variable-buffer-local 'outline-override-protect)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
722 ;;;_ > outline-unprotected (expr)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
723 (defmacro outline-unprotected (expr)
7416
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
724 "Evaluate EXPRESSION with `outline-override-protect' let-bound 't'."
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
725 (` (let ((outline-override-protect t))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
726 (, expr))))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
727 ;;;_ = outline-undo-aggregation
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
728 (defvar outline-undo-aggregation 30
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
729 "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
730
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
731 This is purely a kludge variable, regulating the compensation for a bug in
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
732 the way that before-change-function and undo interact.")
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
733 (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
734 ;;;_ = file-var-bug hack
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
735 (defvar outline-v18/9-file-var-hack nil
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
736 "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
737 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
738 to track repeats.")
7416
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
739 ;;;_ > outline-write-file-hook ()
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
740 (defun outline-write-file-hook ()
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
741 "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
742
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
743 Currently just sets 'outline-during-write-cue', so outline-change-
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
744 protection knows to keep inactive during file write."
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
745 (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
746 nil)
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
747
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
748 ;;;_ #2 Mode activation
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
749 ;;;_ = outline-mode
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
750 (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
751 (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
752 ;;;_ > outline-mode-p ()
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
753 (defmacro outline-mode-p ()
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
754 "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
755 'outline-mode)
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
756 ;;;_ = outline-explicitly-deactivated
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
757 (defvar outline-explicitly-deactivated nil
13964
4de229297f1f (outline-primary-bullet, outline-numbered-bullet,
Karl Heuer <kwzh@gnu.org>
parents: 13337
diff changeset
758 "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
759 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
760 (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
761 ;;;_ > outline-init (&optional mode)
1f09079e18c4 (outline-mode): Use outline-this-or-next-heading.
Richard M. Stallman <rms@gnu.org>
parents: 7476
diff changeset
762 (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
763 "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
764
7527
1f09079e18c4 (outline-mode): Use outline-this-or-next-heading.
Richard M. Stallman <rms@gnu.org>
parents: 7476
diff changeset
765 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
766
1f09079e18c4 (outline-mode): Use outline-this-or-next-heading.
Richard M. Stallman <rms@gnu.org>
parents: 7476
diff changeset
767 - nil \(or no argument) deactivate auto-activation/layou;
1f09079e18c4 (outline-mode): Use outline-this-or-next-heading.
Richard M. Stallman <rms@gnu.org>
parents: 7476
diff changeset
768 - 'activate', enable auto-activation only;
1f09079e18c4 (outline-mode): Use outline-this-or-next-heading.
Richard M. Stallman <rms@gnu.org>
parents: 7476
diff changeset
769 - '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
770 confirmation for layout operation solicited from user each time;
7527
1f09079e18c4 (outline-mode): Use outline-this-or-next-heading.
Richard M. Stallman <rms@gnu.org>
parents: 7476
diff changeset
771 - 'report', just report and return the current auto-activation state;
1f09079e18c4 (outline-mode): Use outline-this-or-next-heading.
Richard M. Stallman <rms@gnu.org>
parents: 7476
diff changeset
772 - 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
773 any confirmation check.
7416
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
774
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
775 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
776 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
777 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
778 `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
779
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
780 `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
781 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
782 setting.
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
783
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
784 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
785 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
786
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
787 \(require 'allout)
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
788 \(outline-init t)"
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
789
7527
1f09079e18c4 (outline-mode): Use outline-this-or-next-heading.
Richard M. Stallman <rms@gnu.org>
parents: 7476
diff changeset
790 (interactive)
1f09079e18c4 (outline-mode): Use outline-this-or-next-heading.
Richard M. Stallman <rms@gnu.org>
parents: 7476
diff changeset
791 (if (interactive-p)
7416
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
792 (progn
7527
1f09079e18c4 (outline-mode): Use outline-this-or-next-heading.
Richard M. Stallman <rms@gnu.org>
parents: 7476
diff changeset
793 (setq mode
1f09079e18c4 (outline-mode): Use outline-this-or-next-heading.
Richard M. Stallman <rms@gnu.org>
parents: 7476
diff changeset
794 (completing-read
1f09079e18c4 (outline-mode): Use outline-this-or-next-heading.
Richard M. Stallman <rms@gnu.org>
parents: 7476
diff changeset
795 (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
796 "(empty for report, ? for options) ")
1f09079e18c4 (outline-mode): Use outline-this-or-next-heading.
Richard M. Stallman <rms@gnu.org>
parents: 7476
diff changeset
797 '(("nil")("full")("activate")("deactivate")
1f09079e18c4 (outline-mode): Use outline-this-or-next-heading.
Richard M. Stallman <rms@gnu.org>
parents: 7476
diff changeset
798 ("ask") ("report") (""))
1f09079e18c4 (outline-mode): Use outline-this-or-next-heading.
Richard M. Stallman <rms@gnu.org>
parents: 7476
diff changeset
799 nil
1f09079e18c4 (outline-mode): Use outline-this-or-next-heading.
Richard M. Stallman <rms@gnu.org>
parents: 7476
diff changeset
800 t))
1f09079e18c4 (outline-mode): Use outline-this-or-next-heading.
Richard M. Stallman <rms@gnu.org>
parents: 7476
diff changeset
801 (if (string= mode "")
1f09079e18c4 (outline-mode): Use outline-this-or-next-heading.
Richard M. Stallman <rms@gnu.org>
parents: 7476
diff changeset
802 (setq mode 'report)
1f09079e18c4 (outline-mode): Use outline-this-or-next-heading.
Richard M. Stallman <rms@gnu.org>
parents: 7476
diff changeset
803 (setq mode (intern-soft mode)))))
1f09079e18c4 (outline-mode): Use outline-this-or-next-heading.
Richard M. Stallman <rms@gnu.org>
parents: 7476
diff changeset
804 (let
1f09079e18c4 (outline-mode): Use outline-this-or-next-heading.
Richard M. Stallman <rms@gnu.org>
parents: 7476
diff changeset
805 ;; 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
806 ((hook 'outline-find-file-hook)
1f09079e18c4 (outline-mode): Use outline-this-or-next-heading.
Richard M. Stallman <rms@gnu.org>
parents: 7476
diff changeset
807 (curr-mode 'outline-auto-activation))
1f09079e18c4 (outline-mode): Use outline-this-or-next-heading.
Richard M. Stallman <rms@gnu.org>
parents: 7476
diff changeset
808
1f09079e18c4 (outline-mode): Use outline-this-or-next-heading.
Richard M. Stallman <rms@gnu.org>
parents: 7476
diff changeset
809 (cond ((not mode)
1f09079e18c4 (outline-mode): Use outline-this-or-next-heading.
Richard M. Stallman <rms@gnu.org>
parents: 7476
diff changeset
810 (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
811 (if (interactive-p)
1f09079e18c4 (outline-mode): Use outline-this-or-next-heading.
Richard M. Stallman <rms@gnu.org>
parents: 7476
diff changeset
812 (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
813 ((eq mode 'report)
1f09079e18c4 (outline-mode): Use outline-this-or-next-heading.
Richard M. Stallman <rms@gnu.org>
parents: 7476
diff changeset
814 (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
815 (outline-init nil)
1f09079e18c4 (outline-mode): Use outline-this-or-next-heading.
Richard M. Stallman <rms@gnu.org>
parents: 7476
diff changeset
816 ;; 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
817 (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
818 (t (add-hook 'find-file-hooks hook)
1f09079e18c4 (outline-mode): Use outline-this-or-next-heading.
Richard M. Stallman <rms@gnu.org>
parents: 7476
diff changeset
819 (set curr-mode ; 'set', not 'setq'!
1f09079e18c4 (outline-mode): Use outline-this-or-next-heading.
Richard M. Stallman <rms@gnu.org>
parents: 7476
diff changeset
820 (cond ((eq mode 'activate)
1f09079e18c4 (outline-mode): Use outline-this-or-next-heading.
Richard M. Stallman <rms@gnu.org>
parents: 7476
diff changeset
821 (message
1f09079e18c4 (outline-mode): Use outline-this-or-next-heading.
Richard M. Stallman <rms@gnu.org>
parents: 7476
diff changeset
822 "Outline mode auto-activation enabled.")
1f09079e18c4 (outline-mode): Use outline-this-or-next-heading.
Richard M. Stallman <rms@gnu.org>
parents: 7476
diff changeset
823 'activate)
1f09079e18c4 (outline-mode): Use outline-this-or-next-heading.
Richard M. Stallman <rms@gnu.org>
parents: 7476
diff changeset
824 ((eq mode 'report)
1f09079e18c4 (outline-mode): Use outline-this-or-next-heading.
Richard M. Stallman <rms@gnu.org>
parents: 7476
diff changeset
825 ;; Return the current mode setting:
1f09079e18c4 (outline-mode): Use outline-this-or-next-heading.
Richard M. Stallman <rms@gnu.org>
parents: 7476
diff changeset
826 (outline-init mode))
1f09079e18c4 (outline-mode): Use outline-this-or-next-heading.
Richard M. Stallman <rms@gnu.org>
parents: 7476
diff changeset
827 ((eq mode 'ask)
1f09079e18c4 (outline-mode): Use outline-this-or-next-heading.
Richard M. Stallman <rms@gnu.org>
parents: 7476
diff changeset
828 (message
1f09079e18c4 (outline-mode): Use outline-this-or-next-heading.
Richard M. Stallman <rms@gnu.org>
parents: 7476
diff changeset
829 (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
830 "-layout \(upon confirmation) enabled."))
1f09079e18c4 (outline-mode): Use outline-this-or-next-heading.
Richard M. Stallman <rms@gnu.org>
parents: 7476
diff changeset
831 'ask)
1f09079e18c4 (outline-mode): Use outline-this-or-next-heading.
Richard M. Stallman <rms@gnu.org>
parents: 7476
diff changeset
832 ((message
1f09079e18c4 (outline-mode): Use outline-this-or-next-heading.
Richard M. Stallman <rms@gnu.org>
parents: 7476
diff changeset
833 "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
834 'full)))))))
1f09079e18c4 (outline-mode): Use outline-this-or-next-heading.
Richard M. Stallman <rms@gnu.org>
parents: 7476
diff changeset
835
7416
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
836 ;;;_ > outline-mode (&optional toggle)
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
837 ;;;_ : Defun:
3430
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
838 (defun outline-mode (&optional toggle)
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
839 ;;;_ . Doc string:
7416
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
840 "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
841
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
842 Optional arg forces mode reactivation iff arg is positive num or symbol.
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
843
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
844 Allout outline mode provides extensive outline formatting and
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
845 manipulation capabilities. It is specifically aimed at supporting
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
846 outline structuring and manipulation of syntax-sensitive text, eg
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
847 programming languages. \(For an example, see the allout code itself,
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
848 which is organized in outline structure.\)
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
849
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
850 It also includes such things as topic-oriented repositioning, cut, and
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
851 paste; integral outline exposure-layout; incremental search with
13964
4de229297f1f (outline-primary-bullet, outline-numbered-bullet,
Karl Heuer <kwzh@gnu.org>
parents: 13337
diff changeset
852 dynamic exposure/concealment of concealed text; automatic topic-number
7416
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
853 maintenance; and many other features.
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
854
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
855 See the docstring of the variable `outline-init' for instructions on
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
856 priming your emacs session for automatic activation of outline-mode,
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
857 according to file-var settings of the `outline-layout' variable.
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
858
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
859 Below is a description of the bindings, and then explanation of
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
860 special outline-mode features and terminology.
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
861
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
862 The bindings themselves are established according to the values of
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
863 variables `outline-keybindings-list' and `outline-command-prefix',
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
864 each time the mode is invoked. Prior bindings are resurrected when
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
865 the mode is revoked.
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 Navigation: Exposure Control:
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
868 ---------- ----------------
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
869 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
870 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
871 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
872 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
873 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
874 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
875 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
876
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
877 Topic Header Production:
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
878 -----------------------
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
879 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
880 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
881 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
882
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
883 Topic Level and Prefix Adjustment:
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
884 ---------------------------------
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
885 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
886 C-c < outline-shift-out ... less deep.
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
887 C-c<CR> outline-rebullet-topic Reconcile bullets of topic and its' offspring
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
888 - 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
889 alternated according to nesting depth.
11661
9ac485495712 (outline-rebullet-current-heading): Change to C-c *.
Karl Heuer <kwzh@gnu.org>
parents: 11034
diff changeset
890 C-c * outline-rebullet-current-heading Prompt for alternate bullet for
7416
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
891 current topic.
3430
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
892 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
893 offspring are not affected. With repeat
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
894 count, revoke numbering.
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
895
7416
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
896 Topic-oriented Killing and Yanking:
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
897 ----------------------------------
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
898 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
899 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
900 C-y outline-yank Yank, adjusting depth of yanked topic to
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
901 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
902 heading (ie, prefix sans text).
3430
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
903 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
904
7416
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
905 Misc commands:
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
906 -------------
3430
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
907 C-c @ outline-resolve-xref pop-to-buffer named by xref (cf
7416
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
908 outline-file-xref-bullet)
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
909 C-c c outline-copy-exposed Copy current topic outline sans concealed
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
910 text, to buffer with name derived from
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
911 current buffer - \"XXX exposed\"
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
912 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
913 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
914 for `outline-layout'.
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
915 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
916 auto-activation.
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
917
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
918 HOT-SPOT Operation
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
919
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
920 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
921 navigation and exposure control.
3430
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
922
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
923 \\<outline-mode-map>
7416
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
924 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
925 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
926 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
927 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
928 \(\\[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
929
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
930 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
931 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
932 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
933 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
934 operation.
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
935
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
936 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
937 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
938 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
939 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
940
7416
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
941 Terminology
3430
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
942
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
943 Topic hierarchy constituents - TOPICS and SUBTOPICS:
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
944
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
945 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
946 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
947 CURRENT topic:
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
948 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
949 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
950 containment. Also called the:
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
951 LEVEL: The same as DEPTH.
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
952
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
953 ANCESTORS:
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
954 The topics that contain a topic.
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
955 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
956 the topic.
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
957 OFFSPRING:
7416
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
958 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
959 SUBTOPIC:
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
960 An immediate offspring of a topic;
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
961 CHILDREN:
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
962 The immediate offspring of a topic.
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
963 SIBLINGS:
7416
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
964 Topics having the same parent and depth.
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
965
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
966 Topic text constituents:
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
967
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
968 HEADER: The first line of a topic, include the topic PREFIX and header
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
969 text.
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
970 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
971 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
972 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
973 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
974 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
975
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
976 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
977 of the topic.
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
978 PREFIX-LEAD:
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
979 The string at the beginning of a topic prefix, normally a '.'.
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
980 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
981 `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
982
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
983 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
984 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
985 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
986 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
987 docstring for more detail.
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
988 PREFIX-PADDING:
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
989 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
990 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
991 BULLET: A character at the end of the topic prefix, it must be one of
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
992 the characters listed on 'outline-plain-bullets-string' or
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
993 'outline-distinctive-bullets-string'. (See the documentation
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
994 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
995 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
996 topic.
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
997 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
998 BODY: Same as ENTRY.
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
999
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1000
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1001 EXPOSURE:
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1002 The state of a topic which determines the on-screen visibility
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1003 of its' offspring and contained text.
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1004 CONCEALED:
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1005 Topics and entry text whose display is inhibited. Contiguous
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1006 units of concealed text is represented by '...' ellipses.
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1007 (Ref the 'selective-display' var.)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1008
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1009 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
1010 CLOSED: A topic whose immediate offspring and body-text is concealed.
7416
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1011 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
1012 ;;;_ . Code
3430
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1013 (interactive "P")
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1014
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1015 (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
1016 (outline-mode-p)))
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1017 ; Massage universal-arg 'toggle' val:
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1018 (toggle (and toggle
7416
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1019 (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
1020 toggle)))
13964
4de229297f1f (outline-primary-bullet, outline-numbered-bullet,
Karl Heuer <kwzh@gnu.org>
parents: 13337
diff changeset
1021 ; Activation specifically demanded?
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1022 (explicit-activation (or
7416
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1023 ;;
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1024 (and toggle
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1025 (or (symbolp toggle)
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1026 (and (natnump toggle)
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1027 (not (zerop toggle)))))))
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1028 ;; outline-mode already called once during this complex command?
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1029 (same-complex-command (eq outline-v18/9-file-var-hack
7416
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1030 (car command-history)))
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1031 do-layout
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1032 )
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1033
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1034 ; See comments below re v19.18,.19 bug.
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1035 (setq outline-v18/9-file-var-hack (car command-history))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1036
3430
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1037 (cond
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1038
7416
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1039 ;; 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
1040 ;; 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
1041 ;; 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
1042 ;; 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
1043 ;; skip everything.
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1044 ((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
1045 ; 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
1046 active ; Already activated.
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1047 (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
1048 (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
1049 emacs-version)); 19.19.
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1050 t)
7416
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1051
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1052 ;; Deactivation:
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1053 ((and (not explicit-activation)
7416
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1054 (or active toggle))
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1055 ; Activation not explicitly
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1056 ; requested, and either in
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1057 ; active state or *de*activation
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1058 ; specifically requested:
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1059 (setq outline-explicitly-deactivated t)
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1060 (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
1061 ; Revoke those keys that remain
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1062 ; as we set them:
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1063 (let ((curr-loc (current-local-map)))
7416
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1064 (mapcar '(lambda (cell)
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1065 (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
1066 (car (cdr cell)))
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1067 (define-key curr-loc (car cell)
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1068 (assq (car cell) outline-prior-bindings))))
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1069 outline-added-bindings)
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1070 (outline-resumptions 'outline-added-bindings)
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1071 (outline-resumptions 'outline-prior-bindings)))
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1072
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1073 (if outline-old-style-prefixes
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1074 (progn
7416
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1075 (outline-resumptions 'outline-primary-bullet)
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1076 (outline-resumptions 'outline-old-style-prefixes)))
3430
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1077 (outline-resumptions 'selective-display)
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1078 (if (and (boundp 'before-change-function) before-change-function)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1079 (outline-resumptions 'before-change-function))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1080 (setq pre-command-hook (delq 'outline-pre-command-business
7416
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1081 pre-command-hook))
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1082 (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
1083 (delq 'outline-write-file-hook
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1084 local-write-file-hooks))
3430
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1085 (outline-resumptions 'paragraph-start)
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1086 (outline-resumptions 'paragraph-separate)
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1087 (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
1088 'auto-fill-hook
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1089 'auto-fill-function))
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1090 (outline-resumptions 'outline-former-auto-filler)
3430
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1091 (setq outline-mode nil))
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1092
7416
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1093 ;; Activation:
3430
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1094 ((not active)
7416
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1095 (setq outline-explicitly-deactivated nil)
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1096 (if outline-old-style-prefixes
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1097 (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
1098 (outline-resumptions 'outline-primary-bullet '("*"))
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1099 (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
1100
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1101 (outline-infer-header-lead)
7527
1f09079e18c4 (outline-mode): Use outline-this-or-next-heading.
Richard M. Stallman <rms@gnu.org>
parents: 7476
diff changeset
1102 (outline-infer-body-reindent)
7416
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1103
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1104 (set-outline-regexp)
7416
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1105
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1106 ; Produce map from current version
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1107 ; of outline-keybindings-list:
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1108 (if (boundp 'minor-mode-map-alist)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1109
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1110 (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
1111 ; epoch, minor-mode key bindings:
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1112 (setq outline-mode-map
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1113 (produce-outline-mode-map outline-keybindings-list))
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1114 (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
1115 ; 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
1116 ; if not already there:
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1117 (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
1118 minor-mode-map-alist))
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1119 (setq minor-mode-map-alist
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1120 (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
1121 minor-mode-map-alist))))
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1122
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1123 ; V18 minor-mode key bindings:
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1124 ; Stash record of added bindings
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1125 ; for later revocation:
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1126 (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
1127 (list outline-keybindings-list))
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1128 (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
1129 (list (current-local-map)))
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1130 ; and add them:
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1131 (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
1132 (current-local-map)))
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1133 )
7416
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1134
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1135 ; selective-display is the
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1136 ; emacs conditional exposure
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1137 ; mechanism:
3430
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1138 (outline-resumptions 'selective-display '(t))
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1139 (if outline-inhibit-protection
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1140 t
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1141 (outline-resumptions 'before-change-function
7416
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1142 '(outline-before-change-protect)))
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1143 ; Temporarily set by any outline
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1144 ; 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
1145 ; deal properly with concealed text.
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1146 (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
1147 ; 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
1148 ; respect for topic headline,
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1149 ; hanging-indents, etc:
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1150 (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
1151 'auto-fill-hook
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1152 'auto-fill-function))
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1153 (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
1154 ;; 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
1155 (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
1156 ;; 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
1157 (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
1158 ;; Paragraphs are broken by topic headlines.
3430
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1159 (make-local-variable 'paragraph-start)
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1160 (outline-resumptions 'paragraph-start
10867
bbfb197435e3 (outline-mode): Remove ^ from paragraph-start & -separate.
Boris Goldowsky <boris@gnu.org>
parents: 7676
diff changeset
1161 (list (concat paragraph-start "\\|\\("
7416
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1162 outline-regexp "\\)")))
3430
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1163 (make-local-variable 'paragraph-separate)
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1164 (outline-resumptions 'paragraph-separate
10867
bbfb197435e3 (outline-mode): Remove ^ from paragraph-start & -separate.
Boris Goldowsky <boris@gnu.org>
parents: 7676
diff changeset
1165 (list (concat paragraph-separate "\\|\\("
7416
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1166 outline-regexp "\\)")))
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1167
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1168 (or (assq 'outline-mode minor-mode-alist)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1169 (setq minor-mode-alist
7416
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1170 (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
1171
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1172 (if outline-layout
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1173 (setq do-layout t))
3430
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1174
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1175 (if outline-enwrap-isearch-mode
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1176 (outline-enwrap-isearch))
7416
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1177
3430
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1178 (run-hooks 'outline-mode-hook)
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1179 (setq outline-mode t))
7416
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1180
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1181 ;; Reactivation:
7527
1f09079e18c4 (outline-mode): Use outline-this-or-next-heading.
Richard M. Stallman <rms@gnu.org>
parents: 7476
diff changeset
1182 ((setq do-layout t)
1f09079e18c4 (outline-mode): Use outline-this-or-next-heading.
Richard M. Stallman <rms@gnu.org>
parents: 7476
diff changeset
1183 (outline-infer-body-reindent))
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1184 ) ; cond
7416
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1185
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1186 (if (and do-layout
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1187 outline-auto-activation
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1188 (listp outline-layout)
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1189 (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
1190 (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
1191 (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
1192 (buffer-name)
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1193 outline-layout))
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1194 t
7527
1f09079e18c4 (outline-mode): Use outline-this-or-next-heading.
Richard M. Stallman <rms@gnu.org>
parents: 7476
diff changeset
1195 (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
1196 nil)
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1197 t)))
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1198 (save-excursion
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1199 (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
1200 (goto-char 0)
7527
1f09079e18c4 (outline-mode): Use outline-this-or-next-heading.
Richard M. Stallman <rms@gnu.org>
parents: 7476
diff changeset
1201 (outline-this-or-next-heading)
1f09079e18c4 (outline-mode): Use outline-this-or-next-heading.
Richard M. Stallman <rms@gnu.org>
parents: 7476
diff changeset
1202 (condition-case err
1f09079e18c4 (outline-mode): Use outline-this-or-next-heading.
Richard M. Stallman <rms@gnu.org>
parents: 7476
diff changeset
1203 (progn
1f09079e18c4 (outline-mode): Use outline-this-or-next-heading.
Richard M. Stallman <rms@gnu.org>
parents: 7476
diff changeset
1204 (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
1205 (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
1206 ;; 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
1207 ;; interrupt, eg, file visit:
1f09079e18c4 (outline-mode): Use outline-this-or-next-heading.
Richard M. Stallman <rms@gnu.org>
parents: 7476
diff changeset
1208 (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
1209 (sit-for 1)))))
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1210 outline-mode
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1211 ) ; let*
7416
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1212 ) ; defun
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1213
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1214 ;;;_ #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
1215 ;;; 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
1216 ;;; 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
1217 ;;; `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
1218 ;;; 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
1219 ;;; 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
1220 ;;; 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
1221 ;;; 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
1222 ;;;_ = outline-recent-prefix-beginning
3430
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1223 (defvar outline-recent-prefix-beginning 0
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1224 "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
1225 (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
1226 ;;;_ = outline-recent-prefix-end
3430
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1227 (defvar outline-recent-prefix-end 0
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1228 "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
1229 (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
1230 ;;;_ = outline-recent-end-of-subtree
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1231 (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
1232 "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
1233 (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
1234 ;;;_ > outline-prefix-data (beg end)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1235 (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
1236 "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
1237
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1238 For reference by 'outline-recent' funcs. Returns BEGINNING."
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1239 (` (setq outline-recent-prefix-end (, end)
7416
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1240 outline-recent-prefix-beginning (, beg))))
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1241 ;;;_ > outline-recent-depth ()
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1242 (defmacro outline-recent-depth ()
7416
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1243 "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
1244
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1245 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
1246 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
1247 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
1248 to return the current depth."
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1249
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1250 '(max 1 (- outline-recent-prefix-end
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1251 outline-recent-prefix-beginning
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1252 outline-header-subtraction)))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1253 ;;;_ > outline-recent-prefix ()
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1254 (defmacro outline-recent-prefix ()
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1255 "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
1256
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1257 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
1258 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
1259 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
1260 to return the current depth."
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1261 '(buffer-substring outline-recent-prefix-beginning
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1262 outline-recent-prefix-end))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1263 ;;;_ > outline-recent-bullet ()
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1264 (defmacro outline-recent-bullet ()
7416
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1265 "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
1266
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1267 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
1268 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
1269 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
1270 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
1271 '(buffer-substring (1- outline-recent-prefix-end)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1272 outline-recent-prefix-end))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1273
7416
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1274 ;;;_ #4 Navigation
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1275
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1276 ;;;_ - Position Assessment
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1277 ;;;_ : Location Predicates
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1278 ;;;_ > outline-on-current-heading-p ()
3430
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1279 (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
1280 "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
1281
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1282 Actually, returns prefix beginning point."
3430
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1283 (save-excursion
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1284 (beginning-of-line)
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1285 (and (looking-at outline-regexp)
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1286 (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
1287 ;;;_ > outline-e-o-prefix-p ()
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1288 (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
1289 "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
1290 (and (save-excursion (beginning-of-line)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1291 (looking-at outline-regexp))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1292 (= (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
1293 ;;;_ > outline-hidden-p ()
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1294 (defmacro outline-hidden-p ()
3430
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1295 "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
1296 '(save-excursion
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1297 (and (re-search-backward "[\n\r]" () t)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1298 (= ?\r (following-char)))))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1299 ;;;_ > outline-visible-p ()
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1300 (defmacro outline-visible-p ()
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1301 "True if point is not in hidden text."
3430
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1302 (interactive)
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1303 '(not (outline-hidden-p)))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1304 ;;;_ : Location attributes
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1305 ;;;_ > outline-depth ()
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1306 (defmacro outline-depth ()
7416
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1307 "Like outline-current-depth, but respects hidden as well as visible topics."
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1308 '(save-excursion
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1309 (if (outline-goto-prefix)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1310 (outline-recent-depth)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1311 (progn
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1312 ;; Oops, no prefix, zero prefix data:
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1313 (outline-prefix-data (point)(point))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1314 ;; ... and return 0:
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1315 0))))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1316 ;;;_ > outline-current-depth ()
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1317 (defmacro outline-current-depth ()
7416
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1318 "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
1319 '(save-excursion
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1320 (if (outline-back-to-current-heading)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1321 (max 1
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1322 (- outline-recent-prefix-end
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1323 outline-recent-prefix-beginning
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1324 outline-header-subtraction))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1325 0)))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1326 ;;;_ > outline-get-current-prefix ()
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1327 (defun outline-get-current-prefix ()
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1328 "Topic prefix of the current topic."
3430
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1329 (save-excursion
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1330 (if (outline-goto-prefix)
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1331 (outline-recent-prefix))))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1332 ;;;_ > outline-get-bullet ()
3430
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1333 (defun outline-get-bullet ()
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1334 "Return bullet of containing topic (visible or not)."
3430
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1335 (save-excursion
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1336 (and (outline-goto-prefix)
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1337 (outline-recent-bullet))))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1338 ;;;_ > outline-current-bullet ()
3430
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1339 (defun outline-current-bullet ()
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1340 "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
1341 (condition-case err
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1342 (save-excursion
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1343 (outline-back-to-current-heading)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1344 (buffer-substring (- outline-recent-prefix-end 1)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1345 outline-recent-prefix-end))
3430
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1346 ;; Quick and dirty provision, ostensibly for missing bullet:
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1347 (args-out-of-range nil))
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1348 )
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1349 ;;;_ > outline-get-prefix-bullet (prefix)
3430
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1350 (defun outline-get-prefix-bullet (prefix)
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1351 "Return the bullet of the header prefix string PREFIX."
3430
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1352 ;; 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
1353 ;; oughtn't be called then, so forget about it...
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1354 (if (string-match outline-regexp prefix)
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1355 (substring prefix (1- (match-end 0)) (match-end 0))))
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1356
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1357 ;;;_ - Navigation macros
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1358 ;;;_ > outline-next-heading ()
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1359 (defmacro outline-next-heading ()
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1360 "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
1361
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1362 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
1363
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1364 '(if (and (bobp) (not (eobp)))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1365 (forward-char 1))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1366
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1367 '(if (re-search-forward outline-line-boundary-regexp nil 0)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1368 (progn ; Got valid location state - set vars:
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1369 (outline-prefix-data
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1370 (goto-char (or (match-beginning 2)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1371 outline-recent-prefix-beginning))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1372 (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
1373 ;;;_ : outline-this-or-next-heading
1f09079e18c4 (outline-mode): Use outline-this-or-next-heading.
Richard M. Stallman <rms@gnu.org>
parents: 7476
diff changeset
1374 (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
1375 "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
1376 ;; 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
1377 ;; and usable by outline-mode.
1f09079e18c4 (outline-mode): Use outline-this-or-next-heading.
Richard M. Stallman <rms@gnu.org>
parents: 7476
diff changeset
1378 (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
1379 ;;;_ > outline-previous-heading ()
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1380 (defmacro outline-previous-heading ()
7416
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1381 "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
1382
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1383 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
1384
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1385 '(if (bobp)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1386 nil
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1387 (outline-goto-prefix)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1388 (if
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1389 ;; 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
1390 (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
1391 (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
1392 (progn ; Got valid location state - set vars:
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1393 (outline-prefix-data
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1394 (goto-char (or (match-beginning 2)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1395 outline-recent-prefix-beginning))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1396 (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
1397
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1398 ;;;_ - Subtree Charting
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1399 ;;;_ " 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
1400 ;;; 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
1401 ;;;
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1402 ;;; 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
1403 ;;; 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
1404 ;;; out the subtopic locations. The chart then serves as the basis
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1405 ;;; for whatever assessment or adjustment of the subtree that is
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1406 ;;; required, without requiring redundant topic-traversal procedures.
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1407
7416
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1408 ;;;_ > 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
1409 (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
1410 "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
1411
13964
4de229297f1f (outline-primary-bullet, outline-numbered-bullet,
Karl Heuer <kwzh@gnu.org>
parents: 13337
diff changeset
1412 Optional argument LEVELS specifies the depth \(relative to start
7416
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1413 depth\) for the chart. Subsequent optional args are not for public
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1414 use.
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1415
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1416 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
1417 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
1418 for their elaborate manipulations.
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1419
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1420 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
1421 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
1422 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
1423 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
1424 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
1425 itself.
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1426
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1427 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
1428 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
1429 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
1430
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1431 (let ((original (not orig-depth)) ; 'orig-depth' set only in recursion.
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1432 chart curr-depth)
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1433
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1434 (if original ; Just starting?
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1435 ; Register initial settings and
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1436 ; position to first offspring:
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1437 (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
1438 (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
1439 (outline-next-heading)))
7416
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1440
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1441 ;; 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
1442 ;; 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
1443 ;; the typically quite constrained emacs max-lisp-eval-depth.
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1444 ;; 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
1445 ;; operation rather than recursing for lower levels. Bah.
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1446 (while (and (not (eobp))
7416
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1447 ; Still within original topic?
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1448 (< 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
1449 (cond ((= prev-depth curr-depth)
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1450 ;; 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
1451 (setq chart (cons (point) chart))
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1452 (if (and levels (<= levels 1))
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1453 ;; At depth limit - skip sublevels:
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1454 (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
1455 ;; 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
1456 ;; 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
1457 (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
1458 (outline-recent-depth))
5b8a573e9f69 (outline-chart-subtree): Include outline-next-heading in loop conditions
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
1459 (outline-next-heading))))
7416
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1460 (outline-next-heading)))
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1461
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1462 ((and (< prev-depth curr-depth)
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1463 (or (not levels)
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1464 (> levels 0)))
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1465 ;; 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
1466 (setq chart
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1467 (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
1468 (1- levels))
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1469 orig-depth
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1470 curr-depth)
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1471 chart))
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1472 ;; ... then continue with this one.
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1473 )
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1474
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1475 ;; ... 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
1476
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1477 )))
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1478
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1479 (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
1480 ; the original level. Position
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1481 ; to the end of it:
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1482 (progn (and (not (eobp)) (forward-char -1))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1483 (and (memq (preceding-char) '(?\n ?\^M))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1484 (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
1485 (point))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1486 1)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1487 '(?\n ?\^M))
7416
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1488 (forward-char -1))
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1489 (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
1490
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1491 chart ; (nreverse chart) not necessary,
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1492 ; and maybe not preferable.
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1493 ))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1494 ;;;_ > outline-chart-siblings (&optional start end)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1495 (defun outline-chart-siblings (&optional start end)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1496 "Produce a list of locations of this and succeeding sibling topics.
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1497 Effectively a top-level chart of siblings. See 'outline-chart-subtree'
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1498 for an explanation of charts."
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1499 (save-excursion
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1500 (if (outline-goto-prefix)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1501 (let ((chart (list (point))))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1502 (while (outline-next-sibling)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1503 (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
1504 (if chart (setq chart (nreverse chart)))))))
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1505 ;;;_ > outline-chart-to-reveal (chart depth)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1506 (defun outline-chart-to-reveal (chart depth)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1507
7416
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1508 "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
1509
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1510 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
1511 start point."
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1512
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1513 (let (result here)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1514 (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
1515 chart)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1516 (setq here (car chart))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1517 (if (listp here)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1518 (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
1519 (1- depth)))))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1520 ;; 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
1521 ;; more depth to go:
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1522 (if further (setq result (append further result)))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1523 (setq chart (cdr chart)))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1524 (goto-char here)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1525 (if (= (preceding-char) ?\r)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1526 (setq result (cons here result)))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1527 (setq chart (cdr chart))))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1528 result))
7416
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1529 ;;;_ 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
1530 (defun outline-chart-spec (chart spec &optional exposing)
7416
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1531 "Not yet \(if ever\) implemented.
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1532
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1533 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
1534
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1535 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
1536 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
1537 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
1538 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
1539 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
1540 bodies should be exposed.
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1541
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1542 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
1543 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
1544 exposed reside.
7416
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1545
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1546 - 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
1547 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
1548 including their entries.
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1549 - 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
1550 opened.
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1551 - Lists signify the beginning and end points of regions that should
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1552 be flagged, and the flag to employ. (For concealment: '\(\?r\)', and
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1553 exposure:"
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1554 (while spec
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1555 (cond ((listp spec)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1556 )
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1557 )
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1558 (setq spec (cdr spec)))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1559 )
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1560
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1561 ;;;_ - Within Topic
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1562 ;;;_ > outline-goto-prefix ()
3430
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1563 (defun outline-goto-prefix ()
7416
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1564 "Put point at beginning of outline prefix for immediately containing topic.
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1565
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1566 Goes to first subsequent topic if none immediately containing.
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1567
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1568 Not sensitive to topic visibility.
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1569
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1570 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
1571
7416
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1572 (let (done)
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1573 (while (and (not done)
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1574 (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
1575 (forward-char 1)
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1576 (if (looking-at outline-regexp)
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1577 (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
1578 (match-end 0)))
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1579 (forward-char -1)))
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1580 (if (bobp)
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1581 (cond ((looking-at outline-regexp)
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1582 (outline-prefix-data (match-beginning 0)(match-end 0)))
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1583 ((outline-next-heading)
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1584 (outline-prefix-data (match-beginning 0)(match-end 0)))
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1585 (done))
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1586 done)))
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1587 ;;;_ > outline-end-of-prefix ()
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1588 (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
1589 "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
1590
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1591 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
1592 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
1593
3430
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1594 (if (not (outline-goto-prefix))
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1595 nil
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1596 (let ((match-data (match-data)))
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1597 (goto-char (match-end 0))
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1598 (if ignore-decorations
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1599 t
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1600 (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
1601 (if (and (not (eolp)) (looking-at "\\s-")) (forward-char 1)))
3430
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1602 (store-match-data match-data))
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1603 ;; Reestablish where we are:
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1604 (outline-current-depth)))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1605 ;;;_ > outline-current-bullet-pos ()
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1606 (defun outline-current-bullet-pos ()
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1607 "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
1608
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1609 (if (not (outline-current-depth))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1610 nil
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1611 (1- (match-end 0))))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1612 ;;;_ > outline-back-to-current-heading ()
3430
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1613 (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
1614 "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
1615
3430
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1616 (beginning-of-line)
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1617 (prog1 (or (outline-on-current-heading-p)
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1618 (and (re-search-backward (concat "^\\(" outline-regexp "\\)")
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1619 nil
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1620 'move)
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1621 (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
1622 (if (interactive-p) (outline-end-of-prefix))))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1623 ;;;_ > outline-pre-next-preface ()
3430
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1624 (defun outline-pre-next-preface ()
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1625 "Skip forward to just before the next heading line.
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1626
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1627 Returns that character position."
3430
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1628
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1629 (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
1630 (prog1 (goto-char (match-beginning 0))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1631 (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
1632 ;;;_ > outline-end-of-current-subtree ()
3430
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1633 (defun outline-end-of-current-subtree ()
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1634 "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
1635 (interactive)
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1636 (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
1637 (let ((level (outline-recent-depth)))
3430
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1638 (outline-next-heading)
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1639 (while (and (not (eobp))
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1640 (> (outline-recent-depth) level))
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1641 (outline-next-heading))
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1642 (and (not (eobp)) (forward-char -1))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1643 (and (memq (preceding-char) '(?\n ?\^M))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1644 (memq (aref (buffer-substring (max 1 (- (point) 3)) (point)) 1)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1645 '(?\n ?\^M))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1646 (forward-char -1))
7416
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1647 (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
1648 ;;;_ > outline-beginning-of-current-entry ()
3430
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1649 (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
1650 "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
1651
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1652 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
1653 \(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
1654 (interactive)
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1655 (let ((start-point (point)))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1656 (outline-end-of-prefix)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1657 (if (and (interactive-p)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1658 (= (point) start-point))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1659 (goto-char (outline-current-bullet-pos)))))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1660 ;;;_ > outline-end-of-current-entry ()
3430
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1661 (defun outline-end-of-current-entry ()
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1662 "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
1663 (interactive)
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1664 (outline-show-entry)
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1665 (prog1 (outline-pre-next-preface)
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1666 (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
1667 (forward-char -1))))
3430
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1668
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1669 ;;;_ - Depth-wise
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1670 ;;;_ > outline-ascend-to-depth (depth)
3430
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1671 (defun outline-ascend-to-depth (depth)
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1672 "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
1673 (if (and (> depth 0)(<= depth (outline-depth)))
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1674 (let ((last-good (point)))
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1675 (while (and (< depth (outline-depth))
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1676 (setq last-good (point))
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1677 (outline-beginning-of-level)
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1678 (outline-previous-heading)))
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1679 (if (= (outline-recent-depth) depth)
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1680 (progn (goto-char outline-recent-prefix-beginning)
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1681 depth)
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1682 (goto-char last-good)
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1683 nil))
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1684 (if (interactive-p) (outline-end-of-prefix))))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1685 ;;;_ > outline-descend-to-depth (depth)
3430
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1686 (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
1687 "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
1688
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1689 Returning depth if successful, nil if not."
3430
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1690 (let ((start-point (point))
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1691 (start-depth (outline-depth)))
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1692 (while
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1693 (and (> (outline-depth) 0)
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1694 (not (= depth (outline-recent-depth))) ; ... not there yet
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1695 (outline-next-heading) ; ... go further
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1696 (< start-depth (outline-recent-depth)))) ; ... still in topic
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1697 (if (and (> (outline-depth) 0)
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1698 (= (outline-recent-depth) depth))
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1699 depth
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1700 (goto-char start-point)
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1701 nil))
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1702 )
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1703 ;;;_ > outline-up-current-level (arg &optional dont-complain)
3430
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1704 (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
1705 "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
1706
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1707 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
1708 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
1709 DONT-COMPLAIN is non-nil."
3430
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1710 (interactive "p")
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1711 (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
1712 (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
1713 (last-good (point))
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1714 failed
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1715 return)
3430
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1716 ;; Loop for iterating arg:
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1717 (while (and (> (outline-recent-depth) 1)
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1718 (> arg 0)
7416
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1719 (not (bobp))
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1720 (not failed))
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1721 (setq last-good (point))
3430
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1722 ;; Loop for going back over current or greater depth:
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1723 (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
1724 (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
1725 (not (setq failed present-level)))))
3430
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1726 (setq present-level (outline-current-depth))
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1727 (setq arg (- arg 1)))
7416
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1728 (if (or failed
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1729 (> arg 0))
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1730 (progn (goto-char last-good)
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1731 (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
1732 (if (not dont-complain)
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1733 (error "Can't ascend past outermost level.")
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1734 (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
1735 nil))
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1736 (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
1737 outline-recent-prefix-beginning)))
3430
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1738
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1739 ;;;_ - Linear
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1740 ;;;_ > outline-next-sibling (&optional depth backward)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1741 (defun outline-next-sibling (&optional depth backward)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1742 "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
1743
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1744 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
1745
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1746 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
1747
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1748 Return depth if successful, nil otherwise."
3430
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1749
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1750 (if (and backward (bobp))
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1751 nil
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1752 (let ((start-depth (or depth (outline-depth)))
3430
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1753 (start-point (point))
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1754 last-depth)
3430
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1755 (while (and (not (if backward (bobp) (eobp)))
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1756 (if backward (outline-previous-heading)
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1757 (outline-next-heading))
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1758 (> (setq last-depth (outline-recent-depth)) start-depth)))
3430
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1759 (if (and (not (eobp))
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1760 (and (> (or last-depth (outline-depth)) 0)
3430
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1761 (= (outline-recent-depth) start-depth)))
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1762 outline-recent-prefix-beginning
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1763 (goto-char start-point)
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1764 (if depth (outline-depth) start-depth)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1765 nil))))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1766 ;;;_ > outline-previous-sibling (&optional depth backward)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1767 (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
1768 "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
1769
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1770 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
1771
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1772 Optional BACKWARD reverses direction.
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1773
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1774 Return depth if successful, nil otherwise."
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1775 (outline-next-sibling depth (not backward))
3430
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1776 )
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1777 ;;;_ > outline-snug-back ()
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1778 (defun outline-snug-back ()
7416
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1779 "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
1780
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1781 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
1782 (if (or (bobp) (eobp))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1783 nil
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1784 (forward-char -1))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1785 (if (or (bobp) (not (memq (preceding-char) '(?\n ?\^M))))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1786 nil
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1787 (forward-char -1)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1788 (if (or (bobp) (not (memq (preceding-char) '(?\n ?\^M))))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1789 (forward-char -1)))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1790 (point))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1791 ;;;_ > outline-beginning-of-level ()
3430
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1792 (defun outline-beginning-of-level ()
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1793 "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
1794 (outline-end-of-level 'backward))
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1795 ;;;_ > outline-end-of-level (&optional backward)
3430
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1796 (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
1797 "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
1798
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1799 (let ((depth (outline-depth)))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1800 (while (outline-previous-sibling depth nil))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1801 (prog1 (outline-recent-depth)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1802 (if (interactive-p) (outline-end-of-prefix)))))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1803 ;;;_ > outline-next-visible-heading (arg)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1804 (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
1805 "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
1806
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1807 Move as far as possible in indicated direction \(beginning or end of
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1808 buffer\) if headings are exhausted."
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1809
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1810 (interactive "p")
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1811 (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
1812 (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
1813 (start-point (point))
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1814 prev got)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1815
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1816 (while (> arg 0) ; limit condition
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1817 (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
1818 ;; 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
1819 (< -1 (forward-line step))
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1820 (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
1821 ;; 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
1822 (if got (setq prev got))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1823 (setq arg (1- arg)))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1824 (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
1825 (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
1826 (outline-end-of-prefix))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1827 (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
1828 (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
1829 ((not backward) (end-of-line) nil))))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1830 ;;;_ > outline-previous-visible-heading (arg)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1831 (defun outline-previous-visible-heading (arg)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1832 "Move to the previous heading line.
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1833
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1834 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
1835 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
1836 matches)."
3430
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1837 (interactive "p")
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1838 (outline-next-visible-heading (- arg)))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1839 ;;;_ > outline-forward-current-level (arg)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1840 (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
1841 "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
1842
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1843 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
1844
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1845 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
1846 (interactive "p")
7416
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1847 (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
1848 (start-point (point))
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1849 (start-arg arg)
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1850 (backward (> 0 arg))
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1851 last-depth
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1852 (last-good (point))
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1853 at-boundary)
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1854 (if (= 0 start-depth)
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1855 (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
1856 (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
1857 (while (not (or (zerop arg)
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1858 at-boundary))
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1859 (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
1860 (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
1861 (outline-next-visible-heading 1))
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1862 (> (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
1863 (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
1864 (not (if backward (bobp) (eobp))))
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1865 (setq last-good (point)
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1866 arg (1- arg))
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1867 (setq at-boundary t)))
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1868 (if (and (not (eobp))
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1869 (= arg 0)
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1870 (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
1871 (= (outline-recent-depth) start-depth)))
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1872 outline-recent-prefix-beginning
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1873 (goto-char last-good)
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1874 (if (not (interactive-p))
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1875 nil
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1876 (outline-end-of-prefix)
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1877 (error "Hit %s level %d topic, traversed %d of %d requested."
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1878 (if backward "first" "last")
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1879 (outline-recent-depth)
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1880 (- (abs start-arg) arg)
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1881 (abs start-arg))))))
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1882 ;;;_ > outline-backward-current-level (arg)
3430
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1883 (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
1884 "Inverse of `outline-forward-current-level'."
3430
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1885 (interactive "p")
7416
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1886 (if (interactive-p)
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1887 (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
1888 (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
1889 (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
1890
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1891 ;;;_ #5 Alteration
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1892
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1893 ;;;_ - Fundamental
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1894 ;;;_ > outline-before-change-protect (beg end)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1895 (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
1896 "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
1897
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1898 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
1899 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
1900 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
1901
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1902 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
1903 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
1904 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
1905 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
1906
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1907 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
1908 \(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
1909 writes, like crypt and zip modes.)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1910
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1911 Locally bound in outline buffers to 'before-change-function', which
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1912 in emacs 19 is run before any change to the buffer. (Has no effect
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1913 in Emacs 18, which doesn't support before-change-function.)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1914
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1915 Any functions which set ['this-command' to 'undo', or which set]
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1916 'outline-override-protect' non-nil (as does, eg, outline-flag-chars)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1917 are exempt from this restriction."
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1918 (if (and (outline-mode-p)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1919 ; outline-override-protect
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1920 ; set by functions that know what
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1921 ; they're doing, eg outline internals:
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1922 (not outline-override-protect)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1923 (not outline-during-write-cue)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1924 (save-match-data ; Preserve operation position state.
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1925 ; Both beginning and end chars must
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1926 ; be exposed:
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1927 (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
1928 ;; Compensate for stupid emacs {new,
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1929 ;; open-}line display optimization:
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1930 (setq beg (1+ beg)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1931 end (1+ end)))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1932 (goto-char beg)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1933 (or (outline-hidden-p)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1934 (and (not (= beg end))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1935 (goto-char end)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1936 (outline-hidden-p))))))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1937 (save-match-data
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1938 (if (equal this-command 'undo)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1939 ;; Allow undo without inhibition.
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1940 ;; - 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
1941 ;; optimization (em 19 cmds.c, ~ line 200).
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1942 ;; - Presumably, undoing what was properly protected when
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1943 ;; done.
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1944 ;; - 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
1945 ;; So, expose what getting changed:
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1946 (progn (message "Undo! - exposing concealed target...")
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1947 (if (outline-hidden-p)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1948 (outline-show-children))
7416
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
1949 (message "Undo!"))
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1950 (let (response
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1951 (rehide-completely (save-excursion (outline-goto-prefix)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1952 (outline-hidden-p)))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1953 rehide-place)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1954
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1955 (save-excursion
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1956 (if (condition-case err
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1957 ;; 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
1958 (progn
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1959 ; Give them a peek where
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1960 (save-excursion
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1961 (if (eolp) (setq rehide-place
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1962 (outline-goto-prefix)))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1963 (outline-show-entry))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1964 ; Present the message, but...
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1965 ; leave the cursor at the location
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1966 ; until they respond:
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1967 ; Then interpret the response:
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1968 (while
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1969 (progn
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1970 (message (concat "Change inside concealed"
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1971 " region - do it? "
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1972 "(n or 'y'/'r'eclose)"))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1973 (setq response (read-char))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1974 (not
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1975 (cond ((memq response '(?r ?R))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1976 (setq response 'reclose))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1977 ((memq response '(?y ?Y ? ))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1978 (setq response t))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1979 ((memq response '(?n ?N 127))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1980 (setq response nil)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1981 t)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1982 ((eq response ??)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1983 (message
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1984 "'r' means 'yes, then reclose")
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1985 nil)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1986 (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
1987 (sit-for 1)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1988 nil)))))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1989 response)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1990 (quit nil))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1991 ; Continue:
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1992 (if (eq response 'reclose)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1993 (save-excursion
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1994 (if rehide-place (goto-char rehide-place))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1995 (if rehide-completely
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1996 (outline-hide-current-entry-completely)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1997 (outline-hide-current-entry)))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
1998 (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
1999 (outline-show-children)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2000 (outline-show-to-offshoot)))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2001 ; Prevent:
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2002 (if rehide-completely
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2003 (save-excursion
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2004 (if rehide-place (goto-char rehide-place))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2005 (outline-hide-current-entry-completely))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2006 (outline-hide-current-entry))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2007 (error (concat
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2008 "Change within concealed region prevented.")))))))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2009 ) ; if
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2010 ) ; defun
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2011 ;;;_ = outline-post-goto-bullet
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2012 (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
2013 "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
2014
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
2015 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
2016 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
2017 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
2018 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
2019 outline-mode-map.")
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2020 (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
2021 ;;;_ > outline-post-command-business ()
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2022 (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
2023 "Outline post-command-hook function.
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
2024
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
2025 - 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
2026
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
2027 - 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
2028 outline commands.
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2029
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2030 - 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
2031 aggregated. This kludge compensates for lack of undo bunching when
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2032 before-change-function is used."
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2033
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2034 ; 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
2035 (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
2036 nil
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
2037 (setq outline-override-protect nil)
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
2038 (if outline-during-write-cue
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
2039 ;; 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
2040 (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
2041 ;; Undo bunching business:
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
2042 (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
2043 (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
2044 (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
2045 (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
2046 (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
2047 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
2048 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
2049 (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
2050 (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
2051 (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
2052 (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
2053 (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
2054
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
2055 ;; 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
2056 (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
2057 (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
2058 (= 1 (- cur-to cur-from))
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
2059
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
2060 ;; 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
2061 ;; insertions:
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
2062 (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
2063 (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
2064 ; Below threshold:
7416
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
2065 (> 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
2066 (setq buffer-undo-list
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
2067 (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
2068 (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
2069 ;; 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
2070 (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
2071 (outline-current-bullet-pos))
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
2072 (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
2073 (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
2074 ))
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2075 ;;;_ > outline-pre-command-business ()
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2076 (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
2077 "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
2078
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
2079 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
2080
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2081 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
2082 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
2083 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
2084 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
2085
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2086 The upshot is that you can get easy, single (unmodified) key outline
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2087 maneuvering and general operations by positioning the cursor on the
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2088 bullet char, and it continues until you deliberately some non-outline
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2089 motion command to relocate the cursor off of a bullet char."
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2090
7416
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
2091 (if (and (boundp 'outline-mode)
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
2092 outline-mode
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
2093 (eq this-command 'self-insert-command)
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2094 (eq (point)(outline-current-bullet-pos)))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2095
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2096 (let* ((this-key-num (if (numberp last-command-event)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2097 last-command-event))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2098 mapped-binding)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2099
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2100 ; Map upper-register literals
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2101 ; to lower register:
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2102 (if (<= 96 this-key-num)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2103 (setq this-key-num (- this-key-num 32)))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2104 ; Check if we have a literal:
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2105 (if (and (<= 64 this-key-num)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2106 (>= 96 this-key-num))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2107 (setq mapped-binding
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2108 (lookup-key 'outline-mode-map
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2109 (concat outline-command-prefix
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2110 (char-to-string (- this-key-num 64))))))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2111 (if mapped-binding
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2112 (setq outline-post-goto-bullet t
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2113 this-command mapped-binding)))))
7416
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
2114 ;;;_ > outline-find-file-hook ()
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
2115 (defun outline-find-file-hook ()
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
2116 "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
2117
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
2118 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
2119 (if (and outline-auto-activation
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
2120 (not (outline-mode-p))
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
2121 outline-layout)
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
2122 (outline-mode t)))
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
2123 ;;;_ : Establish the hooks
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
2124 (add-hook 'post-command-hook 'outline-post-command-business)
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
2125 (add-hook 'pre-command-hook 'outline-pre-command-business)
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2126
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2127 ;;;_ - Topic Format Assessment
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2128 ;;;_ > outline-solicit-alternate-bullet (depth &optional current-bullet)
3430
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2129 (defun outline-solicit-alternate-bullet (depth &optional current-bullet)
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2130
7416
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
2131 "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
2132
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
2133 Offer one suitable for current depth DEPTH as default."
3430
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2134
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2135 (let* ((default-bullet (or current-bullet
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2136 (outline-bullet-for-depth depth)))
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2137 (sans-escapes (regexp-sans-escapes outline-bullets-string))
3430
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2138 (choice (solicit-char-in-string
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2139 (format "Select bullet: %s ('%s' default): "
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2140 sans-escapes
3430
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2141 default-bullet)
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2142 sans-escapes
3430
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2143 t)))
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2144 (if (string= choice "") default-bullet choice))
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2145 )
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2146 ;;;_ > outline-sibling-index (&optional depth)
3430
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2147 (defun outline-sibling-index (&optional depth)
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2148 "Item number of this prospective topic among its siblings.
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2149
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2150 If optional arg depth is greater than current depth, then we're
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2151 opening a new level, and return 0.
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2152
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2153 If less than this depth, ascend to that depth and count..."
3430
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2154
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2155 (save-excursion
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2156 (cond ((and depth (<= depth 0) 0))
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2157 ((or (not depth) (= depth (outline-depth)))
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2158 (let ((index 1))
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2159 (while (outline-previous-sibling (outline-recent-depth) nil)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2160 (setq index (1+ index)))
3430
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2161 index))
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2162 ((< depth (outline-recent-depth))
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2163 (outline-ascend-to-depth depth)
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2164 (outline-sibling-index))
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2165 (0))))
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2166 ;;;_ > outline-distinctive-bullet (bullet)
3430
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2167 (defun outline-distinctive-bullet (bullet)
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2168 "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
2169 (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
2170 ;;;_ > outline-numbered-type-prefix (&optional prefix)
3430
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2171 (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
2172 "True if current header prefix bullet is numbered bullet."
3430
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2173 (and outline-numbered-bullet
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2174 (string= outline-numbered-bullet
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2175 (if prefix
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2176 (outline-get-prefix-bullet prefix)
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2177 (outline-get-bullet)))))
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2178 ;;;_ > outline-bullet-for-depth (&optional depth)
3430
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2179 (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
2180 "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
2181 ;; Find bullet in plain-bullets-string modulo DEPTH.
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2182 (if outline-stylish-prefixes
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2183 (char-to-string (aref outline-plain-bullets-string
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2184 (% (max 0 (- depth 2))
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2185 outline-plain-bullets-string-len)))
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2186 outline-primary-bullet)
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2187 )
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2188
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2189 ;;;_ - Topic Production
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2190 ;;;_ > outline-make-topic-prefix (&optional prior-bullet
3430
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2191 (defun outline-make-topic-prefix (&optional prior-bullet
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2192 new
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2193 depth
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2194 solicit
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2195 number-control
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2196 index)
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2197 ;; 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
2198 ;; 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
2199 ;; changing level of current topic.
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2200 ;; Solicit dominates specified bullet-char.
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2201 ;;;_ . Doc string:
7416
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
2202 "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
2203
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2204 All the arguments are optional.
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2205
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2206 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
2207 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
2208 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
2209 for instance.
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2210
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2211 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
2212 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
2213 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
2214 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
2215 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
2216 bullet or previous sibling.
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2217
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2218 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
2219 the current topics' depth.
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2220
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2221 Fourth arg SOLICIT non-nil provokes solicitation from the user of a
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2222 choice among the valid bullets. (This overrides other all the
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2223 options, including, eg, a distinctive PRIOR-BULLET.)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2224
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2225 Fifth arg, NUMBER-CONTROL, matters only if 'outline-numbered-bullet'
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2226 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
2227 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
2228 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
2229
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2230 \(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
2231
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2232 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
2233 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
2234 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
2235 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
2236 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
2237 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
2238 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
2239 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
2240 index for each successive sibling)."
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2241 ;;;_ . Code:
3430
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2242 ;; The options are ordered in likely frequence of use, most common
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2243 ;; highest, least lowest. Ie, more likely to be doing prefix
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2244 ;; adjustments than soliciting, and yet more than numbering.
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2245 ;; Current prefix is least dominant, but most likely to be commonly
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2246 ;; specified...
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2247
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2248 (let* (body
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2249 numbering
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2250 denumbering
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2251 (depth (or depth (outline-depth)))
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2252 (header-lead outline-header-prefix)
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2253 (bullet-char
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2254
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2255 ;; Getting value for bullet char is practically the whole job:
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2256
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2257 (cond
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2258 ; Simplest situation - level 1:
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2259 ((<= depth 1) (setq header-lead "") outline-primary-bullet)
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2260 ; Simple, too: all asterisks:
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2261 (outline-old-style-prefixes
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2262 ;; Cheat - make body the whole thing, null out header-lead and
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2263 ;; bullet-char:
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2264 (setq body (make-string depth
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2265 (string-to-char outline-primary-bullet)))
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2266 (setq header-lead "")
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2267 "")
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2268
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2269 ;; (Neither level 1 nor old-style, so we're space padding.
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2270 ;; 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
2271
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2272 ;; Solicitation overrides numbering and other cases:
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2273 ((progn (setq body (make-string (- depth 2) ?\ ))
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2274 ;; The actual condition:
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2275 solicit)
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2276 (let* ((got (outline-solicit-alternate-bullet depth)))
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2277 ;; Gotta check whether we're numbering and got a numbered bullet:
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2278 (setq numbering (and outline-numbered-bullet
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2279 (not (and number-control (not index)))
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2280 (string= got outline-numbered-bullet)))
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2281 ;; Now return what we got, regardless:
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2282 got))
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2283
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2284 ;; Numbering invoked through args:
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2285 ((and outline-numbered-bullet number-control)
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2286 (if (setq numbering (not (setq denumbering (not index))))
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2287 outline-numbered-bullet
7416
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
2288 (if (and prior-bullet
3430
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2289 (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
2290 prior-bullet)))
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
2291 prior-bullet
3430
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2292 (outline-bullet-for-depth depth))))
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2293
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2294 ;;; Neither soliciting nor controlled numbering ;;;
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2295 ;;; (may be controlled denumbering, tho) ;;;
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2296
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2297 ;; Check wrt previous sibling:
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2298 ((and new ; only check for new prefixes
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2299 (<= depth (outline-depth))
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2300 outline-numbered-bullet ; ... & numbering enabled
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2301 (not denumbering)
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2302 (let ((sibling-bullet
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2303 (save-excursion
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2304 ;; Locate correct sibling:
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2305 (or (>= depth (outline-depth))
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2306 (outline-ascend-to-depth depth))
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2307 (outline-get-bullet))))
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2308 (if (and sibling-bullet
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2309 (string= outline-numbered-bullet sibling-bullet))
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2310 (setq numbering sibling-bullet)))))
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2311
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2312 ;; Distinctive prior bullet?
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2313 ((and prior-bullet
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2314 (outline-distinctive-bullet prior-bullet)
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2315 ;; Either non-numbered:
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2316 (or (not (and outline-numbered-bullet
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2317 (string= prior-bullet outline-numbered-bullet)))
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2318 ;; or numbered, and not denumbering:
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2319 (setq numbering (not denumbering)))
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2320 ;; Here 'tis:
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2321 prior-bullet))
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2322
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2323 ;; Else, standard bullet per depth:
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2324 ((outline-bullet-for-depth depth)))))
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2325
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2326 (concat header-lead
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2327 body
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2328 bullet-char
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2329 (if numbering
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2330 (format "%d" (cond ((and index (numberp index)) index)
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2331 (new (1+ (outline-sibling-index depth)))
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2332 ((outline-sibling-index))))))
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2333 )
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2334 )
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2335 ;;;_ > outline-open-topic (relative-depth &optional before)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2336 (defun outline-open-topic (relative-depth &optional before)
7416
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
2337 "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
2338
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
2339 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
2340 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
2341 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
2342
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2343 Nuances:
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2344
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2345 - 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
2346 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
2347
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2348 - 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
2349 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
2350 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
2351 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
2352 deliberately dividing topic bodies.
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2353
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2354 - 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
2355 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
2356 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
2357 single-spacing is used.
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2358
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2359 - 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
2360 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
2361 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
2362 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
2363 from there."
3430
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2364
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2365 (let* ((depth (+ (outline-current-depth) relative-depth))
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2366 (opening-on-blank (if (looking-at "^\$")
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2367 (not (setq before nil))))
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2368 opening-numbered ; Will get while computing ref-topic, below
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2369 ref-depth ; Will get while computing ref-topic, next
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2370 (ref-topic (save-excursion
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2371 (cond ((< relative-depth 0)
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2372 (outline-ascend-to-depth depth))
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2373 ((>= relative-depth 1) nil)
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2374 (t (outline-back-to-current-heading)))
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2375 (setq ref-depth (outline-recent-depth))
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2376 (setq opening-numbered
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2377 (save-excursion
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2378 (and outline-numbered-bullet
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2379 (or (<= relative-depth 0)
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2380 (outline-descend-to-depth depth))
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2381 (if (outline-numbered-type-prefix)
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2382 outline-numbered-bullet))))
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2383 (point)))
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2384 dbl-space
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2385 doing-beginning)
3430
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2386
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2387 (if (not opening-on-blank)
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2388 ; Positioning and vertical
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2389 ; padding - only if not
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2390 ; opening-on-blank:
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2391 (progn
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2392 (goto-char ref-topic)
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2393 (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
2394 (or (and (<= relative-depth 0) ; not descending;
3430
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2395 (save-excursion
13964
4de229297f1f (outline-primary-bullet, outline-numbered-bullet,
Karl Heuer <kwzh@gnu.org>
parents: 13337
diff changeset
2396 ;; 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
2397 (or (> 0 (forward-line -1))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2398 (looking-at "^\\s-*$")
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2399 (bobp)))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2400 (save-excursion
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2401 ;; succeeded by a blank line?
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2402 (outline-end-of-current-subtree)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2403 (bolp)))
3430
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2404 (and (= ref-depth 1)
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2405 (or before
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2406 (= depth 1)
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2407 (save-excursion
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2408 ;; Don't already have following
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2409 ;; vertical padding:
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2410 (not (outline-pre-next-preface)))))))
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2411
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2412 ; Position to prior heading,
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2413 ; if inserting backwards, and
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2414 ; not going outwards:
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2415 (if (and before (>= relative-depth 0))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2416 (progn (outline-back-to-current-heading)
3430
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2417 (setq doing-beginning (bobp))
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2418 (if (not (bobp))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2419 (outline-previous-heading)))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2420 (if (and before (bobp))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2421 (outline-unprotected (open-line 1))))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2422
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2423 (if (<= relative-depth 0)
3430
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2424 ;; Not going inwards, don't snug up:
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2425 (if doing-beginning
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2426 (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
2427 (if before
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2428 (progn (end-of-line)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2429 (outline-pre-next-preface)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2430 (while (= ?\r (following-char))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2431 (forward-char 1))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2432 (if (not (looking-at "^$"))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2433 (outline-unprotected (open-line 1))))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2434 (outline-end-of-current-subtree)))
3430
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2435 ;; Going inwards - double-space if first offspring is,
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2436 ;; otherwise snug up.
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2437 (end-of-line) ; So we skip any concealed progeny.
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2438 (outline-pre-next-preface)
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2439 (if (bolp)
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2440 ;; Blank lines between current header body and next
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2441 ;; header - get to last substantive (non-white-space)
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2442 ;; line in body:
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2443 (re-search-backward "[^ \t\n]" nil t))
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2444 (if (save-excursion
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2445 (outline-next-heading)
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2446 (if (> (outline-recent-depth) ref-depth)
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2447 ;; This is an offspring.
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2448 (progn (forward-line -1)
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2449 (looking-at "^\\s-*$"))))
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2450 (progn (forward-line 1)
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2451 (outline-unprotected (open-line 1))))
3430
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2452 (end-of-line))
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2453 ;;(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
2454 (if (not (bobp))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2455 (progn (if (and (not (> depth ref-depth))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2456 (not before))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2457 (outline-unprotected (open-line 1))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2458 (if (> depth ref-depth)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2459 (outline-unprotected (newline 1))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2460 (if dbl-space
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2461 (outline-unprotected (open-line 1))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2462 (if (not before)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2463 (outline-unprotected (newline 1))))))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2464 (if dbl-space
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2465 (outline-unprotected (newline 1)))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2466 (if (and (not (eobp))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2467 (not (bolp)))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2468 (forward-char 1))))
3430
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2469 ))
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2470 (insert-string (concat (outline-make-topic-prefix opening-numbered
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2471 t
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2472 depth)
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2473 " "))
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2474
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2475 ;;(if doing-beginning (save-excursion (newline (if dbl-space 2 1))))
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2476
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2477
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2478 (outline-rebullet-heading nil ;;; solicit
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2479 depth ;;; depth
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2480 nil ;;; number-control
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2481 nil ;;; index
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2482 t) (end-of-line)
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2483 )
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2484 )
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2485 ;;;_ . open-topic contingencies
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2486 ;;;_ ; 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
2487 ;;;_ , beginning char
13964
4de229297f1f (outline-primary-bullet, outline-numbered-bullet,
Karl Heuer <kwzh@gnu.org>
parents: 13337
diff changeset
2488 ;;;_ , 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
2489 ;;;_ , 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
2490 ;;;_ ; absolute depth of new topic
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2491 ;;;_ ! insert in place - overrides most stuff
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2492 ;;;_ ; relative depth of new re base
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2493 ;;;_ ; before or after base topic
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2494 ;;;_ ; 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
2495 ;;;_ ; 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
2496 ;;;_ ; 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
2497 ;;;_ ; location of new topic
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2498 ;;;_ .
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2499 ;;;_ > outline-open-subtopic (arg)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2500 (defun outline-open-subtopic (arg)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2501 "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
2502
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2503 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
2504 prior to the current one."
3430
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2505 (interactive "p")
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2506 (outline-open-topic 1 (> 0 arg)))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2507 ;;;_ > outline-open-sibtopic (arg)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2508 (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
2509 "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
2510
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
2511 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
2512 one."
3430
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2513 (interactive "p")
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2514 (outline-open-topic 0 (> 0 arg)))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2515 ;;;_ > outline-open-supertopic (arg)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2516 (defun outline-open-supertopic (arg)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2517 "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
2518
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2519 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
2520 topic prior to the current one."
3430
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2521
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2522 (interactive "p")
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2523 (outline-open-topic -1 (> 0 arg)))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2524
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2525 ;;;_ - Outline Alteration
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2526 ;;;_ : Topic Modification
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2527 ;;;_ = outline-former-auto-filler
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2528 (defvar outline-former-auto-filler nil
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2529 "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
2530 ;;;_ > outline-auto-fill ()
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2531 (defun outline-auto-fill ()
7416
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
2532 "Outline-mode autofill function.
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
2533
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
2534 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
2535 `outline-use-hanging-indents' is set."
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2536 (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
2537 ;; Check for topic header indentation:
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2538 (save-excursion
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2539 (beginning-of-line)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2540 (if (looking-at outline-regexp)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2541 ;; ... construct indentation to account for
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2542 ;; length of topic prefix:
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2543 (make-string (progn (outline-end-of-prefix)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2544 (current-column))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2545 ?\ ))))))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2546 (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
2547 (do-auto-fill))))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2548 ;;;_ > 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
2549 (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
2550 "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
2551
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2552 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
2553 be accommodated.
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2554
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2555 Note that refill of indented paragraphs is not done."
3430
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2556
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2557 (save-excursion
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2558 (outline-end-of-prefix)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2559 (let* ((new-margin (current-column))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2560 excess old-indent-begin old-indent-end
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2561 curr-ind
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2562 ;; 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
2563 ;; *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
2564 ;; 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
2565 (old-margin (+ old-depth (- new-margin new-depth))))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2566
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2567 ;; 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
2568 (outline-unprotected
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2569 (save-match-data
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2570 (while
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2571 (and (re-search-forward "[\n\r]\\(\\s-*\\)"
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2572 nil
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2573 t)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2574 ;; Register the indent data, before we reset the
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2575 ;; match data with a subsequent 'looking-at':
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2576 (setq old-indent-begin (match-beginning 1)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2577 old-indent-end (match-end 1))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2578 (not (looking-at outline-regexp)))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2579 (if (> 0 (setq excess (- (current-column)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2580 old-margin)))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2581 ;; 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
2582 nil
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2583 ;; 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
2584 ;; reindent it, preserving its existing indentation
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2585 ;; beyond the old margin:
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2586 (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
2587 (indent-to (+ new-margin excess)))))))))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2588 ;;;_ > outline-rebullet-current-heading (arg)
3430
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2589 (defun outline-rebullet-current-heading (arg)
7416
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
2590 "Like non-interactive version 'outline-rebullet-heading'.
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
2591
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
2592 But \(only\) affects visible heading containing point.
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2593
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2594 With repeat count, solicit for bullet."
3430
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2595 (interactive "P")
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2596 (save-excursion (outline-back-to-current-heading)
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2597 (outline-end-of-prefix)
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2598 (outline-rebullet-heading (not arg) ;;; solicit
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2599 nil ;;; depth
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2600 nil ;;; number-control
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2601 nil ;;; index
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2602 t) ;;; do-successors
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2603 )
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2604 )
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2605 ;;;_ > outline-rebullet-heading (&optional solicit ...)
3430
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2606 (defun outline-rebullet-heading (&optional solicit
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2607 new-depth
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2608 number-control
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2609 index
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2610 do-successors)
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2611
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2612 "Adjust bullet of current topic prefix.
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2613
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2614 All args are optional.
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2615
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2616 If SOLICIT is non-nil then the choice of bullet is solicited from
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2617 user. Otherwise the distinctiveness of the bullet or the topic
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2618 depth determines it.
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2619
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2620 Second arg DEPTH forces the topic prefix to that depth, regardless
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2621 of the topics current depth.
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2622
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2623 Third arg NUMBER-CONTROL can force the prefix to or away from
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2624 numbered form. It has effect only if 'outline-numbered-bullet' is
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2625 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
2626 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
2627 of the forth arg, INDEX.
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2628
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2629 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
2630 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
2631 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
2632 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
2633 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
2634 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
2635 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
2636
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2637 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
2638 siblings.
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2639
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2640 Cf vars 'outline-stylish-prefixes', 'outline-old-style-prefixes',
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2641 and 'outline-numbered-bullet', which all affect the behavior of
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2642 this function."
3430
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2643
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2644 (let* ((current-depth (outline-depth))
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2645 (new-depth (or new-depth current-depth))
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2646 (mb outline-recent-prefix-beginning)
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2647 (me outline-recent-prefix-end)
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2648 (current-bullet (buffer-substring (- me 1) me))
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2649 (new-prefix (outline-make-topic-prefix current-bullet
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2650 nil
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2651 new-depth
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2652 solicit
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2653 number-control
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2654 index)))
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2655
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2656 ;; Is new one is identical to old?
3430
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2657 (if (and (= current-depth new-depth)
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2658 (string= current-bullet
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2659 (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
2660 ;; Nothing to do:
3430
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2661 t
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2662
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2663 ;; New prefix probably different from old:
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2664 ; get rid of old one:
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2665 (outline-unprotected (delete-region mb me))
3430
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2666 (goto-char mb)
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2667 ; Dispense with number if
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2668 ; numbered-bullet prefix:
3430
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2669 (if (and outline-numbered-bullet
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2670 (string= outline-numbered-bullet current-bullet)
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2671 (looking-at "[0-9]+"))
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2672 (outline-unprotected
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2673 (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
2674
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2675 ; Put in new prefix:
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2676 (outline-unprotected (insert-string new-prefix))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2677
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2678 ;; 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
2679 (if (and outline-reindent-bodies
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2680 (not (= new-depth current-depth)))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2681 (outline-reindent-body current-depth new-depth))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2682
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2683 ;; 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
2684 ;; caller elected for it:
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2685 (if do-successors
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2686 (save-excursion
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2687 (while (outline-next-sibling new-depth nil)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2688 (setq index
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2689 (cond ((numberp index) (1+ index))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2690 ((not number-control) (outline-sibling-index))))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2691 (if (outline-numbered-type-prefix)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2692 (outline-rebullet-heading nil ;;; solicit
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2693 new-depth ;;; new-depth
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2694 number-control;;; number-control
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2695 index ;;; index
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2696 nil))))) ;;;(dont!)do-successors
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2697 ) ; (if (and (= current-depth new-depth)...))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2698 ) ; let* ((current-depth (outline-depth))...)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2699 ) ; defun
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2700 ;;;_ > outline-rebullet-topic (arg)
3430
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2701 (defun outline-rebullet-topic (arg)
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2702 "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
2703
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2704 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
2705
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2706 With repeat count, shift topic depth by that amount."
3430
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2707 (interactive "P")
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2708 (let ((start-col (current-column))
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2709 (was-eol (eolp)))
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2710 (save-excursion
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2711 ;; Normalize arg:
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2712 (cond ((null arg) (setq arg 0))
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2713 ((listp arg) (setq arg (car arg))))
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2714 ;; 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
2715 (if (not (zerop arg)) (message "Shifting..."))
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2716 (outline-back-to-current-heading)
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2717 (if (<= (+ (outline-recent-depth) arg) 0)
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2718 (error "Attempt to shift topic below level 1"))
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2719 (outline-rebullet-topic-grunt arg)
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2720 (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
2721 (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
2722 ;;;_ > outline-rebullet-topic-grunt (&optional relative-depth ...)
3430
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2723 (defun outline-rebullet-topic-grunt (&optional relative-depth
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2724 starting-depth
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2725 starting-point
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2726 index
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2727 do-successors)
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2728
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2729 "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
2730 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
2731 behavior.
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2732
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2733 All arguments are optional.
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2734
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2735 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
2736 topic that amount.
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2737
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2738 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
2739 itself. The are STARTING-DEPTH, STARTING-POINT, and INDEX."
3430
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2740
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2741 (let* ((relative-depth (or relative-depth 0))
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2742 (new-depth (outline-depth))
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2743 (starting-depth (or starting-depth new-depth))
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2744 (on-starting-call (null starting-point))
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2745 (index (or index
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2746 ;; Leave index null on starting call, so rebullet-heading
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2747 ;; calculates it at what might be new depth:
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2748 (and (or (zerop relative-depth)
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2749 (not on-starting-call))
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2750 (outline-sibling-index))))
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2751 (moving-outwards (< 0 relative-depth))
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2752 (starting-point (or starting-point (point))))
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2753
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2754 ;; Sanity check for excessive promotion done only on starting call:
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2755 (and on-starting-call
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2756 moving-outwards
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2757 (> 0 (+ starting-depth relative-depth))
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2758 (error "Attempt to shift topic out beyond level 1.")) ;;; ====>
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2759
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2760 (cond ((= starting-depth new-depth)
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2761 ;; We're at depth to work on this one:
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2762 (outline-rebullet-heading nil ;;; solicit
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2763 (+ starting-depth ;;; starting-depth
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2764 relative-depth)
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2765 nil ;;; number
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2766 index ;;; index
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2767 ;; Every contained topic will get hit,
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2768 ;; and we have to get to outside ones
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2769 ;; deliberately:
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2770 nil) ;;; do-successors
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2771 ;; ... and work on subsequent ones which are at greater depth:
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2772 (setq index 0)
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2773 (outline-next-heading)
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2774 (while (and (not (eobp))
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2775 (< starting-depth (outline-recent-depth)))
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2776 (setq index (1+ index))
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2777 (outline-rebullet-topic-grunt relative-depth ;;; relative-depth
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2778 (1+ starting-depth);;;starting-depth
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2779 starting-point ;;; starting-point
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2780 index))) ;;; index
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2781
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2782 ((< starting-depth new-depth)
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2783 ;; Rare case - subtopic more than one level deeper than parent.
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2784 ;; Treat this one at an even deeper level:
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2785 (outline-rebullet-topic-grunt relative-depth ;;; relative-depth
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2786 new-depth ;;; starting-depth
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2787 starting-point ;;; starting-point
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2788 index))) ;;; index
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2789
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2790 (if on-starting-call
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2791 (progn
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2792 ;; Rectify numbering of former siblings of the adjusted topic,
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2793 ;; if topic has changed depth
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2794 (if (or do-successors
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2795 (and (not (zerop relative-depth))
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2796 (or (= (outline-recent-depth) starting-depth)
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2797 (= (outline-recent-depth) (+ starting-depth
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2798 relative-depth)))))
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2799 (outline-rebullet-heading nil nil nil nil t))
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2800 ;; Now rectify numbering of new siblings of the adjusted topic,
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2801 ;; if depth has been changed:
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2802 (progn (goto-char starting-point)
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2803 (if (not (zerop relative-depth))
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2804 (outline-rebullet-heading nil nil nil nil t)))))
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2805 )
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2806 )
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2807 ;;;_ > outline-renumber-to-depth (&optional depth)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2808 (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
2809 "Renumber siblings at current depth.
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
2810
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
2811 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
2812
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2813 Returns final depth."
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2814
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2815 ;; 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
2816 ;; 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
2817
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2818 (let ((ascender (outline-depth)))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2819 (while (and (not (eobp))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2820 (outline-depth)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2821 (>= (outline-recent-depth) depth)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2822 (>= ascender depth))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2823 ; Skip over all topics at
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2824 ; lesser depths, which can not
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2825 ; have been disturbed:
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2826 (while (and (not (eobp))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2827 (> (outline-recent-depth) ascender))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2828 (outline-next-heading))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2829 ; Prime ascender for ascension:
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2830 (setq ascender (1- (outline-recent-depth)))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2831 (if (>= (outline-recent-depth) depth)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2832 (outline-rebullet-heading nil ;;; solicit
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2833 nil ;;; depth
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2834 nil ;;; number-control
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2835 nil ;;; index
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2836 t))));;; do-successors
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2837 (outline-recent-depth))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2838 ;;;_ > outline-number-siblings (&optional denumber)
3430
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2839 (defun outline-number-siblings (&optional denumber)
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2840 "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
2841
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2842 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
2843 topic and its siblings.
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2844
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2845 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
2846 rebulleting each topic at this level."
3430
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2847
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2848 (interactive "P")
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2849
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2850 (save-excursion
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2851 (outline-back-to-current-heading)
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2852 (outline-beginning-of-level)
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2853 (let ((depth (outline-recent-depth))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2854 (index (if (not denumber) 1))
3430
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2855 (use-bullet (equal '(16) denumber))
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2856 (more t))
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2857 (while more
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2858 (outline-rebullet-heading use-bullet ;;; solicit
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2859 depth ;;; depth
3430
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2860 t ;;; number-control
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2861 index ;;; index
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2862 nil) ;;; do-successors
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2863 (if index (setq index (1+ index)))
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2864 (setq more (outline-next-sibling depth nil))))))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2865 ;;;_ > outline-shift-in (arg)
3430
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2866 (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
2867 "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
2868 (interactive "p")
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2869 (outline-rebullet-topic arg))
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2870 ;;;_ > outline-shift-out (arg)
3430
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2871 (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
2872 "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
2873 (interactive "p")
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2874 (outline-rebullet-topic (* arg -1)))
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2875 ;;;_ : 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
2876 ;;;_ > outline-kill-line (&optional arg)
3430
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2877 (defun outline-kill-line (&optional arg)
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2878 "Kill line, adjusting subsequent lines suitably for outline mode."
3430
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2879
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2880 (interactive "*P")
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2881 (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
2882 outline-numbered-bullet ; numbers may need adjustment,
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2883 (bolp) ; may be clipping topic head,
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2884 (looking-at outline-regexp))) ; are clipping topic head.
3430
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2885 ;; Above conditions do not obtain - just do a regular kill:
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2886 (kill-line arg)
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2887 ;; 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
2888 (let* ((depth (outline-depth)))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2889 ; Do the kill:
3430
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2890 (kill-line arg)
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2891 ; Provide some feedback:
3430
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2892 (sit-for 0)
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2893 (save-excursion
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2894 ; Start with the topic
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2895 ; following killed line:
3430
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2896 (if (not (looking-at outline-regexp))
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2897 (outline-next-heading))
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2898 (outline-renumber-to-depth depth)))))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2899 ;;;_ > outline-kill-topic ()
3430
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2900 (defun outline-kill-topic ()
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2901 "Kill topic together with subtopics.
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 Leaves primary topic's trailing vertical whitespace, if any."
3430
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2904
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2905 ;; Some finagling is done to make complex topic kills appear faster
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2906 ;; than they actually are. A redisplay is performed immediately
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2907 ;; after the region is disposed of, though the renumbering process
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2908 ;; 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
2909 ;; a lag *after* the kill has been performed.
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2910
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2911 (interactive)
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2912 (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
2913 (depth (outline-recent-depth)))
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2914 (outline-end-of-current-subtree)
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2915 (if (not (eobp))
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2916 (if (or (not (looking-at "^$"))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2917 ;; 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
2918 ;; 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
2919 ;; 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
2920 ;; containing topic:
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2921 (save-excursion
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2922 (and (outline-next-heading)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2923 (>= (outline-recent-depth) depth))))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2924 (forward-char 1)))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2925
3430
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2926 (kill-region beg (point))
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2927 (sit-for 0)
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2928 (save-excursion
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2929 (outline-renumber-to-depth depth))))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2930 ;;;_ > outline-yank-processing ()
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2931 (defun outline-yank-processing (&optional arg)
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 "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
2934
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2935 Does depth adjustment of yanked topics, when:
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2936
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2937 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
2938 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
2939 topic prefix.
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2940
13964
4de229297f1f (outline-primary-bullet, outline-numbered-bullet,
Karl Heuer <kwzh@gnu.org>
parents: 13337
diff changeset
2941 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
2942
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2943 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
2944 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
2945 header into which it's being yanked.
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2946
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2947 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
2948 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
2949 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
2950
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2951 (interactive "*P")
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2952 ; Get to beginning, leaving
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2953 ; region around subject:
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2954 (if (< (mark-marker) (point))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2955 (exchange-point-and-mark))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2956 (let* ((subj-beg (point))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2957 (subj-end (mark-marker))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2958 ;; 'resituate' if yanking an entire topic into topic header:
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2959 (resituate (and (outline-e-o-prefix-p)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2960 (looking-at (concat "\\(" outline-regexp "\\)"))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2961 (outline-prefix-data (match-beginning 1)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2962 (match-end 1))))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2963 ;; 'rectify-numbering' if resituating (where several topics may
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2964 ;; 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
2965 (rectify-numbering (or resituate
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2966 (and (bolp) (looking-at outline-regexp)))))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2967 (if resituate
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2968 ; The yanked stuff is a topic:
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2969 (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
2970 (subj-depth (outline-recent-depth))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2971 (prefix-bullet (outline-recent-bullet))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2972 (adjust-to-depth
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2973 ;; 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
2974 ;; adjustment should be made:
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2975 (save-excursion
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2976 (and (goto-char subj-end)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2977 (eolp)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2978 (goto-char subj-beg)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2979 (and (looking-at outline-regexp)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2980 (progn
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2981 (beginning-of-line)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2982 (not (= (point) subj-beg)))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2983 (looking-at outline-regexp)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2984 (outline-prefix-data (match-beginning 0)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2985 (match-end 0)))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2986 (outline-recent-depth))))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2987 done
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2988 (more t))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2989 (setq rectify-numbering outline-numbered-bullet)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2990 (if adjust-to-depth
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2991 ; Do the adjustment:
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2992 (progn
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2993 (message "... yanking") (sit-for 0)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2994 (save-restriction
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2995 (narrow-to-region subj-beg subj-end)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2996 ; Trim off excessive blank
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2997 ; line at end, if any:
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2998 (goto-char (point-max))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
2999 (if (looking-at "^$")
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3000 (outline-unprotected (delete-char -1)))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3001 ; Work backwards, with each
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3002 ; shallowest level,
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3003 ; successively excluding the
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3004 ; last processed topic from
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3005 ; the narrow region:
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3006 (while more
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3007 (outline-back-to-current-heading)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3008 ; 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
3009 (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
3010 (save-excursion
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3011 (outline-rebullet-topic-grunt (- adjust-to-depth
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3012 subj-depth))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3013 (outline-depth))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3014 (if (setq more (not (bobp)))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3015 (progn (widen)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3016 (forward-char -1)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3017 (narrow-to-region subj-beg (point))))))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3018 (message "")
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3019 ;; 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
3020 ;; use old one:
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3021 (if (string-match (regexp-quote prefix-bullet)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3022 outline-distinctive-bullets-string)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3023 ; Delete from bullet of old to
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3024 ; before bullet of new:
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3025 (progn
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3026 (beginning-of-line)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3027 (delete-region (point) subj-beg)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3028 (set-marker (mark-marker) subj-end)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3029 (goto-char subj-beg)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3030 (outline-end-of-prefix))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3031 ; Delete base subj prefix,
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3032 ; leaving old one:
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3033 (delete-region (point) (+ (point)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3034 prefix-len
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3035 (- adjust-to-depth subj-depth)))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3036 ; and delete residual subj
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3037 ; prefix digits and space:
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3038 (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
3039 (if (looking-at " ") (delete-char 1))))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3040 (exchange-point-and-mark))))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3041 (if rectify-numbering
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3042 (progn
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3043 (save-excursion
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3044 ; Give some preliminary feedback:
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3045 (message "... reconciling numbers") (sit-for 0)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3046 ; ... and renumber, in case necessary:
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3047 (goto-char subj-beg)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3048 (if (outline-goto-prefix)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3049 (outline-rebullet-heading nil ;;; solicit
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3050 (outline-depth) ;;; depth
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3051 nil ;;; number-control
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3052 nil ;;; index
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3053 t))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3054 (message ""))))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3055 (if (not resituate)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3056 (exchange-point-and-mark))))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3057 ;;;_ > outline-yank (&optional arg)
3430
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3058 (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
3059 "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
3060
13964
4de229297f1f (outline-primary-bullet, outline-numbered-bullet,
Karl Heuer <kwzh@gnu.org>
parents: 13337
diff changeset
3061 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
3062
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3063 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
3064 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
3065
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3066 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
3067 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
3068 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
3069 topic prefix.
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3070
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3071 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
3072 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
3073 header into which it's being yanked.
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3074
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3075 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
3076 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
3077 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
3078 exactly like normal yanks.
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3079
13964
4de229297f1f (outline-primary-bullet, outline-numbered-bullet,
Karl Heuer <kwzh@gnu.org>
parents: 13337
diff changeset
3080 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
3081 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
3082
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3083 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
3084 works with normal yank in non-outline buffers."
3430
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3085
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3086 (interactive "*P")
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3087 (setq this-command 'yank)
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3088 (yank arg)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3089 (if (outline-mode-p)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3090 (outline-yank-processing)))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3091 ;;;_ > outline-yank-pop (&optional arg)
3430
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3092 (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
3093 "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
3094
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
3095 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
3096
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3097 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
3098 by pops to non-distinctive yanks. Bug..."
3430
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3099
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3100 (interactive "*p")
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3101 (setq this-command 'yank)
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3102 (yank-pop arg)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3103 (if (outline-mode-p)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3104 (outline-yank-processing)))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3105
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3106 ;;;_ - Specialty bullet functions
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3107 ;;;_ : File Cross references
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3108 ;;;_ > outline-resolve-xref ()
3430
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3109 (defun outline-resolve-xref ()
7416
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
3110 "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
3111
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
3112 \(Works according to setting of `outline-file-xref-bullet')."
3430
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3113 (interactive)
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3114 (if (not outline-file-xref-bullet)
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3115 (error
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3116 "outline cross references disabled - no 'outline-file-xref-bullet'")
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3117 (if (not (string= (outline-current-bullet) outline-file-xref-bullet))
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3118 (error "current heading lacks cross-reference bullet '%s'"
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3119 outline-file-xref-bullet)
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3120 (let (file-name)
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3121 (save-excursion
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3122 (let* ((text-start outline-recent-prefix-end)
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3123 (heading-end (progn (outline-pre-next-preface)
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3124 (point))))
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3125 (goto-char text-start)
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3126 (setq file-name
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3127 (if (re-search-forward "\\s-\\(\\S-*\\)" heading-end t)
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3128 (buffer-substring (match-beginning 1) (match-end 1))))))
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3129 (setq file-name
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3130 (if (not (= (aref file-name 0) ?:))
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3131 (expand-file-name file-name)
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3132 ; A registry-files ref, strip the ':'
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3133 ; and try to follow it:
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3134 (let ((reg-ref (reference-registered-file
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3135 (substring file-name 1) nil t)))
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3136 (if reg-ref (car (cdr reg-ref))))))
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3137 (if (or (file-exists-p file-name)
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3138 (if (file-writable-p file-name)
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3139 (y-or-n-p (format "%s not there, create one? "
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3140 file-name))
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3141 (error "%s not found and can't be created" file-name)))
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3142 (condition-case failure
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3143 (find-file-other-window file-name)
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3144 (error failure))
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3145 (error "%s not found" file-name))
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3146 )
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3147 )
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3148 )
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3149 )
7416
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
3150
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
3151 ;;;_ #6 Exposure Control and Processing
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3152
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3153 ;;;_ - Fundamental
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3154 ;;;_ > outline-flag-region (from to flag)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3155 (defmacro outline-flag-region (from to flag)
7416
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
3156 "Hide or show lines from FROM to TO, via emacs selective-display FLAG char.
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
3157 Ie, text following flag C-m \(carriage-return) is hidden until the
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
3158 next C-j (newline) char.
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
3159
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
3160 Returns the endpoint of the region."
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3161 (` (let ((buffer-read-only nil)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3162 (outline-override-protect t))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3163 (subst-char-in-region (, from) (, to)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3164 (if (= (, flag) ?\n) ?\r ?\n)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3165 (, flag) t))))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3166 ;;;_ > outline-flag-current-subtree (flag)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3167 (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
3168 "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
3169
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
3170 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
3171
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3172 (save-excursion
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3173 (outline-back-to-current-heading)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3174 (outline-flag-region (point)
7416
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
3175 (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
3176 flag)))
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3177
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3178 ;;;_ - Mapping and processing of topics
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3179 ;;;_ " See also chart functions, in navigation
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3180 ;;;_ > outline-listify-exposed (&optional start end)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3181 (defun outline-listify-exposed (&optional start end)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3182
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3183 "Produce a list representing exposed topics in current region.
7416
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
3184
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3185 This list can then be used by 'outline-process-exposed' to manipulate
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3186 the subject region.
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3187
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3188 List is composed of elements that may themselves be lists representing
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3189 exposed components in subtopic.
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3190
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3191 Each component list contains:
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3192 - a number representing the depth of the topic,
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3193 - a string representing the header-prefix (ref. 'outline-header-prefix'),
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3194 - a string representing the bullet character,
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3195 - and a series of strings, each containing one line of the exposed
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3196 portion of the topic entry."
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3197
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3198 (interactive "r")
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3199 (save-excursion
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3200 (let* (strings pad result depth bullet beg next done) ; State vars.
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3201 (goto-char start)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3202 (beginning-of-line)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3203 (if (not (outline-goto-prefix)) ; Get initial position within a topic:
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3204 (outline-next-visible-heading 1))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3205 (while (and (not done)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3206 (not (eobp)) ; Loop until we've covered the region.
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3207 (not (> (point) end)))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3208 (setq depth (outline-recent-depth) ; Current topics' depth,
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3209 bullet (outline-recent-bullet) ; ... bullet,
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3210 beg (progn (outline-end-of-prefix t) (point))) ; and beginning.
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3211 (setq done ; The boundary for the current topic:
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3212 (not (outline-next-visible-heading 1)))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3213 (beginning-of-line)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3214 (setq next (point))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3215 (goto-char beg)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3216 (setq strings nil)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3217 (while (> next (point)) ; Get all the exposed text in
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3218 (setq strings
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3219 (cons (buffer-substring
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3220 beg
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3221 ;To hidden text or end of line:
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3222 (progn
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3223 (search-forward "\r"
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3224 (save-excursion (end-of-line)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3225 (point))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3226 1)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3227 (if (= (preceding-char) ?\r)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3228 (1- (point))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3229 (point))))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3230 strings))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3231 (if (< (point) next) ; Resume from after hid text, if any.
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3232 (forward-line 1))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3233 (setq beg (point)))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3234 ;; Accumulate list for this topic:
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3235 (setq result
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3236 (cons (append (list depth
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3237 outline-header-prefix
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3238 bullet)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3239 (nreverse strings))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3240 result)))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3241 ;; Put the list with first at front, to last at back:
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3242 (nreverse result))))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3243 ;;;_ > outline-process-exposed (arg &optional tobuf)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3244 (defun outline-process-exposed (&optional func from to frombuf tobuf)
7416
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
3245 "Map function on exposed parts of current topic; results to another buffer.
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
3246
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
3247 Apply FUNCTION \(default 'outline-insert-listified) to exposed
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3248 portions FROM position TO position \(default region, or the entire
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3249 buffer if no region active) in buffer FROMBUF \(default current
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3250 buffer) to buffer TOBUF \(default is buffer named like frombuf but
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3251 with \"*\" prepended and \" exposed*\" appended).
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3252
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3253 The function must as its arguments the elements of the list
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3254 representations of topic entries produced by outline-listify-exposed."
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3255
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3256 ; Resolve arguments,
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3257 ; defaulting if necessary:
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3258 (if (not func) (setq func 'outline-insert-listified))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3259 (if (not (and from to))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3260 (if mark-active
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3261 (setq from (region-beginning) to (region-end))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3262 (setq from (point-min) to (point-max))))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3263 (if frombuf
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3264 (if (not (bufferp frombuf))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3265 ;; Specified but not a buffer - get it:
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3266 (let ((got (get-buffer frombuf)))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3267 (if (not got)
14416
3ec65c6789eb (outline-process-exposed): Fix error format string.
Karl Heuer <kwzh@gnu.org>
parents: 14169
diff changeset
3268 (error "outline-process-exposed: source buffer %s not found."
3ec65c6789eb (outline-process-exposed): Fix error format string.
Karl Heuer <kwzh@gnu.org>
parents: 14169
diff changeset
3269 frombuf)
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3270 (setq frombuf got))))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3271 ;; not specified - default it:
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3272 (setq frombuf (current-buffer)))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3273 (if tobuf
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3274 (if (not (bufferp tobuf))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3275 (setq tobuf (get-buffer-create tobuf)))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3276 ;; not specified - default it:
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3277 (setq tobuf (concat "*" (buffer-name frombuf) " exposed*")))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3278
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3279 (let* ((listified (progn (set-buffer frombuf)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3280 (outline-listify-exposed from to)))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3281 (prefix outline-header-prefix) ; ... as set in frombuf.
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3282 curr)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3283 (set-buffer tobuf)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3284 (while listified
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3285 (setq curr (car listified))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3286 (setq listified (cdr listified))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3287 (apply func (list (car curr) ; depth
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3288 (car (cdr curr)) ; header-prefix
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3289 (car (cdr (cdr curr))) ; bullet
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3290 (cdr (cdr (cdr curr)))))) ; list of text lines
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3291 (pop-to-buffer tobuf)))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3292
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3293 ;;;_ - Topic-specific
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3294 ;;;_ > outline-show-entry ()
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3295 ; outline-show-entry basically for isearch dynamic exposure, as is...
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3296 (defun outline-show-entry ()
7416
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
3297 "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
3298
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3299 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
3300 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
3301 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
3302 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
3303
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3304 (interactive)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3305 (save-excursion
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3306 (outline-goto-prefix)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3307 (outline-flag-region (if (bobp) (point) (1- (point)))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3308 (or (outline-pre-next-preface) (point))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3309 ?\n)))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3310 ;;;_ > outline-show-children (&optional level strict)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3311 (defun outline-show-children (&optional level strict)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3312
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3313 "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
3314
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3315 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
3316
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3317 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
3318 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
3319
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3320 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
3321 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
3322 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
3323 it.
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
3324
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
3325 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
3326 point of non-opened subtree?)"
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3327
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3328 (interactive "p")
7416
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
3329 (let (max-pos)
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
3330 (if (and (not strict)
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
3331 (outline-hidden-p))
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
3332
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
3333 (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
3334 ; expose it.
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
3335 ;; 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
3336 ;; infinite regress:
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
3337 (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
3338
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
3339 (save-excursion
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
3340 (save-restriction
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
3341 (let* ((start-pt (point))
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
3342 (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
3343 (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
3344 (goto-char start-pt)
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
3345 (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
3346 ;; 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
3347 ;; unless strict was set.
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
3348 (outline-flag-region (point) (outline-snug-back) ?\n))
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
3349 (while to-reveal
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
3350 (goto-char (car to-reveal))
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
3351 (outline-flag-region (point) (outline-snug-back) ?\n)
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
3352 (setq to-reveal (cdr to-reveal)))))))))
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3353 ;;;_ x outline-show-current-children (&optional level strict)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3354 (defun outline-show-current-children (&optional level strict)
7416
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
3355 "This command was misnamed, use `outline-show-children' instead.
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3356
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3357 \(The \"current\" in the name is supposed to imply that it works on
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3358 the visible topic containing point, while it really works with respect
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3359 to the most immediate topic, concealed or not. I'll leave this old
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3360 name around for a bit, but i'll soon activate an annoying message to
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3361 warn people about the change, and then deprecate this alias."
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3362
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3363 (interactive "p")
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3364 ;;(beep)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3365 ;;(message (format "Use '%s' instead of '%s' (%s)."
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3366 ;; "outline-show-children"
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3367 ;; "outline-show-current-children"
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3368 ;; (buffer-name (current-buffer))))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3369 (outline-show-children level strict))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3370 ;;;_ > outline-hide-point-reconcile ()
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3371 (defun outline-hide-reconcile ()
7416
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
3372 "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
3373
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3374 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
3375 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
3376 (interactive)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3377 (save-excursion
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3378 (outline-goto-prefix)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3379 (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
3380 (progn (outline-pre-next-preface)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3381 (if (= ?\r (following-char))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3382 (point)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3383 (1- (point))))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3384 ?\r)))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3385 ;;;_ > outline-show-to-offshoot ()
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3386 (defun outline-show-to-offshoot ()
7416
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
3387 "Like outline-show-entry, but reveals opens all concealed ancestors, as well.
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
3388
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
3389 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
3390 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
3391
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3392 (interactive)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3393 (save-excursion
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3394 (let ((orig-pt (point))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3395 (orig-pref (outline-goto-prefix))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3396 (last-at (point))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3397 bag-it)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3398 (while (or bag-it (= (preceding-char) ?\r))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3399 (beginning-of-line)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3400 (if (= last-at (setq last-at (point)))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3401 ;; 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
3402 ;; topic completely, and bag this try.
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3403 (progn (beginning-of-line)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3404 (outline-show-current-subtree)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3405 (goto-char orig-pt)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3406 (setq bag-it t)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3407 (beep)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3408 (message "%s: %s"
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3409 "outline-show-to-offshoot: "
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3410 "Aberrant nesting encountered.")))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3411 (outline-show-children)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3412 (goto-char orig-pref))
7416
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
3413 (goto-char orig-pt)))
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
3414 (if (outline-hidden-p)
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
3415 (outline-show-entry)))
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3416 ;;;_ > outline-hide-current-entry ()
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3417 (defun outline-hide-current-entry ()
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3418 "Hide the body directly following this heading."
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3419 (interactive)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3420 (outline-back-to-current-heading)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3421 (save-excursion
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3422 (outline-flag-region (point)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3423 (progn (outline-end-of-current-entry) (point))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3424 ?\^M)))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3425 ;;;_ > outline-show-current-entry (&optional arg)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3426 (defun outline-show-current-entry (&optional arg)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3427
7416
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
3428 "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
3429
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3430 (interactive "P")
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3431 (if arg
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3432 (outline-hide-current-entry)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3433 (save-excursion
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3434 (outline-flag-region (point)
7416
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
3435 (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
3436 ?\n))))
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3437 ;;;_ > outline-hide-current-entry-completely ()
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3438 ; ... 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
3439 (defun outline-hide-current-entry-completely ()
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3440 "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
3441
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3442 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
3443 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
3444 (interactive)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3445 (save-excursion
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3446 (outline-goto-prefix)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3447 (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
3448 (progn (outline-pre-next-preface)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3449 (if (= ?\r (following-char))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3450 (point)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3451 (1- (point))))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3452 ?\r)))
7416
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
3453 ;;;_ > 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
3454 (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
3455 "Show everything within the current topic. With a repeat-count,
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
3456 expose this topic and its' siblings."
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
3457 (interactive "P")
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
3458 (save-excursion
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
3459 (if (<= (outline-current-depth) 0)
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
3460 ;; 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
3461 (if (not (outline-next-heading))
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
3462 (error "No topics.")
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
3463 ;; 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
3464 (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
3465 (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
3466 (if (not arg)
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
3467 (outline-flag-current-subtree ?\n)
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
3468 (outline-beginning-of-level)
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
3469 (outline-expose-topic '(* :))))))
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3470 ;;;_ > outline-hide-current-subtree (&optional just-close)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3471 (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
3472 "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
3473
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
3474 If this topic is closed and it's a top level topic, close this topic
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
3475 and its' siblings.
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
3476
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
3477 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
3478 siblings, even if the target topic is already closed."
3430
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3479
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3480 (interactive)
7416
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
3481 (let ((from (point))
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
3482 (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
3483 (if (not (outline-goto-prefix))
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
3484 (error "No topics found.")
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
3485 (end-of-line)(point)))))
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3486 (outline-flag-current-subtree ?\^M)
7416
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
3487 (goto-char from)
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
3488 (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
3489 (end-of-line)
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
3490 (point)))
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
3491 (not just-close)
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3492 ;; 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
3493 (goto-char from)
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
3494 (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
3495 t
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
3496 (goto-char 0)
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
3497 (let ((msg
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
3498 "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
3499 (message msg)
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
3500 (outline-expose-topic '(0 :))
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
3501 (message (concat msg " Done.")))
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
3502 nil)
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
3503 (/= (outline-recent-depth) 0))
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
3504 (outline-hide-current-subtree))
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
3505 (goto-char from)))
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3506 ;;;_ > outline-show-current-branches ()
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3507 (defun outline-show-current-branches ()
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3508 "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
3509 (interactive)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3510 (beginning-of-line)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3511 (outline-show-children t))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3512 ;;;_ > outline-hide-current-leaves ()
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3513 (defun outline-hide-current-leaves ()
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3514 "Hide the bodies of the current topic and all its' offspring."
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3515 (interactive)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3516 (outline-back-to-current-heading)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3517 (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
3518 (point))))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3519
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3520 ;;;_ - Region and beyond
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3521 ;;;_ > outline-show-all ()
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3522 (defun outline-show-all ()
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3523 "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
3524 (interactive)
7416
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
3525 (message "Exposing entire buffer...")
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
3526 (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
3527 (message "Exposing entire buffer... Done."))
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3528 ;;;_ > outline-hide-bodies ()
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3529 (defun outline-hide-bodies ()
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3530 "Hide all of buffer except headings."
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3531 (interactive)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3532 (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
3533 ;;;_ > outline-hide-region-body (start end)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3534 (defun outline-hide-region-body (start end)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3535 "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
3536 (save-excursion
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3537 (save-restriction
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3538 (narrow-to-region start end)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3539 (goto-char (point-min))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3540 (while (not (eobp))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3541 (outline-flag-region (point)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3542 (progn (outline-pre-next-preface) (point)) ?\^M)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3543 (if (not (eobp))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3544 (forward-char
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3545 (if (looking-at "[\n\r][\n\r]")
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3546 2 1)))))))
7416
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
3547
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
3548 ;;;_ > outline-expose-topic (spec)
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
3549 (defun outline-expose-topic (spec)
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
3550 "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
3551
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
3552 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
3553 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
3554 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
3555 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
3556
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3557 Cursor is left at start position.
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3558
7416
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
3559 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
3560
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
3561 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
3562
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3563 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
3564 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
3565
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
3566 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
3567 subtopics of the current topic.
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
3568
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
3569 The ':' repeat spec is used to specify exposure for any number of
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
3570 successive siblings, up to the trailing ones for which there are
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
3571 explicit specs following the ':'.
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3572
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3573 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
3574
7416
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
3575 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
3576 - 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
3577 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
3578 that level.
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
3579 - 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
3580 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
3581 - 0 means to close topic - hide all offspring.
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
3582 : - 'repeat'
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3583 apply prior element to all siblings at current level, *up to*
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3584 those siblings that would be covered by specs following the ':'
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3585 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
3586 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
3587 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
3588 * - 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
3589 + - 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
3590 - - 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
3591
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3592 Examples:
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3593 \(outline-expose-topic '(-1 : 0))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3594 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
3595 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
3596 at this current level completely.
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3597 \(outline-expose-topic '(-1 () : 1 0))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3598 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
3599 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
3600 close the last one.
7416
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
3601 \(outline-expose-topic '(-2 : -1 *))
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3602 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
3603 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
3604 last and completely open the last one."
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3605
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3606 (interactive "xExposure spec: ")
7416
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
3607 (if (not (listp spec))
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
3608 nil
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
3609 (let ((depth (outline-depth))
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
3610 (max-pos 0)
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
3611 prev-elem curr-elem
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
3612 stay done
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
3613 snug-back
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
3614 )
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
3615 (while spec
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
3616 (setq prev-elem curr-elem
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
3617 curr-elem (car spec)
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
3618 spec (cdr spec))
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
3619 (cond ; Do current element:
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
3620 ((null curr-elem) nil)
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
3621 ((symbolp curr-elem)
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
3622 (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
3623 (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
3624 (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
3625 ((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
3626 (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
3627 (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
3628 ((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
3629 ((eq curr-elem ':)
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
3630 (setq stay t)
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
3631 ;; Expand the 'repeat' spec to an explicit version,
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
3632 ;; w.r.t. remaining siblings:
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
3633 (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
3634 ;; 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
3635 (- (length (outline-chart-siblings))
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
3636 (length spec))))
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
3637 (if (< 0 residue)
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
3638 ;; 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
3639 (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
3640 spec)))))))
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
3641 ((numberp curr-elem)
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
3642 (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
3643 (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
3644 (if (> 0 curr-elem)
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
3645 nil
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
3646 (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
3647 (setq max-pos
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
3648 outline-recent-end-of-subtree)))))
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
3649 (if (> (abs curr-elem) 0)
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
3650 (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
3651 (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
3652 (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
3653 ((listp curr-elem)
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
3654 (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
3655 (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
3656 (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
3657 (cond (stay (setq stay nil))
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
3658 ((listp (car spec)) nil)
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
3659 ((> max-pos (point))
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
3660 ;; 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
3661 (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
3662 (outline-next-heading)))
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
3663 ((outline-next-sibling depth))))
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
3664 max-pos)))
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3665 ;;;_ > outline-old-expose-topic (spec &rest followers)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3666 (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
3667
7416
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
3668 "Deprecated. Use outline-expose-topic \(with different schema
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
3669 format\) instead.
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
3670
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
3671 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
3672
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3673 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
3674 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
3675
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3676 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
3677 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
3678 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
3679 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
3680 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
3681
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3682 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
3683
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3684 - 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
3685 - 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
3686 absolute value of the number.
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3687 - 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
3688 - 0 just closes
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3689 - '*' completely opens the topic, including bodies.
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3690 - '+' shows all the sub headers, but not the bodies
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3691 - '-' exposes the body and immediate offspring of the corresponding topic.
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3692
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3693 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
3694 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
3695 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
3696 for the corresponding offspring of the topic.
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3697
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3698 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
3699
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3700 (interactive "xExposure spec: ")
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3701 (let ((depth (outline-current-depth))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3702 done
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3703 max-pos)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3704 (cond ((null spec) nil)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3705 ((symbolp spec)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3706 (if (eq spec '*) (outline-show-current-subtree))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3707 (if (eq spec '+) (outline-show-current-branches))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3708 (if (eq spec '-) (outline-show-current-entry)))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3709 ((numberp spec)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3710 (if (>= 0 spec)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3711 (save-excursion (outline-hide-current-subtree t)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3712 (end-of-line)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3713 (if (or (not max-pos)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3714 (> (point) max-pos))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3715 (setq max-pos (point)))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3716 (if (> 0 spec)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3717 (setq spec (* -1 spec)))))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3718 (if (> spec 0)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3719 (outline-show-children spec)))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3720 ((listp spec)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3721 ;(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
3722 ; (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
3723 ; (setq max-pos got)))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3724 (let ((new-depth (+ (outline-current-depth) 1))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3725 got)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3726 (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
3727 (setq spec (cdr spec))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3728 (if (and spec
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3729 (outline-descend-to-depth new-depth)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3730 (not (outline-hidden-p)))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3731 (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
3732 (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
3733 (setq max-pos got)))))))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3734 (while (and followers
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3735 (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
3736 (progn (goto-char max-pos)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3737 (setq max-pos nil)))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3738 (end-of-line)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3739 (outline-next-sibling depth)))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3740 (outline-old-expose-topic (car followers))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3741 (setq followers (cdr followers)))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3742 max-pos))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3743 ;;;_ > outline-new-exposure '()
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3744 (defmacro outline-new-exposure (&rest spec)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3745 "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
3746 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
3747 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
3748
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3749 Cursor is left at start position.
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3750
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3751 Use this instead of obsolete 'outline-exposure'.
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3752
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3753 Examples:
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3754 \(outline-exposure (-1 () () () 1) 0)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3755 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
3756 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
3757 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
3758 \(outline-exposure : -1 0)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3759 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
3760 immediate children, except for the last topic at the current
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3761 level, in which even its' immediate children are hidden.
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3762 \(outline-exposure -2 : -1 *)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3763 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
3764 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
3765 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
3766 (list 'save-excursion
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3767 '(if (not (or (outline-goto-prefix)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3768 (outline-next-heading)))
7416
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
3769 (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
3770 (list 'outline-expose-topic (list 'quote spec))))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3771 ;;;_ > outline-exposure '()
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3772 (defmacro outline-exposure (&rest spec)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3773 "Being deprecated - use more recent 'outline-new-exposure' instead.
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3774
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3775 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
3776 and retains start position."
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3777 (list 'save-excursion
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3778 '(if (not (or (outline-goto-prefix)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3779 (outline-next-heading)))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3780 (error "Can't find any outline topics."))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3781 (cons 'outline-old-expose-topic
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3782 (mapcar '(lambda (x) (list 'quote x)) spec))))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3783
7416
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
3784 ;;;_ #7 ISearch with Dynamic Exposure
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3785 ;;;_ = outline-search-reconceal
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3786 (defvar outline-search-reconceal nil
7416
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
3787 "Track whether current search match was concealed outside of search.
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
3788
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
3789 The value is the location of the match, if it was concealed, regular
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
3790 if the entire topic was concealed, in a list if the entry was concealed.")
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3791 ;;;_ = outline-search-quitting
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3792 (defconst outline-search-quitting nil
7416
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
3793 "Distinguishes isearch conclusion and cancellation.
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
3794
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
3795 Used by isearch-terminate/outline-provisions and
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
3796 isearch-done/outline-provisions")
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3797
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3798
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3799 ;;;_ > outline-enwrap-isearch ()
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3800 (defun outline-enwrap-isearch ()
7416
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
3801 "Impose outline-mode isearch-mode wrappers for dynamic exposure in isearch.
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
3802
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
3803 Isearch progressively exposes and reconceals hidden topics when
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
3804 working in outline mode, but works normally elsewhere.
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3805
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3806 The function checks to ensure that the rebindings are done only once."
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3807
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3808 ; Should isearch-mode be employed,
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3809 (if (or (not outline-enwrap-isearch-mode)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3810 ; or are preparations already done?
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3811 (fboundp 'real-isearch-terminate))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3812
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3813 ;; ... no - skip this all:
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3814 nil
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3815
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3816 ;; ... yes:
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 ; Ensure load of isearch-mode:
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3819 (if (or (and (fboundp 'isearch-mode)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3820 (fboundp 'isearch-quote-char))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3821 (condition-case error
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3822 (load-library outline-enwrap-isearch-mode)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3823 (file-error (message "Skipping isearch-mode provisions - %s '%s'"
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3824 (car (cdr error))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3825 (car (cdr (cdr error))))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3826 (sit-for 1)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3827 ;; Inhibit subsequent tries and return nil:
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3828 (setq outline-enwrap-isearch-mode nil))))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3829 ;; Isearch-mode loaded, encapsulate specific entry points for
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3830 ;; outline dynamic-exposure business:
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3831 (progn
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3832
7416
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
3833 ;; stash crucial isearch-mode funcs under known, private
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
3834 ;; names, then register wrapper functions under the old
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
3835 ;; names, in their stead: 'isearch-quit' is pre isearch v 1.2.
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3836 (fset 'real-isearch-terminate
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3837 ; 'isearch-quit is pre v 1.2:
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3838 (or (if (fboundp 'isearch-quit)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3839 (symbol-function 'isearch-quit))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3840 (if (fboundp 'isearch-abort)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3841 ; 'isearch-abort' is v 1.2 and on:
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3842 (symbol-function 'isearch-abort))))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3843 (fset 'isearch-quit 'isearch-terminate/outline-provisions)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3844 (fset 'isearch-abort 'isearch-terminate/outline-provisions)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3845 (fset 'real-isearch-done (symbol-function 'isearch-done))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3846 (fset 'isearch-done 'isearch-done/outline-provisions)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3847 (fset 'real-isearch-update (symbol-function 'isearch-update))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3848 (fset 'isearch-update 'isearch-update/outline-provisions)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3849 (make-variable-buffer-local 'outline-search-reconceal)))))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3850 ;;;_ > outline-isearch-arrival-business ()
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3851 (defun outline-isearch-arrival-business ()
7416
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
3852 "Do outline business like exposing current point, if necessary.
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
3853
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
3854 Registers reconcealment requirements in outline-search-reconceal
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3855 accordingly.
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3856
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3857 Set outline-search-reconceal to nil if current point is not
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3858 concealed, to value of point if entire topic is concealed, and a
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3859 list containing point if only the topic body is concealed.
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3860
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3861 This will be used to determine whether outline-hide-current-entry
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3862 or outline-hide-current-entry-completely will be necessary to
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3863 restore the prior concealment state."
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3864
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3865 (if (outline-mode-p)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3866 (setq outline-search-reconceal
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3867 (if (outline-hidden-p)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3868 (save-excursion
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3869 (if (re-search-backward outline-line-boundary-regexp nil 1)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3870 ;; Nil value means we got to b-o-b - wouldn't need
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3871 ;; to advance.
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3872 (forward-char 1))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3873 ; We'll return point or list
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3874 ; containing point, depending
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3875 ; on concealment state of
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3876 ; topic prefix.
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3877 (prog1 (if (outline-hidden-p) (point) (list (point)))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3878 ; And reveal the current
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3879 ; search target:
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3880 (outline-show-entry)))))))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3881 ;;;_ > outline-isearch-advancing-business ()
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3882 (defun outline-isearch-advancing-business ()
7416
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
3883 "Do outline business like deexposing current point, if necessary.
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
3884
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
3885 Works according to reconceal state registration."
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3886 (if (and (outline-mode-p) outline-search-reconceal)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3887 (save-excursion
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3888 (if (listp outline-search-reconceal)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3889 ;; Leave the topic visible:
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3890 (progn (goto-char (car outline-search-reconceal))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3891 (outline-hide-current-entry))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3892 ;; Rehide the entire topic:
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3893 (goto-char outline-search-reconceal)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3894 (outline-hide-current-entry-completely)))))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3895 ;;;_ > isearch-terminate/outline-provisions ()
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3896 (defun isearch-terminate/outline-provisions ()
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3897 (interactive)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3898 (if (and (outline-mode-p) outline-enwrap-isearch-mode)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3899 (outline-isearch-advancing-business))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3900 (let ((outline-search-quitting t)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3901 (outline-search-reconceal nil))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3902 (real-isearch-terminate)))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3903 ;;;_ > isearch-done/outline-provisions ()
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3904 (defun isearch-done/outline-provisions (&optional nopush)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3905 (interactive)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3906 (if (and (outline-mode-p) outline-enwrap-isearch-mode)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3907 (progn (if (and outline-search-reconceal
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3908 (not (listp outline-search-reconceal)))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3909 ;; The topic was concealed - reveal it, its siblings,
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3910 ;; and any ancestors that are still concealed:
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3911 (save-excursion
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3912 (message "(exposing destination)")(sit-for 0)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3913 (outline-goto-prefix)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3914 ; There may be a closed blank
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3915 ; line between prior and
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3916 ; current topic that would be
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3917 ; missed - provide for it:
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3918 (if (not (bobp))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3919 (progn (forward-char -1) ; newline
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3920 (if (eq ?\r (preceding-char))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3921 (outline-flag-region (1- (point))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3922 (point)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3923 ?\n))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3924 (forward-char 1)))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3925 ; Goto parent
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3926 (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
3927 (outline-show-children)))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3928 (if (and (boundp 'outline-search-quitting)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3929 outline-search-quitting)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3930 nil
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3931 ; We're concluding abort:
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3932 (outline-isearch-arrival-business)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3933 (outline-show-children))))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3934 (if nopush
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3935 ;; isearch-done in newer version of isearch mode takes arg:
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3936 (real-isearch-done nopush)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3937 (real-isearch-done)))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3938 ;;;_ > isearch-update/outline-provisions ()
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3939 (defun isearch-update/outline-provisions ()
7416
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
3940 "Wrapper dynamically adjusts isearch target exposure.
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
3941
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
3942 Appropriately exposes and reconceals hidden outline portions, as
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
3943 necessary, in the course of searching."
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3944 (if (not (and (outline-mode-p) outline-enwrap-isearch-mode))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3945 ;; Just do the plain business:
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3946 (real-isearch-update)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3947
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3948 ;; Ah - provide for outline conditions:
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3949 (outline-isearch-advancing-business)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3950 (real-isearch-update)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3951 (cond (isearch-success (outline-isearch-arrival-business))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3952 ((not isearch-success) (outline-isearch-advancing-business)))))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3953
7416
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
3954 ;;;_ #8 Copying and printing
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3955
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3956 ;;;_ - Copy exposed
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3957 ;;;_ > outline-insert-listified (depth prefix bullet text)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3958 (defun outline-insert-listified (depth prefix bullet text)
7416
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
3959 "Insert contents of listified outline portion in current buffer."
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3960 (insert-string (concat (if (> depth 1) prefix "")
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3961 (make-string (1- depth) ?\ )
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3962 bullet))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3963 (while text
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3964 (insert-string (car text))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3965 (if (setq text (cdr text))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3966 (insert-string "\n")))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3967 (insert-string "\n"))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3968 ;;;_ > outline-copy-exposed (arg &optional tobuf)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3969 (defun outline-copy-exposed (arg &optional tobuf)
7416
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
3970 "Duplicate exposed portions of current topic to another buffer.
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
3971
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
3972 Other buffer has current buffers' name with \" exposed\" appended to it.
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3973
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3974 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
3975
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3976 (interactive "P")
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3977 (if (not tobuf)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3978 (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
3979 (let* ((start-pt (point))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3980 (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
3981 (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
3982 (buf (current-buffer)))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3983 (save-excursion (set-buffer tobuf)(erase-buffer))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3984 (outline-process-exposed 'outline-insert-listified
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3985 beg
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3986 end
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3987 (current-buffer)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3988 tobuf)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3989 (goto-char (point-min))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3990 (pop-to-buffer buf)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3991 (goto-char start-pt)))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3992
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3993 ;;;_ - LaTeX formatting
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3994 ;;;_ > outline-latex-verb-quote (str &optional flow)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3995 (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
3996 "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
3997 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
3998 string across latex processing."
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
3999 (mapconcat '(lambda (char)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4000 ;;;mess: (cond ((memq char '(?"" ?$ ?% ?# ?& ?- ?" ?` ?^ ?- ?*));;;"))))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4001 (cond ((memq char '(?\\ ?$ ?% ?# ?& ?{ ?} ?_ ?^ ?- ?*))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4002 (concat "\\char" (number-to-string char) "{}"))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4003 ((= char ?\n) "\\\\")
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4004 (t (char-to-string char))))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4005 str
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4006 ""))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4007 ;;;_ > outline-latex-verbatim-quote-curr-line ()
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4008 (defun outline-latex-verbatim-quote-curr-line ()
7416
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
4009 "Express line for exact \(literal\) representation across latex processing.
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
4010
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
4011 Adjust line contents so it is unaltered \(from the original line)
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4012 across latex processing, within the context of a 'verbatim'
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4013 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
4014 (beginning-of-line)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4015 (let ((beg (point))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4016 (end (progn (end-of-line)(point))))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4017 (goto-char beg)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4018 (while (re-search-forward "\\\\"
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4019 ;;"\\\\\\|\\{\\|\\}\\|\\_\\|\\$\\|\\\"\\|\\&\\|\\^\\|\\-\\|\\*\\|#"
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4020 end ; bounded by end-of-line
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4021 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
4022 (goto-char (match-beginning 0))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4023 (insert-string "\\")
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4024 (setq end (1+ end))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4025 (goto-char (1+ (match-end 0))))))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4026 ;;;_ > outline-insert-latex-header (buf)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4027 (defun outline-insert-latex-header (buf)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4028 "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
4029 ;; 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
4030 ;; the TeXBook, pg 421.
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4031 (set-buffer buf)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4032 (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
4033 "report"))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4034 (page-numbering (if outline-number-pages
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4035 "\\pagestyle{empty}\n"
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4036 ""))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4037 (linesdef (concat "\\def\\beginlines{"
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4038 "\\par\\begingroup\\nobreak\\medskip"
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4039 "\\parindent=0pt\n"
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4040 " \\kern1pt\\nobreak \\obeylines \\obeyspaces "
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4041 "\\everypar{\\strut}}\n"
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4042 "\\def\\endlines{"
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4043 "\\kern1pt\\endgroup\\medbreak\\noindent}\n"))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4044 (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
4045 outline-title-style))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4046 (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
4047 outline-label-style))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4048 (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
4049 outline-head-line-style))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4050 (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
4051 outline-body-line-style))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4052 (setlength (format "%s%s%s%s"
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4053 "\\newlength{\\stepsize}\n"
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4054 "\\setlength{\\stepsize}{"
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4055 outline-indent
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4056 "}\n"))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4057 (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
4058 "\\newcommand{\\OneHeadLine}[3]{%\n"
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4059 "\\noindent%\n"
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4060 "\\hspace*{#2\\stepsize}%\n"
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4061 "\\labelcmd{#1}\\hspace*{.2cm}"
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4062 "\\headlinecmd{#3}\\\\["
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4063 outline-line-skip
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4064 "]\n}\n"))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4065 (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
4066 "\\newcommand{\\OneBodyLine}[2]{%\n"
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4067 "\\noindent%\n"
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4068 "\\hspace*{#1\\stepsize}%\n"
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4069 "\\bodylinecmd{#2}\\\\["
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4070 outline-line-skip
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4071 "]\n}\n"))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4072 (begindoc "\\begin{document}\n\\begin{center}\n")
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4073 (title (format "%s%s%s%s"
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4074 "\\titlecmd{"
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4075 (outline-latex-verb-quote (if outline-title
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4076 (condition-case err
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4077 (eval outline-title)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4078 (error "<unnamed buffer>"))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4079 "Unnamed Outline"))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4080 "}\n"
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4081 "\\end{center}\n\n"))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4082 (hsize "\\hsize = 7.5 true in\n")
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4083 (hoffset "\\hoffset = -1.5 true in\n")
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4084 (vspace "\\vspace{.1cm}\n\n"))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4085 (insert (concat doc-style
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4086 page-numbering
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4087 titlecmd
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4088 labelcmd
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4089 headlinecmd
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4090 bodylinecmd
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4091 setlength
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4092 oneheadline
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4093 onebodyline
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4094 begindoc
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4095 title
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4096 hsize
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4097 hoffset
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4098 vspace)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4099 )))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4100 ;;;_ > outline-insert-latex-trailer (buf)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4101 (defun outline-insert-latex-trailer (buf)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4102 "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
4103 (set-buffer buf)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4104 (insert "\n\\end{document}\n"))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4105 ;;;_ > 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
4106 (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
4107 "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
4108
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
4109 Args are the topics' numeric DEPTH, the header PREFIX lead string, the
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
4110 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
4111 (let* ((head-line (if text (car text)))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4112 (body-lines (cdr text))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4113 (curr-line)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4114 body-content bop)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4115 ; Do the head line:
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4116 (insert-string (concat "\\OneHeadLine{\\verb\1 "
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4117 (outline-latex-verb-quote bullet)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4118 "\1}{"
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4119 depth
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4120 "}{\\verb\1 "
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4121 (if head-line
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4122 (outline-latex-verb-quote head-line)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4123 "")
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4124 "\1}\n"))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4125 (if (not body-lines)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4126 nil
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4127 ;;(insert-string "\\beginlines\n")
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4128 (insert-string "\\begin{verbatim}\n")
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4129 (while body-lines
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4130 (setq curr-line (car body-lines))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4131 (if (and (not body-content)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4132 (not (string-match "^\\s-*$" curr-line)))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4133 (setq body-content t))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4134 ; Mangle any occurrences of
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4135 ; "\end{verbatim}" in text,
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4136 ; it's special:
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4137 (if (and body-content
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4138 (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
4139 (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
4140 ">"
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4141 (substring curr-line bop))))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4142 ;;(insert-string "|" (car body-lines) "|")
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4143 (insert-string curr-line)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4144 (outline-latex-verbatim-quote-curr-line)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4145 (insert-string "\n")
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4146 (setq body-lines (cdr body-lines)))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4147 (if body-content
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4148 (setq body-content nil)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4149 (forward-char -1)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4150 (insert-string "\\ ")
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4151 (forward-char 1))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4152 ;;(insert-string "\\endlines\n")
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4153 (insert-string "\\end{verbatim}\n")
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4154 )))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4155 ;;;_ > outline-latexify-exposed (arg &optional tobuf)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4156 (defun outline-latexify-exposed (arg &optional tobuf)
7416
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
4157 "Format current topic's exposed portions to TOBUF for latex processing.
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
4158 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
4159 with \"*\" prepended and \" latex-formed*\" appended.
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4160
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4161 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
4162
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4163 (interactive "P")
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4164 (if (not tobuf)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4165 (setq tobuf
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4166 (get-buffer-create (concat "*" (buffer-name) " latexified*"))))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4167 (let* ((start-pt (point))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4168 (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
4169 (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
4170 (buf (current-buffer)))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4171 (set-buffer tobuf)
3430
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4172 (erase-buffer)
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4173 (outline-insert-latex-header tobuf)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4174 (goto-char (point-max))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4175 (outline-process-exposed 'outline-latexify-one-item
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4176 beg
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4177 end
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4178 buf
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4179 tobuf)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4180 (goto-char (point-max))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4181 (outline-insert-latex-trailer tobuf)
3430
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4182 (goto-char (point-min))
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4183 (pop-to-buffer buf)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4184 (goto-char start-pt)))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4185
7416
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
4186 ;;;_ #9 miscellaneous
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4187 ;;;_ > outline-mark-topic ()
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4188 (defun outline-mark-topic ()
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4189 "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
4190 (interactive)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4191 (beginning-of-line)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4192 (outline-goto-prefix)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4193 (push-mark (point))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4194 (outline-end-of-current-subtree)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4195 (exchange-point-and-mark))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4196 ;;;_ > outlineify-sticky ()
7416
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
4197 ;; 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
4198 (defalias 'outlinify-sticky 'outlineify-sticky)
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4199 (defun outlineify-sticky (&optional arg)
13964
4de229297f1f (outline-primary-bullet, outline-numbered-bullet,
Karl Heuer <kwzh@gnu.org>
parents: 13337
diff changeset
4200 "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
4201
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
4202 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
4203 setup for auto-startup."
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
4204
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
4205 (interactive "P")
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
4206
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
4207 (outline-mode t)
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
4208
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
4209 (save-excursion
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
4210 (goto-char (point-min))
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
4211 (if (looking-at outline-regexp)
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
4212 t
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
4213 (outline-open-topic 2)
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
4214 (insert-string (concat "Dummy outline topic header - see"
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
4215 "`outline-mode' docstring for info."))
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
4216 (next-line 1)
3430
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4217 (goto-char (point-max))
7416
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
4218 (next-line 1)
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
4219 (outline-open-topic 0)
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
4220 (insert-string "Local emacs vars.\n")
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
4221 (outline-open-topic 1)
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
4222 (insert-string "(`outline-layout' is for allout.el outline-mode)\n")
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
4223 (outline-open-topic 0)
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
4224 (insert-string "Local variables:\n")
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
4225 (outline-open-topic 0)
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
4226 (insert-string (format "outline-layout: %s\n"
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
4227 (or outline-layout
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
4228 '(1 : 0))))
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
4229 (outline-open-topic 0)
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
4230 (insert-string "End:\n"))))
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4231 ;;;_ > solicit-char-in-string (prompt string &optional do-defaulting)
3430
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4232 (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
4233 "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
4234
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4235 Optional arg DO-DEFAULTING indicates to accept empty input (CR)."
3430
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4236
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4237 (let ((new-prompt prompt)
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4238 got)
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4239
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4240 (while (not got)
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4241 (message "%s" new-prompt)
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4242
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4243 ;; We do our own reading here, so we can circumvent, eg, special
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4244 ;; treatment for '?' character. (Might oughta change minibuffer
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4245 ;; keymap instead, oh well.)
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4246 (setq got
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4247 (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
4248
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4249 (if (null (string-match (regexp-quote got) string))
3430
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4250 (if (and do-defaulting (string= got "\^M"))
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4251 ;; We're defaulting, return null string to indicate that:
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4252 (setq got "")
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4253 ;; Failed match and not defaulting,
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4254 ;; set the prompt to give feedback,
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4255 (setq new-prompt (concat prompt
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4256 got
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4257 " ...pick from: "
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4258 string
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4259 ""))
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4260 ;; and set loop to try again:
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4261 (setq got nil))
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4262 ;; Got a match - give feedback:
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4263 (message "")))
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4264 ;; got something out of loop - return it:
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4265 got)
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4266 )
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4267 ;;;_ > regexp-sans-escapes (string)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4268 (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
4269 "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
4270
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4271 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
4272 single backslash.
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4273
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4274 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
4275
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4276 (if (string= regexp "")
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4277 ""
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4278 ;; 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
4279 ;; backslash, or else to nil:
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4280 (setq successive-backslashes
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4281 (if (= (aref regexp 0) ?\\)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4282 (if successive-backslashes (1+ successive-backslashes) 1)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4283 nil))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4284 (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
4285 ;; Include first char:
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4286 (concat (substring regexp 0 1)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4287 (regexp-sans-escapes (substring regexp 1)))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4288 ;; Exclude first char, but maintain count:
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4289 (regexp-sans-escapes (substring regexp 1) successive-backslashes))))
7416
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
4290 ;;;_ - add-hook definition for divergent emacsen
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4291 ;;;_ > add-hook (hook function &optional append)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4292 (if (not (fboundp 'add-hook))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4293 (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
4294 "Add to the value of HOOK the function FUNCTION unless already present.
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
4295 \(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
4296 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
4297 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
4298 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
4299 (or (boundp hook) (set hook nil))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4300 (or (if (consp function)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4301 ;; 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
4302 ;; is equal to anything in the hook.
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4303 (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
4304 (equal function tail))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4305 (memq function (symbol-value hook)))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4306 (set hook
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4307 (if append
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4308 (nconc (symbol-value hook) (list function))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4309 (cons function (symbol-value hook)))))))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4310
7416
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
4311 ;;;_ #10 Under development
7218
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4312 ;;;_ > outline-bullet-isearch (&optional bullet)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4313 (defun outline-bullet-isearch (&optional bullet)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4314 "Isearch \(regexp\) for topic with bullet BULLET."
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4315 (interactive)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4316 (if (not bullet)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4317 (setq bullet (solicit-char-in-string
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4318 "ISearch for topic with bullet: "
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4319 (regexp-sans-escapes outline-bullets-string))))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4320
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4321 (let ((isearch-regexp t)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4322 (isearch-string (concat "^"
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4323 outline-header-prefix
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4324 "[ \t]*"
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4325 bullet)))
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4326 (isearch-repeat 'forward)
49f9f9a08b4c major code speedups, bug fixes, behavior
Richard M. Stallman <rms@gnu.org>
parents: 6736
diff changeset
4327 (isearch-mode t)))
7416
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
4328 ;;;_ ? Re hooking up with isearch - use isearch-op-fun rather than
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
4329 ;;; wrapping the isearch functions.
3430
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4330
400db0ca934f entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4331 ;;;_* Local emacs vars.
7416
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
4332 ;;; 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
4333 ;;; - 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
4334 ;;; - 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
4335 ;;; - 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
4336 ;;; - 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
4337 ;;;Local variables:
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
4338 ;;;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
4339 ;;;End:
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
4340
4996c50431de (outline-init) New user interface for control of
Richard M. Stallman <rms@gnu.org>
parents: 7218
diff changeset
4341 ;; allout.el ends here