allout.el 282 KB
Newer Older
1
;;; allout.el --- extensive outline mode for use alone and with other modes
2

3
;; Copyright (C) 1992-1994, 2001-2013 Free Software Foundation, Inc.
Richard M. Stallman's avatar
Richard M. Stallman committed
4

5 6
;; Author: Ken Manheimer <ken dot manheimer at gmail...>
;; Maintainer: Ken Manheimer <ken dot manheimer at gmail...>
Richard M. Stallman's avatar
Richard M. Stallman committed
7
;; Created: Dec 1991 -- first release to usenet
8
;; Version: 2.3
9
;; Keywords: outlines, wp, languages, PGP, GnuPG
10
;; Website: http://myriadicity.net/software-and-systems/craft/emacs-allout
Richard M. Stallman's avatar
Richard M. Stallman committed
11 12 13

;; This file is part of GNU Emacs.

14
;; GNU Emacs is free software: you can redistribute it and/or modify
15
;; it under the terms of the GNU General Public License as published by
16 17
;; the Free Software Foundation, either version 3 of the License, or
;; (at your option) any later version.
18

Richard M. Stallman's avatar
Richard M. Stallman committed
19
;; GNU Emacs is distributed in the hope that it will be useful,
20 21 22 23 24
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
;; GNU General Public License for more details.

;; You should have received a copy of the GNU General Public License
25
;; along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.
Richard M. Stallman's avatar
Richard M. Stallman committed
26

27
;;; Commentary:
28

29 30
;; Allout outline minor mode provides extensive outline formatting and
;; and manipulation beyond standard emacs outline mode.  Some features:
31
;;
32 33 34 35
;;  - Classic outline-mode topic-oriented navigation and exposure adjustment
;;  - Topic-oriented editing including coherent topic and subtopic
;;    creation, promotion, demotion, cut/paste across depths, etc.
;;  - Incremental search with dynamic exposure and reconcealment of text
Richard M. Stallman's avatar
Richard M. Stallman committed
36
;;  - Customizable bullet format -- enables programming-language specific
37
;;    outlining, for code-folding editing.  (Allout code itself is to try it;
Richard M. Stallman's avatar
Richard M. Stallman committed
38
;;    formatted as an outline -- do ESC-x eval-buffer in allout.el; but
39
;;    emacs local file variables need to be enabled when the
Richard M. Stallman's avatar
Richard M. Stallman committed
40
;;    file was visited -- see `enable-local-variables'.)
41
;;  - Configurable per-file initial exposure settings
42 43 44
;;  - Symmetric-key and key-pair topic encryption.  Encryption is via the
;;    Emacs 'epg' library.  See allout-toggle-current-subtree-encryption
;;    docstring.
45 46
;;  - Automatic topic-number maintenance
;;  - "Hot-spot" operation, for single-keystroke maneuvering and
47
;;    exposure control (see the allout-mode docstring)
48
;;  - Easy rendering of exposed portions into numbered, latex, indented, etc
49
;;    outline styles
Richard M. Stallman's avatar
Richard M. Stallman committed
50
;;  - Careful attention to whitespace -- enabling blank lines between items
51 52 53
;;    and maintenance of hanging indentation (in paragraph auto-fill and
;;    across topic promotion and demotion) of topic bodies consistent with
;;    indentation of their topic header.
54
;;
55
;; and more.
56
;;
57
;; See the `allout-mode' function's docstring for an introduction to the
58 59
;; mode.
;;
60 61
;; Directions to the latest development version and helpful notes are
;; available at http://myriadicity.net/Sundry/EmacsAllout .
62
;;
63 64
;; The outline menubar additions provide quick reference to many of the
;; features.  See the docstring of the variables `allout-layout' and
65
;; `allout-auto-activation' for details on automatic activation of
66 67
;; `allout-mode' as a minor mode.  (`allout-init' is deprecated in favor of
;; a purely customization-based method.)
68
;;
Richard M. Stallman's avatar
Richard M. Stallman committed
69
;; Note -- the lines beginning with `;;;_' are outline topic headers.
70 71
;;        Customize `allout-auto-activation' to enable, then revisit this
;;        buffer to give it a whirl.
72

73
;; ken manheimer (ken dot manheimer at gmail dot com)
74

75 76
;;; Code:

77 78 79
(declare-function epa-passphrase-callback-function
		  "epa" (context key-id handback))

80
;;;_* Dependency loads
81
(require 'overlay)
82
(eval-when-compile
83 84 85 86 87
  ;; `cl' is required for `assert'.  `assert' is not covered by a standard
  ;; autoload, but it is a macro, so that eval-when-compile is sufficient
  ;; to byte-compile it in, or to do the require when the buffer evalled.
  (require 'cl)
  )
88

89
;;;_* USER CUSTOMIZATION VARIABLES:
90

91
;;;_ > defgroup allout, allout-keybindings
Stephen Eglen's avatar
Stephen Eglen committed
92
(defgroup allout nil
93 94 95
  "Extensive outline minor-mode, for use stand-alone and with other modes.

See Allout Auto Activation for automatic activation."
96
  :prefix "allout-"
97
  :group 'outlines)
98 99 100
(defgroup allout-keybindings nil
  "Allout outline mode keyboard bindings configuration."
  :group 'allout)
101 102 103

;;;_ + Layout, Mode, and Topic Header Configuration

104 105
(defvar allout-command-prefix)          ; defined below

106
;;;_  > allout-keybindings incidentals:
107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129
;;;_   : internal key binding stuff - in this section for load-order.
;;;_    = allout-mode-map
(defvar allout-mode-map 'allout-mode-map
  "Keybindings place-holder for (allout) outline minor mode.

Do NOT set the value of this variable.  Instead, customize
`allout-command-prefix', `allout-prefixed-keybindings', and
`allout-unprefixed-keybindings'.")
;;;_    = allout-mode-map-value
(defvar allout-mode-map-value nil
  "Keymap for allout outline minor mode.

Do NOT set the value of this variable.  Instead, customize
`allout-command-prefix', `allout-prefixed-keybindings', and
`allout-unprefixed-keybindings'.")
;;;_    = make allout-mode-map-value an alias for allout-mode-map:
;; this needs to be revised when the value is changed, sigh.
(defalias 'allout-mode-map allout-mode-map-value)
;;;_   > allout-compose-and-institute-keymap (&optional varname value)
(defun allout-compose-and-institute-keymap (&optional varname value)
  "Create the allout keymap according to the keybinding specs, and set it.

Useful standalone or to effect customizations of the
130 131 132 133 134
respective allout-mode keybinding variables, `allout-command-prefix',
`allout-prefixed-keybindings', and `allout-unprefixed-keybindings'"
  ;; Set the customization variable, if any:
  (when varname
    (set-default varname value))
135
  (let ((map (make-sparse-keymap)))
136
    (when (boundp 'allout-prefixed-keybindings)
137
      ;; tolerate first definitions of the variables:
138 139 140 141 142 143 144 145 146
      (dolist (entry allout-prefixed-keybindings)
        (define-key map
          ;; XXX vector vs non-vector key descriptions?
          (vconcat allout-command-prefix
                   (car (read-from-string (car entry))))
          (cadr entry))))
    (when (boundp 'allout-unprefixed-keybindings)
      (dolist (entry allout-unprefixed-keybindings)
        (define-key map (car (read-from-string (car entry))) (cadr entry))))
147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165
    (substitute-key-definition 'beginning-of-line 'allout-beginning-of-line
                               map global-map)
    (substitute-key-definition 'move-beginning-of-line 'allout-beginning-of-line
                               map global-map)
    (substitute-key-definition 'end-of-line 'allout-end-of-line
                               map global-map)
    (substitute-key-definition 'move-end-of-line 'allout-end-of-line
                               map global-map)
    (allout-institute-keymap map)))
;;;_  > allout-institute-keymap (map)
(defun allout-institute-keymap (map)
  "Associate allout-mode bindings with allout as a minor mode."
  ;; Architecture:
  ;; allout-mode-map var is a keymap by virtue of being a defalias for
  ;; allout-mode-map-value, which has the actual keymap value.
  ;; allout-mode-map's symbol value is just 'allout-mode-map, so it can be
  ;; used in minor-mode-map-alist to indirect to the actual
  ;; allout-mode-map-var value, which can be adjusted and reassigned.

166
  ;; allout-mode-map-value for keymap reference in various places:
167
  (setq allout-mode-map-value map)
168 169 170
  ;; the function value keymap of allout-mode-map is used in
  ;; minor-mode-map-alist - update it:
  (fset allout-mode-map allout-mode-map-value))
Juanma Barranquero's avatar
Juanma Barranquero committed
171
;;;_  * initialize the mode map:
172 173 174
;; ensure that allout-mode-map has some setting even if allout-mode hasn't
;; been invoked:
(allout-compose-and-institute-keymap)
175
;;;_   = allout-command-prefix
176
(defcustom allout-command-prefix "\C-c "
Lute Kamstra's avatar
Lute Kamstra committed
177
  "Key sequence to be used as prefix for outline mode command key bindings.
178 179 180 181

Default is '\C-c<space>'; just '\C-c' is more short-and-sweet, if you're
willing to let allout use a bunch of \C-c keybindings."
  :type 'string
182
  :group 'allout-keybindings
183
  :set 'allout-compose-and-institute-keymap)
184 185 186 187 188 189 190 191 192 193 194
;;;_   = allout-keybindings-binding
(define-widget 'allout-keybindings-binding 'lazy
  "Structure of allout keybindings customization items."
  :type '(repeat
          (list (string :tag "Key" :value "[(meta control shift ?f)]")
                (function :tag "Function name"
                          :value allout-forward-current-level))))
;;;_   = allout-prefixed-keybindings
(defcustom allout-prefixed-keybindings
  '(("[(control ?n)]" allout-next-visible-heading)
    ("[(control ?p)]" allout-previous-visible-heading)
195
    ("[(control ?u)]" allout-up-current-level)
196 197 198 199 200 201 202
    ("[(control ?f)]" allout-forward-current-level)
    ("[(control ?b)]" allout-backward-current-level)
    ("[(control ?a)]" allout-beginning-of-current-entry)
    ("[(control ?e)]" allout-end-of-entry)
    ("[(control ?i)]" allout-show-children)
    ("[(control ?s)]" allout-show-current-subtree)
    ("[(control ?t)]" allout-toggle-current-subtree-exposure)
203 204
;; Let user customize if they want to preempt describe-prefix-bindings ^h use.
;;    ("[(control ?h)]" allout-hide-current-subtree)
205 206 207 208 209 210 211 212 213 214 215 216
    ("[?h]" allout-hide-current-subtree)
    ("[(control ?o)]" allout-show-current-entry)
    ("[?!]" allout-show-all)
    ("[?x]" allout-toggle-current-subtree-encryption)
    ("[? ]" allout-open-sibtopic)
    ("[?.]" allout-open-subtopic)
    ("[?,]" allout-open-supertopic)
    ("[?']" allout-shift-in)
    ("[?>]" allout-shift-in)
    ("[?<]" allout-shift-out)
    ("[(control ?m)]" allout-rebullet-topic)
    ("[?*]" allout-rebullet-current-heading)
217
    ("[?#]" allout-number-siblings)
218
    ("[(control ?k)]" allout-kill-topic)
219
    ("[(meta ?k)]" allout-copy-topic-as-kill)
220 221 222 223 224 225 226 227 228 229 230 231 232 233 234
    ("[?@]" allout-resolve-xref)
    ("[?=?c]" allout-copy-exposed-to-buffer)
    ("[?=?i]" allout-indented-exposed-to-buffer)
    ("[?=?t]" allout-latexify-exposed)
    ("[?=?p]" allout-flatten-exposed-to-buffer)
    )
  "Allout-mode key bindings that are prefixed with `allout-command-prefix'.

See `allout-unprefixed-keybindings' for the list of keybindings
that are not prefixed.

Use vector format for the keys:
  - put literal keys after a '?' question mark, eg: '?a', '?.'
  - enclose control, shift, or meta-modified keys as sequences within
    parentheses, with the literal key, as above, preceded by the name(s)
Juanma Barranquero's avatar
Juanma Barranquero committed
235
    of the modifiers, eg: [(control ?a)]
236 237 238 239 240
See the existing keys for examples.

Functions can be bound to multiple keys, but binding keys to
multiple functions will not work - the last binding for a key
prevails."
241
  :version "24.1"
242 243
  :type 'allout-keybindings-binding
  :group 'allout-keybindings
244
  :set 'allout-compose-and-institute-keymap
245 246 247 248
 )
;;;_   = allout-unprefixed-keybindings
(defcustom allout-unprefixed-keybindings
  '(("[(control ?k)]" allout-kill-line)
249
    ("[(meta ?k)]" allout-copy-line-as-kill)
250
    ("[(control ?y)]" allout-yank)
251
    ("[(meta ?y)]" allout-yank-pop)
252 253 254 255 256
    )
  "Allout-mode functions bound to keys without any added prefix.

This is in contrast to the majority of allout-mode bindings on
`allout-prefixed-bindings', whose bindings are created with a
257
preceding command key.
258 259 260 261 262

Use vector format for the keys:
  - put literal keys after a '?' question mark, eg: '?a', '?.'
  - enclose control, shift, or meta-modified keys as sequences within
    parentheses, with the literal key, as above, preceded by the name(s)
Juanma Barranquero's avatar
Juanma Barranquero committed
263
    of the modifiers, eg: [(control ?a)]
264
See the existing keys for examples."
265
  :version "24.1"
266 267
  :type 'allout-keybindings-binding
  :group 'allout-keybindings
268
  :set 'allout-compose-and-institute-keymap
269 270
  )

271 272 273 274 275 276 277 278 279 280 281
;;;_  > allout-auto-activation-helper (var value)
;;;###autoload
(defun allout-auto-activation-helper (var value)
  "Institute `allout-auto-activation'.

Intended to be used as the `allout-auto-activation' :set function."
  (set-default var value)
  (allout-setup))
;;;_  > allout-setup ()
;;;###autoload
(defun allout-setup ()
Juanma Barranquero's avatar
Juanma Barranquero committed
282
  "Do fundamental Emacs session for allout auto-activation.
283 284 285 286 287 288 289 290 291

Establishes allout processing as part of visiting a file if
`allout-auto-activation' is non-nil, or removes it otherwise.

The proper way to use this is through customizing the setting of
`allout-auto-activation'."
  (if (not allout-auto-activation)
      (remove-hook 'find-file-hook 'allout-find-file-hook)
      (add-hook 'find-file-hook 'allout-find-file-hook)))
292
;;;_  = allout-auto-activation
293
;;;###autoload
294
(defcustom allout-auto-activation nil
295
  "Configure allout outline mode auto-activation.
296

297 298 299
Control whether and how allout outline mode is automatically
activated when files are visited with non-nil buffer-specific
file variable `allout-layout'.
300

Juanma Barranquero's avatar
Juanma Barranquero committed
301
When allout-auto-activation is \"On\" (t), allout mode is
302 303
activated in buffers with non-nil `allout-layout', and the
specified layout is applied.
304

305
With value \"ask\", auto-mode-activation is enabled, and endorsement for
306 307
performing auto-layout is asked of the user each time.

308 309
With value \"activate\", only auto-mode-activation is enabled.
Auto-layout is not.
310

311
With value nil, inhibit any automatic allout-mode activation."
312
  :set 'allout-auto-activation-helper
313
  ;; FIXME: Using strings here is unusual and less efficient than symbols.
Dave Love's avatar
Dave Love committed
314 315 316 317 318
  :type '(choice (const :tag "On" t)
                (const :tag "Ask about layout" "ask")
                (const :tag "Mode only" "activate")
                (const :tag "Off" nil))
  :group 'allout)
319
(allout-setup)
320 321
;;;_  = allout-default-layout
(defcustom allout-default-layout '(-2 : 0)
Lute Kamstra's avatar
Lute Kamstra committed
322
  "Default allout outline layout specification.
323 324 325 326 327 328 329 330

This setting specifies the outline exposure to use when
`allout-layout' has the local value `t'.  This docstring describes the
layout specifications.

A list value specifies a default layout for the current buffer,
to be applied upon activation of `allout-mode'.  Any non-nil
value will automatically trigger `allout-mode', provided
331
`allout-auto-activation' has been customized to enable it.
332 333 334

The types of elements in the layout specification are:

Richard M. Stallman's avatar
Richard M. Stallman committed
335 336 337 338 339 340 341 342
 INTEGER -- dictate the relative depth to open the corresponding topic(s),
            where:
         -- negative numbers force the topic to be closed before opening
            to the absolute value of the number, so all siblings are open
            only to that level.
         -- positive numbers open to the relative depth indicated by the
            number, but do not force already opened subtopics to be closed.
         -- 0 means to close topic -- hide all subitems.
Glenn Morris's avatar
Glenn Morris committed
343
 :   -- repeat spec -- apply the preceding element to all siblings at
Richard M. Stallman's avatar
Richard M. Stallman committed
344 345 346 347 348 349 350 351
        current level, *up to* those siblings that would be covered by specs
        following the `:' on the list.  Ie, apply to all topics at level but
        trailing ones accounted for by trailing specs.  (Only the first of
        multiple colons at the same level is honored -- later ones are ignored.)
 *   -- completely exposes the topic, including bodies
 +   -- exposes all subtopics, but not the bodies
 -   -- exposes the body of the corresponding topic, but not subtopics
 LIST -- a nested layout spec, to be applied intricately to its
352
        corresponding item(s)
Richard M. Stallman's avatar
Richard M. Stallman committed
353

354
Examples:
Richard M. Stallman's avatar
Richard M. Stallman committed
355
 (-2 : 0)
356 357
	Collapse the top-level topics to show their children and
        grandchildren, but completely collapse the final top-level topic.
Richard M. Stallman's avatar
Richard M. Stallman committed
358
 (-1 () : 1 0)
359 360 361 362
	Close the first topic so only the immediate subtopics are shown,
        leave the subsequent topics exposed as they are until the second
	second to last topic, which is exposed at least one level, and
        completely close the last topic.
Richard M. Stallman's avatar
Richard M. Stallman committed
363
 (-2 : -1 *)
364 365 366
        Expose children and grandchildren of all topics at current
	level except the last two; expose children of the second to
	last and completely expose the last one, including its subtopics.
367

368
See `allout-expose-topic' for more about the exposure process.
369

370 371
Also, allout's mode-specific provisions will make topic prefixes default
to the comment-start string, if any, of the language of the file.  This
372 373 374 375 376 377 378 379 380 381 382 383 384 385
is modulo the setting of `allout-use-mode-specific-leader', which see."
  :type 'allout-layout-type
  :group 'allout)
;;;_  : allout-layout-type
(define-widget 'allout-layout-type 'lazy
  "Allout layout format customization basic building blocks."
  :type '(repeat
          (choice (integer :tag "integer (<= zero is strict)")
                  (const :tag ": (repeat prior)" :)
                  (const :tag "* (completely expose)" *)
                  (const :tag "+ (expose all offspring, headlines only)" +)
                  (const :tag "- (expose topic body but not offspring)" -)
                  (allout-layout-type :tag "<Nested layout>"))))

386 387
;;;_  = allout-inhibit-auto-fill
(defcustom allout-inhibit-auto-fill nil
Lute Kamstra's avatar
Lute Kamstra committed
388
  "If non-nil, auto-fill will be inhibited in the allout buffers.
389 390 391 392 393 394 395 396 397 398 399 400 401

You can customize this setting to set it for all allout buffers, or set it
in individual buffers if you want to inhibit auto-fill only in particular
buffers.  (You could use a function on `allout-mode-hook' to inhibit
auto-fill according, eg, to the major mode.)

If you don't set this and auto-fill-mode is enabled, allout will use the
value that `normal-auto-fill-function', if any, when allout mode starts, or
else allout's special hanging-indent maintaining auto-fill function,
`allout-auto-fill'."
  :type 'boolean
  :group 'allout)
(make-variable-buffer-local 'allout-inhibit-auto-fill)
402 403 404
;;;_  = allout-inhibit-auto-fill-on-headline
(defcustom allout-inhibit-auto-fill-on-headline nil
  "If non-nil, auto-fill will be inhibited while on topic's header line."
405
  :version "24.1"
406 407 408
  :type 'boolean
  :group 'allout)
(make-variable-buffer-local 'allout-inhibit-auto-fill-on-headline)
409 410
;;;_  = allout-use-hanging-indents
(defcustom allout-use-hanging-indents t
Lute Kamstra's avatar
Lute Kamstra committed
411
  "If non-nil, topic body text auto-indent defaults to indent of the header.
412
Ie, it is indented to be just past the header prefix.  This is
Miles Bader's avatar
Miles Bader committed
413
relevant mostly for use with `indented-text-mode', or other situations
414 415 416 417 418 419
where auto-fill occurs."
  :type 'boolean
  :group 'allout)
(make-variable-buffer-local 'allout-use-hanging-indents)
;;;###autoload
(put 'allout-use-hanging-indents 'safe-local-variable
420
     (if (fboundp 'booleanp) 'booleanp (lambda (x) (member x '(t nil)))))
421 422 423
;;;_  = allout-reindent-bodies
(defcustom allout-reindent-bodies (if allout-use-hanging-indents
				    'text)
Lute Kamstra's avatar
Lute Kamstra committed
424
  "Non-nil enables auto-adjust of topic body hanging indent with depth shifts.
425 426 427 428 429 430 431 432 433 434 435 436 437 438

When active, topic body lines that are indented even with or beyond
their topic header are reindented to correspond with depth shifts of
the header.

A value of t enables reindent in non-programming-code buffers, ie
those that do not have the variable `comment-start' set.  A value of
`force' enables reindent whether or not `comment-start' is set."
  :type '(choice (const nil) (const t) (const text) (const force))
  :group 'allout)

(make-variable-buffer-local 'allout-reindent-bodies)
;;;###autoload
(put 'allout-reindent-bodies 'safe-local-variable
439
     (lambda (x) (memq x '(nil t text force))))
440

441 442
;;;_  = allout-show-bodies
(defcustom allout-show-bodies nil
Lute Kamstra's avatar
Lute Kamstra committed
443
  "If non-nil, show entire body when exposing a topic, rather than
Dave Love's avatar
Dave Love committed
444 445 446
just the header."
  :type 'boolean
  :group 'allout)
447
(make-variable-buffer-local 'allout-show-bodies)
448 449
;;;###autoload
(put 'allout-show-bodies 'safe-local-variable
450
     (if (fboundp 'booleanp) 'booleanp (lambda (x) (member x '(t nil)))))
Richard M. Stallman's avatar
Richard M. Stallman committed
451

452 453
;;;_  = allout-beginning-of-line-cycles
(defcustom allout-beginning-of-line-cycles t
Lute Kamstra's avatar
Lute Kamstra committed
454
  "If non-nil, \\[allout-beginning-of-line] will cycle through smart-placement options.
455 456 457 458 459 460 461 462 463 464 465 466 467 468

Cycling only happens on when the command is repeated, not when it
follows a different command.

Smart-placement means that repeated calls to this function will
advance as follows:

 - if the cursor is on a non-headline body line and not on the first column:
   then it goes to the first column
 - if the cursor is on the first column of a non-headline body line:
   then it goes to the start of the headline within the item body
 - if the cursor is on the headline and not the start of the headline:
   then it goes to the start of the headline
 - if the cursor is on the start of the headline:
469
   then it goes to the bullet character (for hotspot navigation)
470
 - if the cursor is on the bullet character:
471
   then it goes to the first column of that line (the headline)
472 473 474 475 476 477 478 479 480 481 482 483 484
 - if the cursor is on the first column of the headline:
   then it goes to the start of the headline within the item body.

In this fashion, you can use the beginning-of-line command to do
its normal job and then, when repeated, advance through the
entry, cycling back to start.

If this configuration variable is nil, then the cursor is just
advanced to the beginning of the line and remains there on
repeated calls."
  :type 'boolean :group 'allout)
;;;_  = allout-end-of-line-cycles
(defcustom allout-end-of-line-cycles t
Lute Kamstra's avatar
Lute Kamstra committed
485
  "If non-nil, \\[allout-end-of-line] will cycle through smart-placement options.
486 487 488 489

Cycling only happens on when the command is repeated, not when it
follows a different command.

Richard M. Stallman's avatar
Richard M. Stallman committed
490
Smart placement means that repeated calls to this function will
491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508
advance as follows:

 - if the cursor is not on the end-of-line,
   then it goes to the end-of-line
 - if the cursor is on the end-of-line but not the end-of-entry,
   then it goes to the end-of-entry, exposing it if necessary
 - if the cursor is on the end-of-entry,
   then it goes to the end of the head line

In this fashion, you can use the end-of-line command to do its
normal job and then, when repeated, advance through the entry,
cycling back to start.

If this configuration variable is nil, then the cursor is just
advanced to the end of the line and remains there on repeated
calls."
  :type 'boolean :group 'allout)

509 510
;;;_  = allout-header-prefix
(defcustom allout-header-prefix "."
511 512
;; this string is treated as literal match.  it will be `regexp-quote'd, so
;; one cannot use regular expressions to match varying header prefixes.
Lute Kamstra's avatar
Lute Kamstra committed
513
  "Leading string which helps distinguish topic headers.
514 515

Outline topic header lines are identified by a leading topic
516
header prefix, which mostly have the value of this var at their front.
517 518
Level 1 topics are exceptions.  They consist of only a single
character, which is typically set to the `allout-primary-bullet'."
Stephen Eglen's avatar
Stephen Eglen committed
519 520
  :type 'string
  :group 'allout)
521
(make-variable-buffer-local 'allout-header-prefix)
522 523
;;;###autoload
(put 'allout-header-prefix 'safe-local-variable 'stringp)
524 525
;;;_  = allout-primary-bullet
(defcustom allout-primary-bullet "*"
526 527 528
  "Bullet used for top-level outline topics.

Outline topic header lines are identified by a leading topic header
529
prefix, which is concluded by bullets that includes the value of this
530
var and the respective allout-*-bullets-string vars.
531

532
The value of an asterisk (`*') provides for backwards compatibility
533
with the original Emacs outline mode.  See `allout-plain-bullets-string'
534
and `allout-distinctive-bullets-string' for the range of available
Stephen Eglen's avatar
Stephen Eglen committed
535 536 537
bullets."
  :type 'string
  :group 'allout)
538
(make-variable-buffer-local 'allout-primary-bullet)
539 540
;;;###autoload
(put 'allout-primary-bullet 'safe-local-variable 'stringp)
541
;;;_  = allout-plain-bullets-string
542
(defcustom allout-plain-bullets-string ".,"
Lute Kamstra's avatar
Lute Kamstra committed
543
  "The bullets normally used in outline topic prefixes.
544

545
See `allout-distinctive-bullets-string' for the other kind of
546
bullets.
Richard M. Stallman's avatar
Richard M. Stallman committed
547

548
DO NOT include the close-square-bracket, `]', as a bullet.
Richard M. Stallman's avatar
Richard M. Stallman committed
549

550
Outline mode has to be reactivated in order for changes to the value
Stephen Eglen's avatar
Stephen Eglen committed
551 552 553
of this var to take effect."
  :type 'string
  :group 'allout)
554
(make-variable-buffer-local 'allout-plain-bullets-string)
555 556
;;;###autoload
(put 'allout-plain-bullets-string 'safe-local-variable 'stringp)
557
;;;_  = allout-distinctive-bullets-string
558
(defcustom allout-distinctive-bullets-string "*+-=>()[{}&!?#%\"X@$~_\\:;^"
Lute Kamstra's avatar
Lute Kamstra committed
559
  "Persistent outline header bullets used to distinguish special topics.
Richard M. Stallman's avatar
Richard M. Stallman committed
560

561 562 563
These bullets are distinguish topics with particular character.
They are not used by default in the topic creation routines, but
are offered as options when you modify topic creation with a
Juanma Barranquero's avatar
Juanma Barranquero committed
564
universal argument (\\[universal-argument]), or during rebulleting (\\[allout-rebullet-current-heading]).
565 566 567 568 569 570 571

Distinctive bullets are not cycled when topics are shifted or
otherwise automatically rebulleted, so their marking is
persistent until deliberately changed.  Their significance is
purely by convention, however.  Some conventions suggest
themselves:

Richard M. Stallman's avatar
Richard M. Stallman committed
572 573 574 575 576
 `(' - open paren -- an aside or incidental point
 `?' - question mark -- uncertain or outright question
 `!' - exclamation point/bang -- emphatic
 `[' - open square bracket -- meta-note, about item instead of item's subject
 `\"' - double quote -- a quotation or other citation
577
 `=' - equal sign -- an assignment, some kind of definition
Richard M. Stallman's avatar
Richard M. Stallman committed
578
 `^' - carat -- relates to something above
579 580 581

Some are more elusive, but their rationale may be recognizable:

Richard M. Stallman's avatar
Richard M. Stallman committed
582 583 584
 `+' - plus -- pending consideration, completion
 `_' - underscore -- done, completed
 `&' - ampersand -- addendum, furthermore
585 586 587 588

\(Some other non-plain bullets have special meaning to the
software.  By default:

Richard M. Stallman's avatar
Richard M. Stallman committed
589 590
 `~' marks encryptable topics -- see `allout-topic-encryption-bullet'
 `#' marks auto-numbered bullets -- see `allout-numbered-bullet'.)
591 592 593

See `allout-plain-bullets-string' for the standard, alternating
bullets.
Richard M. Stallman's avatar
Richard M. Stallman committed
594

595
You must run `set-allout-regexp' in order for outline mode to
596
adopt changes of this value.
597

598
DO NOT include the close-square-bracket, `]', on either of the bullet
Stephen Eglen's avatar
Stephen Eglen committed
599 600 601
strings."
  :type 'string
  :group 'allout)
602
(make-variable-buffer-local 'allout-distinctive-bullets-string)
603 604
;;;###autoload
(put 'allout-distinctive-bullets-string 'safe-local-variable 'stringp)
Richard M. Stallman's avatar
Richard M. Stallman committed
605

606 607
;;;_  = allout-use-mode-specific-leader
(defcustom allout-use-mode-specific-leader t
Lute Kamstra's avatar
Lute Kamstra committed
608
  "When non-nil, use mode-specific topic-header prefixes.
609

610 611 612 613
Allout outline mode will use the mode-specific `allout-mode-leaders' or
comment-start string, if any, to lead the topic prefix string, so topic
headers look like comments in the programming language.  It will also use
the comment-start string, with an '_' appended, for `allout-primary-bullet'.
614

615
String values are used as literals, not regular expressions, so
Paul Eggert's avatar
Paul Eggert committed
616
do not escape any regular-expression characters.
617

618
Value t means to first check for assoc value in `allout-mode-leaders'
619
alist, then use comment-start string, if any, then use default (`.').
Dave Love's avatar
Dave Love committed
620
\(See note about use of comment-start strings, below.)
621

622
Set to the symbol for either of `allout-mode-leaders' or
623 624
`comment-start' to use only one of them, respectively.

625
Value nil means to always use the default (`.') and leave
626 627 628 629 630 631
`allout-primary-bullet' unaltered.

comment-start strings that do not end in spaces are tripled in
the header-prefix, and an `_' underscore is tacked on the end, to
distinguish them from regular comment strings.  comment-start
strings that do end in spaces are not tripled, but an underscore
632
is substituted for the space.  [This presumes that the space is
633 634 635
for appearance, not comment syntax.  You can use
`allout-mode-leaders' to override this behavior, when
undesired.]"
636
  :type '(choice (const t) (const nil) string
637
		 (const allout-mode-leaders)
Stephen Eglen's avatar
Stephen Eglen committed
638 639
		 (const comment-start))
  :group 'allout)
640 641
;;;###autoload
(put 'allout-use-mode-specific-leader 'safe-local-variable
642
     (lambda (x) (or (memq x '(t nil allout-mode-leaders comment-start))
643
                      (stringp x))))
644 645 646
;;;_  = allout-mode-leaders
(defvar allout-mode-leaders '()
  "Specific allout-prefix leading strings per major modes.
647

648 649 650
Use this if the mode's comment-start string isn't what you
prefer, or if the mode lacks a comment-start string.  See
`allout-use-mode-specific-leader' for more details.
651 652 653 654

If you're constructing a string that will comment-out outline
structuring so it can be included in program code, append an extra
character, like an \"_\" underscore, to distinguish the lead string
655
from regular comments that start at the beginning-of-line.")
656

657 658
;;;_  = allout-old-style-prefixes
(defcustom allout-old-style-prefixes nil
Lute Kamstra's avatar
Lute Kamstra committed
659
  "When non-nil, use only old-and-crusty `outline-mode' `*' topic prefixes.
660 661

Non-nil restricts the topic creation and modification
662
functions to asterix-padded prefixes, so they look exactly
663
like the original Emacs-outline style prefixes.
Richard M. Stallman's avatar
Richard M. Stallman committed
664

665
Whatever the setting of this variable, both old and new style prefixes
Stephen Eglen's avatar
Stephen Eglen committed
666 667 668
are always respected by the topic maneuvering functions."
  :type 'boolean
  :group 'allout)
669
(make-variable-buffer-local 'allout-old-style-prefixes)
670 671
;;;###autoload
(put 'allout-old-style-prefixes 'safe-local-variable
672
     (if (fboundp 'booleanp) 'booleanp (lambda (x) (member x '(t nil)))))
Richard M. Stallman's avatar
Richard M. Stallman committed
673
;;;_  = allout-stylish-prefixes -- alternating bullets
674
(defcustom allout-stylish-prefixes t
Lute Kamstra's avatar
Lute Kamstra committed
675
  "Do fancy stuff with topic prefix bullets according to level, etc.
676

677 678 679
Non-nil enables topic creation, modification, and repositioning
functions to vary the topic bullet char (the char that marks the topic
depth) just preceding the start of the topic text) according to level.
680
Otherwise, only asterisks (`*') and distinctive bullets are used.
681 682 683

This is how an outline can look (but sans indentation) with stylish
prefixes:
684 685 686 687 688

    * Top level
    .* A topic
    . + One level 3 subtopic
    .  . One level 4 subtopic
689
    .  . A second 4 subtopic
690
    . + Another level 3 subtopic
691 692 693 694
    .  #1 A numbered level 4 subtopic
    .  #2 Another
    .  ! Another level 4 subtopic with a different distinctive bullet
    .  #4 And another numbered level 4 subtopic
695

696 697
This would be an outline with stylish prefixes inhibited (but the
numbered and other distinctive bullets retained):
698 699 700

    * Top level
    .* A topic
701 702 703 704 705 706 707 708
    . * One level 3 subtopic
    .  * One level 4 subtopic
    .  * A second 4 subtopic
    . * Another level 3 subtopic
    .  #1 A numbered level 4 subtopic
    .  #2 Another
    .  ! Another level 4 subtopic with a different distinctive bullet
    .  #4 And another numbered level 4 subtopic
709 710 711 712 713

Stylish and constant prefixes (as well as old-style prefixes) are
always respected by the topic maneuvering functions, regardless of
this variable setting.

714
The setting of this var is not relevant when `allout-old-style-prefixes'
Stephen Eglen's avatar
Stephen Eglen committed
715 716 717
is non-nil."
  :type 'boolean
  :group 'allout)
718
(make-variable-buffer-local 'allout-stylish-prefixes)
719 720
;;;###autoload
(put 'allout-stylish-prefixes 'safe-local-variable
721
     (if (fboundp 'booleanp) 'booleanp (lambda (x) (member x '(t nil)))))
Richard M. Stallman's avatar
Richard M. Stallman committed
722

723 724
;;;_  = allout-numbered-bullet
(defcustom allout-numbered-bullet "#"
Lute Kamstra's avatar
Lute Kamstra committed
725
  "String designating bullet of topics that have auto-numbering; nil for none.
726

727
Topics having this bullet have automatic maintenance of a sibling
728
sequence-number tacked on, just after the bullet.  Conventionally set
729
to \"#\", you can set it to a bullet of your choice.  A nil value
Stephen Eglen's avatar
Stephen Eglen committed
730 731 732
disables numbering maintenance."
  :type '(choice (const nil) string)
  :group 'allout)
733
(make-variable-buffer-local 'allout-numbered-bullet)
734
;;;###autoload
735 736 737
(put 'allout-numbered-bullet 'safe-local-variable
     (if (fboundp 'string-or-null-p)
         'string-or-null-p
738
       (lambda (x) (or (stringp x) (null x)))))
739 740
;;;_  = allout-file-xref-bullet
(defcustom allout-file-xref-bullet "@"
Lute Kamstra's avatar
Lute Kamstra committed
741
  "Bullet signifying file cross-references, for `allout-resolve-xref'.
742

Dave Love's avatar
Dave Love committed
743
Set this var to the bullet you want to use for file cross-references."
Stephen Eglen's avatar
Stephen Eglen committed
744 745
  :type '(choice (const nil) string)
  :group 'allout)
746
;;;###autoload
747 748 749
(put 'allout-file-xref-bullet 'safe-local-variable
     (if (fboundp 'string-or-null-p)
         'string-or-null-p
750
       (lambda (x) (or (stringp x) (null x)))))
751 752
;;;_  = allout-presentation-padding
(defcustom allout-presentation-padding 2
Lute Kamstra's avatar
Lute Kamstra committed
753
  "Presentation-format white-space padding factor, for greater indent."
Dave Love's avatar
Dave Love committed
754 755 756
  :type 'integer
  :group 'allout)

757
(make-variable-buffer-local 'allout-presentation-padding)
758 759
;;;###autoload
(put 'allout-presentation-padding 'safe-local-variable 'integerp)
Dave Love's avatar
Dave Love committed
760

761 762
;;;_  = allout-flattened-numbering-abbreviation
(define-obsolete-variable-alias 'allout-abbreviate-flattened-numbering
763
  'allout-flattened-numbering-abbreviation "24.1")
764
(defcustom allout-flattened-numbering-abbreviation nil
Lute Kamstra's avatar
Lute Kamstra committed
765
  "If non-nil, `allout-flatten-exposed-to-buffer' abbreviates topic
Dave Love's avatar
Dave Love committed
766 767
numbers to minimal amount with some context.  Otherwise, entire
numbers are always used."
768
  :version "24.1"
Dave Love's avatar
Dave Love committed
769 770 771
  :type 'boolean
  :group 'allout)

772
;;;_ + LaTeX formatting
773 774
;;;_  - allout-number-pages
(defcustom allout-number-pages nil
Lute Kamstra's avatar
Lute Kamstra committed
775
  "Non-nil turns on page numbering for LaTeX formatting of an outline."
Stephen Eglen's avatar
Stephen Eglen committed
776 777
  :type 'boolean
  :group 'allout)
778 779
;;;_  - allout-label-style
(defcustom allout-label-style "\\large\\bf"
Lute Kamstra's avatar
Lute Kamstra committed
780
  "Font and size of labels for LaTeX formatting of an outline."
Stephen Eglen's avatar
Stephen Eglen committed
781 782
  :type 'string
  :group 'allout)
783 784
;;;_  - allout-head-line-style
(defcustom allout-head-line-style "\\large\\sl "
Lute Kamstra's avatar
Lute Kamstra committed
785
  "Font and size of entries for LaTeX formatting of an outline."
Stephen Eglen's avatar
Stephen Eglen committed
786 787
  :type 'string
  :group 'allout)
788 789
;;;_  - allout-body-line-style
(defcustom allout-body-line-style " "
Lute Kamstra's avatar
Lute Kamstra committed
790
  "Font and size of entries for LaTeX formatting of an outline."
Stephen Eglen's avatar
Stephen Eglen committed
791 792
  :type 'string
  :group 'allout)
793 794
;;;_  - allout-title-style
(defcustom allout-title-style "\\Large\\bf"
Lute Kamstra's avatar
Lute Kamstra committed
795
  "Font and size of titles for LaTeX formatting of an outline."
Stephen Eglen's avatar
Stephen Eglen committed
796 797
  :type 'string
  :group 'allout)
798
;;;_  - allout-title
799
(defcustom allout-title '(or buffer-file-name (buffer-name))
Lute Kamstra's avatar
Lute Kamstra committed
800
  "Expression to be evaluated to determine the title for LaTeX
Stephen Eglen's avatar
Stephen Eglen committed
801 802 803
formatted copy."
  :type 'sexp
  :group 'allout)
804 805
;;;_  - allout-line-skip
(defcustom allout-line-skip ".05cm"
Lute Kamstra's avatar
Lute Kamstra committed
806
  "Space between lines for LaTeX formatting of an outline."
Stephen Eglen's avatar
Stephen Eglen committed
807 808
  :type 'string
  :group 'allout)
809 810
;;;_  - allout-indent
(defcustom allout-indent ".3cm"
Lute Kamstra's avatar
Lute Kamstra committed
811
  "LaTeX formatted depth-indent spacing."
Stephen Eglen's avatar
Stephen Eglen committed
812 813
  :type 'string
  :group 'allout)
814

815
;;;_ + Topic encryption
816 817 818 819
;;;_  = allout-encryption group
(defgroup allout-encryption nil
  "Settings for topic encryption features of allout outliner."
  :group 'allout)
820 821
;;;_  = allout-topic-encryption-bullet
(defcustom allout-topic-encryption-bullet "~"
Lute Kamstra's avatar
Lute Kamstra committed
822
  "Bullet signifying encryption of the entry's body."
823
  :type '(choice (const nil) string)
824
  :version "22.1"
825
  :group 'allout-encryption)
826
;;;_  = allout-encrypt-unencrypted-on-saves
827
(defcustom allout-encrypt-unencrypted-on-saves t
828 829
  "If non-nil, topics pending encryption are encrypted during buffer saves.

Paul Eggert's avatar
Paul Eggert committed
830
This prevents file-system exposure of un-encrypted contents of
831 832 833 834 835 836 837 838 839 840 841 842 843
items marked for encryption.

When non-nil, if the topic currently being edited is decrypted,
it will be encrypted for saving but automatically decrypted
before any subsequent user interaction, so it is once again clear
text for editing though the file system copy is encrypted.

\(Auto-saves are handled differently.  Buffers with plain-text
exposed encrypted topics are exempted from auto saves until all
such topics are encrypted.)"

  :type 'boolean
  :version "23.1"
844
  :group 'allout-encryption)
845
(make-variable-buffer-local 'allout-encrypt-unencrypted-on-saves)
846 847 848
(defvar allout-auto-save-temporarily-disabled nil
  "True while topic encryption is pending and auto-saving was active.

Juanma Barranquero's avatar
Juanma Barranquero committed
849
The value of `buffer-saved-size' at the time of decryption is used,
850 851 852 853
for restoring when all encryptions are established.")
(defvar allout-just-did-undo nil
  "True just after undo commands, until allout-post-command-business.")
(make-variable-buffer-local 'allout-just-did-undo)
854

855 856 857
;;;_ + Developer
;;;_  = allout-developer group
(defgroup allout-developer nil
858
  "Allout settings developers care about, including topic encryption and more."
859 860 861
  :group 'allout)
;;;_  = allout-run-unit-tests-on-load
(defcustom allout-run-unit-tests-on-load nil
Lute Kamstra's avatar
Lute Kamstra committed
862
  "When non-nil, unit tests will be run at end of loading the allout module.
863 864 865 866

Generally, allout code developers are the only ones who'll want to set this.

\(If set, this makes it an even better practice to exercise changes by
867 868
doing byte-compilation with a repeat count, so the file is loaded after
compilation.)
869 870 871 872 873

See `allout-run-unit-tests' to see what's run."
  :type 'boolean
  :group 'allout-developer)

874 875
;;;_ + Miscellaneous customization

876 877
;;;_  = allout-enable-file-variable-adjustment
(defcustom allout-enable-file-variable-adjustment t
Lute Kamstra's avatar
Lute Kamstra committed
878
  "If non-nil, some allout outline actions edit Emacs local file var text.
879 880 881

This can range from changes to existing entries, addition of new ones,
and creation of a new local variables section when necessary.
882

883 884
Emacs file variables adjustments are also inhibited if `enable-local-variables'
is nil.
885

886
Operations potentially causing edits include allout encryption routines.
887
For details, see `allout-toggle-current-subtree-encryption's docstring."
Stephen Eglen's avatar
Stephen Eglen committed
888 889
  :type 'boolean
  :group 'allout)
890
(make-variable-buffer-local 'allout-enable-file-variable-adjustment)
891

Richard M. Stallman's avatar
Richard M. Stallman committed
892
;;;_* CODE -- no user customizations below.
893

Dave Love's avatar
Dave Love committed
894 895
;;;_ #1 Internal Outline Formatting and Configuration
;;;_  : Version
896
;;;_   = allout-version
897
(defvar allout-version "2.3"
898
  "Version of currently loaded outline package.  (allout.el)")
899 900
;;;_   > allout-version
(defun allout-version (&optional here)
901 902
  "Return string describing the loaded outline version."
  (interactive "P")
903
  (let ((msg (concat "Allout Outline Mode v " allout-version)))
904
    (if here (insert msg))
905 906
    (message "%s" msg)
    msg))
907 908 909 910
;;;_  : Mode activation (defined here because it's referenced early)
;;;_   = allout-mode
(defvar allout-mode nil "Allout outline mode minor-mode flag.")
(make-variable-buffer-local 'allout-mode)
911
;;;_   = allout-layout nil
Richard M. Stallman's avatar
Richard M. Stallman committed
912
(defvar allout-layout nil            ; LEAVE GLOBAL VALUE NIL -- see docstring.
913 914
  "Buffer-specific setting for allout layout.

Juanma Barranquero's avatar
Juanma Barranquero committed
915
In buffers where this is non-nil (and if `allout-auto-activation'
916 917 918
has been customized to enable this behavior), `allout-mode' will be
automatically activated.  The layout dictated by the value will be used to
set the initial exposure when `allout-mode' is activated.
919 920 921 922 923 924 925 926

\*You should not setq-default this variable non-nil unless you want every
visited file to be treated as an allout file.*

The value would typically be set by a file local variable.  For
example, the following lines at the bottom of an Emacs Lisp file:

;;;Local variables:
927
;;;allout-layout: (0 : -1 -1 0)
928 929 930
;;;End:

dictate activation of `allout-mode' mode when the file is visited
931 932 933
\(presuming proper `allout-auto-activation' customization),
followed by the equivalent of `(allout-expose-topic 0 : -1 -1 0)'.
\(This is the layout used for the allout.el source file.)
934 935 936 937 938

`allout-default-layout' describes the specification format.
`allout-layout' can additionally have the value `t', in which
case the value of `allout-default-layout' is used.")
(make-variable-buffer-local 'allout-layout)
939
;;;###autoload
940
(put 'allout-layout 'safe-local-variable
941
     (lambda (x) (or (numberp x) (listp x) (memq x '(: * + -)))))
942

Dave Love's avatar
Dave Love committed
943
;;;_  : Topic header format
944 945
;;;_   = allout-regexp
(defvar allout-regexp ""
946
  "Regular expression to match the beginning of a heading line.
947

948 949
Any line whose beginning matches this regexp is considered a
heading.  This var is set according to the user configuration vars
950
by `set-allout-regexp'.")
951 952 953
(make-variable-buffer-local 'allout-regexp)
;;;_   = allout-bullets-string
(defvar allout-bullets-string ""
954 955
  "A string dictating the valid set of outline topic bullets.

Richard M. Stallman's avatar
Richard M. Stallman committed
956
This var should *not* be set by the user -- it is set by `set-allout-regexp',
957 958 959 960 961
and is produced from the elements of `allout-plain-bullets-string'
and `allout-distinctive-bullets-string'.")
(make-variable-buffer-local 'allout-bullets-string)
;;;_   = allout-bullets-string-len
(defvar allout-bullets-string-len 0
962
  "Length of current buffers' `allout-plain-bullets-string'.")
963
(make-variable-buffer-local 'allout-bullets-string-len)
964 965
;;;_   = allout-depth-specific-regexp
(defvar allout-depth-specific-regexp ""
966
  "Regular expression to match a heading line prefix for a particular depth.
967 968 969 970 971 972 973 974 975 976 977 978

This expression is used to search for depth-specific topic
headers at depth 2 and greater.  Use `allout-depth-one-regexp'
for to seek topics at depth one.

This var is set according to the user configuration vars by
`set-allout-regexp'.  It is prepared with format strings for two
decimal numbers, which should each be one less than the depth of the
topic prefix to be matched.")
(make-variable-buffer-local 'allout-depth-specific-regexp)
;;;_   = allout-depth-one-regexp
(defvar allout-depth-one-regexp ""
979
  "Regular expression to match a heading line prefix for depth one.
980 981 982 983 984 985

This var is set according to the user configuration vars by
`set-allout-regexp'.  It is prepared with format strings for two
decimal numbers, which should each be one less than the depth of the
topic prefix to be matched.")
(make-variable-buffer-local 'allout-depth-one-regexp)
986 987
;;;_   = allout-line-boundary-regexp
(defvar allout-line-boundary-regexp ()
988
  "`allout-regexp' prepended with a newline for the search target.
989

990
This is properly set by `set-allout-regexp'.")
991 992 993
(make-variable-buffer-local 'allout-line-boundary-regexp)
;;;_   = allout-bob-regexp
(defvar allout-bob-regexp ()
994
  "Like `allout-line-boundary-regexp', for headers at beginning of buffer.")
995 996 997 998 999 1000 1001
(make-variable-buffer-local 'allout-bob-regexp)
;;;_   = allout-header-subtraction
(defvar allout-header-subtraction (1- (length allout-header-prefix))
  "Allout-header prefix length to subtract when computing topic depth.")
(make-variable-buffer-local 'allout-header-subtraction)
;;;_   = allout-plain-bullets-string-len
(defvar allout-plain-bullets-string-len (length allout-plain-bullets-string)
1002
  "Length of `allout-plain-bullets-string', updated by `set-allout-regexp'.")
1003 1004
(make-variable-buffer-local 'allout-plain-bullets-string-len)