Don't call turn_on_atimers around `connect' (Bug#5723).
[bpt/emacs.git] / lisp / allout.el
index 8878c56..666c622 100644 (file)
@@ -1,21 +1,21 @@
 ;;; allout.el --- extensive outline mode for use alone and with other modes
 
-;; Copyright (C) 1992, 1993, 1994, 2001, 2002, 2003, 2004,
-;;   2005, 2006, 2007 Free Software Foundation, Inc.
+;; Copyright (C) 1992, 1993, 1994, 2001, 2002, 2003, 2004, 2005,
+;;   2006, 2007, 2008, 2009, 2010  Free Software Foundation, Inc.
 
 ;; Author: Ken Manheimer <ken dot manheimer at gmail dot com>
 ;; Maintainer: Ken Manheimer <ken dot manheimer at gmail dot com>
-;; Created: Dec 1991 - first release to usenet
+;; Created: Dec 1991 -- first release to usenet
 ;; Version: 2.2.1
 ;; Keywords: outlines wp languages
 ;; Website: http://myriadicity.net/Sundry/EmacsAllout
 
 ;; This file is part of GNU Emacs.
 
-;; GNU Emacs is free software; you can redistribute it and/or modify
+;; GNU Emacs is free software: you can redistribute it and/or modify
 ;; it under the terms of the GNU General Public License as published by
-;; the Free Software Foundation; either version 3, or (at your option)
-;; any later version.
+;; the Free Software Foundation, either version 3 of the License, or
+;; (at your option) any later version.
 
 ;; GNU Emacs is distributed in the hope that it will be useful,
 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
@@ -23,9 +23,7 @@
 ;; GNU General Public License for more details.
 
 ;; You should have received a copy of the GNU General Public License
-;; along with GNU Emacs; see the file COPYING.  If not, write to the
-;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
-;; Boston, MA 02110-1301, USA.
+;; along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.
 
 ;;; Commentary:
 
 ;;  - 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
-;;  - Customizable bullet format - enables programming-language specific
+;;  - Customizable bullet format -- enables programming-language specific
 ;;    outlining, for code-folding editing.  (Allout code itself is to try it;
-;;    formatted as an outline - do ESC-x eval-buffer in allout.el; but
+;;    formatted as an outline -- do ESC-x eval-buffer in allout.el; but
 ;;    emacs local file variables need to be enabled when the
-;;    file was visited - see `enable-local-variables'.)
+;;    file was visited -- see `enable-local-variables'.)
 ;;  - Configurable per-file initial exposure settings
 ;;  - Symmetric-key and key-pair topic encryption, plus symmetric passphrase
 ;;    mnemonic support, with verification against an established passphrase
@@ -53,7 +51,7 @@
 ;;    exposure control (see the allout-mode docstring)
 ;;  - Easy rendering of exposed portions into numbered, latex, indented, etc
 ;;    outline styles
-;;  - Careful attention to whitespace - enabling blank lines between items
+;;  - Careful attention to whitespace -- enabling blank lines between items
 ;;    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.
@@ -76,7 +74,7 @@
 ;; `allout-mode' as a minor mode.  (It has changed since allout
 ;; 3.x, for those of you that depend on the old method.)
 ;;
-;; Note - the lines beginning with `;;;_' are outline topic headers.
+;; Note -- the lines beginning with `;;;_' are outline topic headers.
 ;;        Just `ESC-x eval-buffer' to give it a whirl.
 
 ;; ken manheimer (ken dot manheimer at gmail dot com)
   ;; Most of the requires here are for stuff covered by autoloads.
   ;; Since just byte-compiling doesn't trigger autoloads, so that
   ;; "function not found" warnings would occur without these requires.
-  (progn
-    (require 'pgg)
-    (require 'pgg-gpg)
-    (require 'overlay)
-    ;; `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)
-    ))
+  (require 'pgg)
+  (require 'pgg-gpg)
+  (require 'overlay)
+  ;; `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)
+  )
 
 ;;;_* USER CUSTOMIZATION VARIABLES:
 
 
 ;;;_  = allout-command-prefix
 (defcustom allout-command-prefix "\C-c "
-  "*Key sequence to be used as prefix for outline mode command key bindings.
+  "Key sequence to be used as prefix for outline mode command key bindings.
 
 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
   :group 'allout)
+
 ;;;_  = allout-keybindings-list
-;;; You have to reactivate allout-mode - `(allout-mode t)' - to
+;;; You have to reactivate allout-mode -- `(allout-mode t)' -- to
 ;;; institute changes to this var.
 (defvar allout-keybindings-list ()
   "*List of `allout-mode' key / function bindings, for `allout-mode-map'.
-
 String or vector key will be prefaced with `allout-command-prefix',
 unless optional third, non-nil element is present.")
 (setq allout-keybindings-list
@@ -138,7 +135,7 @@ unless optional third, non-nil element is present.")
                                         ; Exposure commands:
         ("\C-i" allout-show-children)
         ("\C-s" allout-show-current-subtree)
-        ("\C-h" allout-hide-current-subtree)
+       ("\C-h" allout-hide-current-subtree)
         ("\C-t" allout-toggle-current-subtree-exposure)
         ("h" allout-hide-current-subtree)
         ("\C-o" allout-show-current-entry)
@@ -155,11 +152,11 @@ unless optional third, non-nil element is present.")
         ("*" allout-rebullet-current-heading)
         ("#" allout-number-siblings)
         ("\C-k" allout-kill-line t)
-        ("\M-k" allout-copy-line-as-kill t)
+        ([?\M-k] allout-copy-line-as-kill t)
         ("\C-y" allout-yank t)
-        ("\M-y" allout-yank-pop t)
+        ([?\M-y] allout-yank-pop t)
         ("\C-k" allout-kill-topic)
-        ("\M-k" allout-copy-topic-as-kill)
+        ([?\M-k] allout-copy-topic-as-kill)
                                         ; Miscellaneous commands:
        ;([?\C-\ ] allout-mark-topic)
         ("@" allout-resolve-xref)
@@ -170,7 +167,7 @@ unless optional third, non-nil element is present.")
 
 ;;;_  = allout-auto-activation
 (defcustom allout-auto-activation nil
-  "*Regulates auto-activation modality of allout outlines - see `allout-init'.
+  "Regulates auto-activation modality of allout outlines -- see `allout-init'.
 
 Setq-default by `allout-init' to regulate whether or not allout
 outline mode is automatically activated when the buffer-specific
@@ -199,7 +196,7 @@ this variable."
   :group 'allout)
 ;;;_  = allout-default-layout
 (defcustom allout-default-layout '(-2 : 0)
-  "*Default allout outline layout specification.
+  "Default allout outline layout specification.
 
 This setting specifies the outline exposure to use when
 `allout-layout' has the local value `t'.  This docstring describes the
@@ -212,35 +209,35 @@ value will automatically trigger `allout-mode', provided
 
 The types of elements in the layout specification are:
 
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.
- :   - repeat spec - apply the preceeding element to all siblings at
-       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
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.
+ :   -- repeat spec -- apply the preceeding element to all siblings at
+        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
         corresponding item(s)
 
 Examples:
'(-2 : 0)
+ (-2 : 0)
        Collapse the top-level topics to show their children and
         grandchildren, but completely collapse the final top-level topic.
'(-1 () : 1 0)
+ (-1 () : 1 0)
        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.
'(-2 : -1 *)
+ (-2 : -1 *)
         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.
@@ -265,7 +262,7 @@ is modulo the setting of `allout-use-mode-specific-leader', which see."
 
 ;;;_  = allout-inhibit-auto-fill
 (defcustom allout-inhibit-auto-fill nil
-  "*If non-nil, auto-fill will be inhibited in the allout buffers.
+  "If non-nil, auto-fill will be inhibited in the allout buffers.
 
 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
@@ -281,9 +278,9 @@ else allout's special hanging-indent maintaining auto-fill function,
 (make-variable-buffer-local 'allout-inhibit-auto-fill)
 ;;;_  = allout-use-hanging-indents
 (defcustom allout-use-hanging-indents t
-  "*If non-nil, topic body text auto-indent defaults to indent of the header.
+  "If non-nil, topic body text auto-indent defaults to indent of the header.
 Ie, it is indented to be just past the header prefix.  This is
-relevant mostly for use with indented-text-mode, or other situations
+relevant mostly for use with `indented-text-mode', or other situations
 where auto-fill occurs."
   :type 'boolean
   :group 'allout)
@@ -294,7 +291,7 @@ where auto-fill occurs."
 ;;;_  = allout-reindent-bodies
 (defcustom allout-reindent-bodies (if allout-use-hanging-indents
                                    'text)
-  "*Non-nil enables auto-adjust of topic body hanging indent with depth shifts.
+  "Non-nil enables auto-adjust of topic body hanging indent with depth shifts.
 
 When active, topic body lines that are indented even with or beyond
 their topic header are reindented to correspond with depth shifts of
@@ -313,7 +310,7 @@ those that do not have the variable `comment-start' set.  A value of
 
 ;;;_  = allout-show-bodies
 (defcustom allout-show-bodies nil
-  "*If non-nil, show entire body when exposing a topic, rather than
+  "If non-nil, show entire body when exposing a topic, rather than
 just the header."
   :type 'boolean
   :group 'allout)
@@ -324,7 +321,7 @@ just the header."
 
 ;;;_  = allout-beginning-of-line-cycles
 (defcustom allout-beginning-of-line-cycles t
-  "*If non-nil, \\[allout-beginning-of-line] will cycle through smart-placement options.
+  "If non-nil, \\[allout-beginning-of-line] will cycle through smart-placement options.
 
 Cycling only happens on when the command is repeated, not when it
 follows a different command.
@@ -355,12 +352,12 @@ repeated calls."
   :type 'boolean :group 'allout)
 ;;;_  = allout-end-of-line-cycles
 (defcustom allout-end-of-line-cycles t
-  "*If non-nil, \\[allout-end-of-line] will cycle through smart-placement options.
+  "If non-nil, \\[allout-end-of-line] will cycle through smart-placement options.
 
 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
+Smart placement means that repeated calls to this function will
 advance as follows:
 
  - if the cursor is not on the end-of-line,
@@ -383,7 +380,7 @@ calls."
 (defcustom allout-header-prefix "."
 ;; this string is treated as literal match.  it will be `regexp-quote'd, so
 ;; one cannot use regular expressions to match varying header prefixes.
-  "*Leading string which helps distinguish topic headers.
+  "Leading string which helps distinguish topic headers.
 
 Outline topic header lines are identified by a leading topic
 header prefix, which mostly have the value of this var at their front.
@@ -413,7 +410,7 @@ bullets."
 (put 'allout-primary-bullet 'safe-local-variable 'stringp)
 ;;;_  = allout-plain-bullets-string
 (defcustom allout-plain-bullets-string ".,"
-  "*The bullets normally used in outline topic prefixes.
+  "The bullets normally used in outline topic prefixes.
 
 See `allout-distinctive-bullets-string' for the other kind of
 bullets.
@@ -429,7 +426,7 @@ of this var to take effect."
 (put 'allout-plain-bullets-string 'safe-local-variable 'stringp)
 ;;;_  = allout-distinctive-bullets-string
 (defcustom allout-distinctive-bullets-string "*+-=>()[{}&!?#%\"X@$~_\\:;^"
-  "*Persistent outline header bullets used to distinguish special topics.
+  "Persistent outline header bullets used to distinguish special topics.
 
 These bullets are distinguish topics with particular character.
 They are not used by default in the topic creation routines, but
@@ -442,25 +439,25 @@ persistent until deliberately changed.  Their significance is
 purely by convention, however.  Some conventions suggest
 themselves:
 
- `(' - 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
- `=' - equal sign - an assignement, equating a name with some connotation
- `^' - carat - relates to something above
+ `(' - 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
+ `=' - equal sign -- an assignement, equating a name with some connotation
+ `^' - carat -- relates to something above
 
 Some are more elusive, but their rationale may be recognizable:
 
- `+' - plus - pending consideration, completion
- `_' - underscore - done, completed
- `&' - ampersand - addendum, furthermore
+ `+' - plus -- pending consideration, completion
+ `_' - underscore -- done, completed
+ `&' - ampersand -- addendum, furthermore
 
 \(Some other non-plain bullets have special meaning to the
 software.  By default:
 
- `~' marks encryptable topics - see `allout-topic-encryption-bullet'
- `#' marks auto-numbered bullets - see `allout-numbered-bullet'.)
+ `~' marks encryptable topics -- see `allout-topic-encryption-bullet'
+ `#' marks auto-numbered bullets -- see `allout-numbered-bullet'.)
 
 See `allout-plain-bullets-string' for the standard, alternating
 bullets.
@@ -478,7 +475,7 @@ strings."
 
 ;;;_  = allout-use-mode-specific-leader
 (defcustom allout-use-mode-specific-leader t
-  "*When non-nil, use mode-specific topic-header prefixes.
+  "When non-nil, use mode-specific topic-header prefixes.
 
 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
@@ -502,7 +499,7 @@ 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
-is substituted for the space. [This presumes that the space is
+is substituted for the space.  [This presumes that the space is
 for appearance, not comment syntax.  You can use
 `allout-mode-leaders' to override this behavior, when
 undesired.]"
@@ -529,7 +526,7 @@ from regular comments that start at the beginning-of-line.")
 
 ;;;_  = allout-old-style-prefixes
 (defcustom allout-old-style-prefixes nil
-  "*When non-nil, use only old-and-crusty `outline-mode' `*' topic prefixes.
+  "When non-nil, use only old-and-crusty `outline-mode' `*' topic prefixes.
 
 Non-nil restricts the topic creation and modification
 functions to asterix-padded prefixes, so they look exactly
@@ -543,9 +540,9 @@ are always respected by the topic maneuvering functions."
 ;;;###autoload
 (put 'allout-old-style-prefixes 'safe-local-variable
      (if (fboundp 'booleanp) 'booleanp '(lambda (x) (member x '(t nil)))))
-;;;_  = allout-stylish-prefixes - alternating bullets
+;;;_  = allout-stylish-prefixes -- alternating bullets
 (defcustom allout-stylish-prefixes t
-  "*Do fancy stuff with topic prefix bullets according to level, etc.
+  "Do fancy stuff with topic prefix bullets according to level, etc.
 
 Non-nil enables topic creation, modification, and repositioning
 functions to vary the topic bullet char (the char that marks the topic
@@ -595,7 +592,7 @@ is non-nil."
 
 ;;;_  = allout-numbered-bullet
 (defcustom allout-numbered-bullet "#"
-  "*String designating bullet of topics that have auto-numbering; nil for none.
+  "String designating bullet of topics that have auto-numbering; nil for none.
 
 Topics having this bullet have automatic maintenance of a sibling
 sequence-number tacked on, just after the bullet.  Conventionally set
@@ -611,7 +608,7 @@ disables numbering maintenance."
        '(lambda (x) (or (stringp x) (null x)))))
 ;;;_  = allout-file-xref-bullet
 (defcustom allout-file-xref-bullet "@"
-  "*Bullet signifying file cross-references, for `allout-resolve-xref'.
+  "Bullet signifying file cross-references, for `allout-resolve-xref'.
 
 Set this var to the bullet you want to use for file cross-references."
   :type '(choice (const nil) string)
@@ -623,7 +620,7 @@ Set this var to the bullet you want to use for file cross-references."
        '(lambda (x) (or (stringp x) (null x)))))
 ;;;_  = allout-presentation-padding
 (defcustom allout-presentation-padding 2
-  "*Presentation-format white-space padding factor, for greater indent."
+  "Presentation-format white-space padding factor, for greater indent."
   :type 'integer
   :group 'allout)
 
@@ -633,7 +630,7 @@ Set this var to the bullet you want to use for file cross-references."
 
 ;;;_  = allout-abbreviate-flattened-numbering
 (defcustom allout-abbreviate-flattened-numbering nil
-  "*If non-nil, `allout-flatten-exposed-to-buffer' abbreviates topic
+  "If non-nil, `allout-flatten-exposed-to-buffer' abbreviates topic
 numbers to minimal amount with some context.  Otherwise, entire
 numbers are always used."
   :type 'boolean
@@ -642,43 +639,43 @@ numbers are always used."
 ;;;_ + LaTeX formatting
 ;;;_  - allout-number-pages
 (defcustom allout-number-pages nil
-  "*Non-nil turns on page numbering for LaTeX formatting of an outline."
+  "Non-nil turns on page numbering for LaTeX formatting of an outline."
   :type 'boolean
   :group 'allout)
 ;;;_  - allout-label-style
 (defcustom allout-label-style "\\large\\bf"
-  "*Font and size of labels for LaTeX formatting of an outline."
+  "Font and size of labels for LaTeX formatting of an outline."
   :type 'string
   :group 'allout)
 ;;;_  - allout-head-line-style
 (defcustom allout-head-line-style "\\large\\sl "
-  "*Font and size of entries for LaTeX formatting of an outline."
+  "Font and size of entries for LaTeX formatting of an outline."
   :type 'string
   :group 'allout)
 ;;;_  - allout-body-line-style
 (defcustom allout-body-line-style " "
-  "*Font and size of entries for LaTeX formatting of an outline."
+  "Font and size of entries for LaTeX formatting of an outline."
   :type 'string
   :group 'allout)
 ;;;_  - allout-title-style
 (defcustom allout-title-style "\\Large\\bf"
-  "*Font and size of titles for LaTeX formatting of an outline."
+  "Font and size of titles for LaTeX formatting of an outline."
   :type 'string
   :group 'allout)
 ;;;_  - allout-title
 (defcustom allout-title '(or buffer-file-name (buffer-name))
-  "*Expression to be evaluated to determine the title for LaTeX
+  "Expression to be evaluated to determine the title for LaTeX
 formatted copy."
   :type 'sexp
   :group 'allout)
 ;;;_  - allout-line-skip
 (defcustom allout-line-skip ".05cm"
-  "*Space between lines for LaTeX formatting of an outline."
+  "Space between lines for LaTeX formatting of an outline."
   :type 'string
   :group 'allout)
 ;;;_  - allout-indent
 (defcustom allout-indent ".3cm"
-  "*LaTeX formatted depth-indent spacing."
+  "LaTeX formatted depth-indent spacing."
   :type 'string
   :group 'allout)
 
@@ -689,39 +686,39 @@ formatted copy."
   :group 'allout)
 ;;;_  = allout-topic-encryption-bullet
 (defcustom allout-topic-encryption-bullet "~"
-  "*Bullet signifying encryption of the entry's body."
+  "Bullet signifying encryption of the entry's body."
   :type '(choice (const nil) string)
-  :version "22.0"
+  :version "22.1"
   :group 'allout-encryption)
 ;;;_  = allout-passphrase-verifier-handling
 (defcustom allout-passphrase-verifier-handling t
-  "*Enable use of symmetric encryption passphrase verifier if non-nil.
+  "Enable use of symmetric encryption passphrase verifier if non-nil.
 
 See the docstring for the `allout-enable-file-variable-adjustment'
 variable for details about allout ajustment of file variables."
   :type 'boolean
-  :version "22.0"
+  :version "22.1"
   :group 'allout-encryption)
 (make-variable-buffer-local 'allout-passphrase-verifier-handling)
 ;;;_  = allout-passphrase-hint-handling
 (defcustom allout-passphrase-hint-handling 'always
-  "*Dictate outline encryption passphrase reminder handling:
+  "Dictate outline encryption passphrase reminder handling:
 
- always - always show reminder when prompting
- needed - show reminder on passphrase entry failure
- disabled - never present or adjust reminder
+ always -- always show reminder when prompting
+ needed -- show reminder on passphrase entry failure
+ disabled -- never present or adjust reminder
 
 See the docstring for the `allout-enable-file-variable-adjustment'
 variable for details about allout ajustment of file variables."
   :type '(choice (const always)
                  (const needed)
                  (const disabled))
-  :version "22.0"
+  :version "22.1"
   :group 'allout-encryption)
 (make-variable-buffer-local 'allout-passphrase-hint-handling)
 ;;;_  = allout-encrypt-unencrypted-on-saves
 (defcustom allout-encrypt-unencrypted-on-saves t
-  "*When saving, should topics pending encryption be encrypted?
+  "When saving, should topics pending encryption be encrypted?
 
 The idea is to prevent file-system exposure of any un-encrypted stuff, and
 mostly covers both deliberate file writes and auto-saves.
@@ -732,7 +729,7 @@ mostly covers both deliberate file writes and auto-saves.
         can continue editing but the copy on the file system will be
         encrypted.)
         Auto-saves will use the \"All except current topic\" mode if this
-        one is selected, to avoid practical difficulties - see below.
+        one is selected, to avoid practical difficulties -- see below.
  - All except current topic: skip the topic currently being edited, even if
        it's pending encryption.  This may expose the current topic on the
        file sytem, but avoids the nuisance of prompts for the encryption
@@ -749,7 +746,7 @@ disable auto-saves for that file."
   :type '(choice (const :tag "Yes" t)
                  (const :tag "All except current topic" except-current)
                  (const :tag "No" nil))
-  :version "22.0"
+  :version "22.1"
   :group 'allout-encryption)
 (make-variable-buffer-local 'allout-encrypt-unencrypted-on-saves)
 
@@ -760,7 +757,7 @@ disable auto-saves for that file."
   :group 'allout)
 ;;;_  = allout-run-unit-tests-on-load
 (defcustom allout-run-unit-tests-on-load nil
-  "*When non-nil, unit tests will be run at end of loading the allout module.
+  "When non-nil, unit tests will be run at end of loading the allout module.
 
 Generally, allout code developers are the only ones who'll want to set this.
 
@@ -776,7 +773,7 @@ See `allout-run-unit-tests' to see what's run."
 
 ;;;_  = allout-enable-file-variable-adjustment
 (defcustom allout-enable-file-variable-adjustment t
-  "*If non-nil, some allout outline actions edit Emacs local file var text.
+  "If non-nil, some allout outline actions edit Emacs local file var text.
 
 This can range from changes to existing entries, addition of new ones,
 and creation of a new local variables section when necessary.
@@ -790,7 +787,7 @@ For details, see `allout-toggle-current-subtree-encryption's docstring."
   :group 'allout)
 (make-variable-buffer-local 'allout-enable-file-variable-adjustment)
 
-;;;_* CODE - no user customizations below.
+;;;_* CODE -- no user customizations below.
 
 ;;;_ #1 Internal Outline Formatting and Configuration
 ;;;_  : Version
@@ -810,7 +807,7 @@ For details, see `allout-toggle-current-subtree-encryption's docstring."
 (defvar allout-mode nil "Allout outline mode minor-mode flag.")
 (make-variable-buffer-local 'allout-mode)
 ;;;_   = allout-layout nil
-(defvar allout-layout nil            ; LEAVE GLOBAL VALUE NIL - see docstring.
+(defvar allout-layout nil            ; LEAVE GLOBAL VALUE NIL -- see docstring.
   "Buffer-specific setting for allout layout.
 
 In buffers where this is non-nil (and if `allout-init' has been run, to
@@ -854,7 +851,7 @@ by `set-allout-regexp'.")
 (defvar allout-bullets-string ""
   "A string dictating the valid set of outline topic bullets.
 
-This var should *not* be set by the user - it is set by `set-allout-regexp',
+This var should *not* be set by the user -- it is set by `set-allout-regexp',
 and is produced from the elements of `allout-plain-bullets-string'
 and `allout-distinctive-bullets-string'.")
 (make-variable-buffer-local 'allout-bullets-string)
@@ -886,7 +883,7 @@ topic prefix to be matched.")
 (make-variable-buffer-local 'allout-depth-one-regexp)
 ;;;_   = allout-line-boundary-regexp
 (defvar allout-line-boundary-regexp ()
-  "`allout-regexp' with outline style beginning-of-line anchor.
+  "`allout-regexp' prepended with a newline for the search target.
 
 This is properly set by `set-allout-regexp'.")
 (make-variable-buffer-local 'allout-line-boundary-regexp)
@@ -931,14 +928,14 @@ useful at greater depths, more modest doublecheck limits are more
 suitably economical.")
 ;;;_   X allout-reset-header-lead (header-lead)
 (defun allout-reset-header-lead (header-lead)
-  "*Reset the leading string used to identify topic headers."
+  "Reset the leading string used to identify topic headers."
   (interactive "sNew lead string: ")
   (setq allout-header-prefix header-lead)
   (setq allout-header-subtraction (1- (length allout-header-prefix)))
   (set-allout-regexp))
 ;;;_   X allout-lead-with-comment-string (header-lead)
 (defun allout-lead-with-comment-string (&optional header-lead)
-  "*Set the topic-header leading string to specified string.
+  "Set the topic-header leading string to specified string.
 
 Useful when for encapsulating outline structure in programming
 language comments.  Returns the leading string."
@@ -970,7 +967,7 @@ invoking it directly."
                                          comment-start
                                          t)))
                              allout-use-mode-specific-leader
-                           ;; Oops - garbled value, equate with effect of 't:
+                           ;; Oops -- garbled value, equate with effect of t:
                            t)))
         (leader
          (cond
@@ -998,8 +995,8 @@ invoking it directly."
        nil
       (setq allout-header-prefix leader)
       (if (not allout-old-style-prefixes)
-          ;; setting allout-primary-bullet makes the top level topics use -
-          ;; actually, be - the special prefix:
+          ;; setting allout-primary-bullet makes the top level topics use --
+          ;; actually, be -- the special prefix:
           (setq allout-primary-bullet leader))
       allout-header-prefix)))
 (defalias 'allout-infer-header-lead
@@ -1058,7 +1055,7 @@ Also refresh various data structures that hinge on the regexp."
   (setq allout-plain-bullets-string-len (length allout-plain-bullets-string))
   (setq allout-header-subtraction (1- (length allout-header-prefix)))
 
-  (let (new-part old-part)
+  (let (new-part old-part formfeed-part)
     (setq new-part (concat "\\("
                            (regexp-quote allout-header-prefix)
                            "[ \t]*"
@@ -1072,18 +1069,26 @@ Also refresh various data structures that hinge on the regexp."
                            "\\)"
                            "+"
                            " ?[^" allout-primary-bullet "]")
+          formfeed-part "\\(\^L\\)"
+
           allout-regexp (concat new-part
                                 "\\|"
                                 old-part
-                                "\\|\^l")
+                                "\\|"
+                                formfeed-part)
 
           allout-line-boundary-regexp (concat "\n" new-part
                                               "\\|"
-                                              "\n" old-part)
+                                              "\n" old-part
+                                              "\\|"
+                                              "\n" formfeed-part)
 
           allout-bob-regexp (concat "\\`" new-part
                                     "\\|"
-                                    "\\`" old-part))
+                                    "\\`" old-part
+                                    "\\|"
+                                    "\\`" formfeed-part
+                                    ))
 
     (setq allout-depth-specific-regexp
           (concat "\\(^\\|\\`\\)"
@@ -1140,10 +1145,10 @@ Also refresh various data structures that hinge on the regexp."
 (defvar allout-mode-map nil "Keybindings for (allout) outline minor mode.")
 ;;;_   > produce-allout-mode-map (keymap-alist &optional base-map)
 (defun produce-allout-mode-map (keymap-list &optional base-map)
-  "Produce keymap for use as allout-mode-map, from KEYMAP-LIST.
+  "Produce keymap for use as `allout-mode-map', from KEYMAP-LIST.
 
 Built on top of optional BASE-MAP, or empty sparse map if none specified.
-See doc string for allout-keybindings-list for format of binding list."
+See doc string for `allout-keybindings-list' for format of binding list."
   (let ((map (or base-map (make-sparse-keymap)))
        (pref (list allout-command-prefix)))
     (mapc (function
@@ -1255,7 +1260,7 @@ extended from the existing one by `append'ing a list containing the second
 element of the pair onto the end of the existing value.
 
 Extension, and resumptions in general, should not be used for hook
-functions - use the 'local mode of `add-hook' for that, instead.
+functions -- use the 'local mode of `add-hook' for that, instead.
 
 The settings are stored on `allout-mode-prior-settings'."
   (while pairs
@@ -1274,7 +1279,7 @@ The settings are stored on `allout-mode-prior-settings'."
       (when (not (assoc name allout-mode-prior-settings))
         ;; Not already added as a resumption, create the prior setting entry.
         (if (local-variable-p name)
-            ;; is already local variable - preserve the prior value:
+            ;; is already local variable -- preserve the prior value:
             (push (list name prior-value) allout-mode-prior-settings)
           ;; wasn't local variable, indicate so for resumption by killing
           ;; local value, and make it local:
@@ -1340,9 +1345,9 @@ It is run at the conclusion of `allout-flag-region'.
 
 Functions on the hook must take three arguments:
 
- - from - integer indicating the point at the start of the change.
- - to - integer indicating the point of the end of the change.
- - flag - change mode: nil for exposure, otherwise concealment.
+ - FROM -- integer indicating the point at the start of the change.
+ - TO -- integer indicating the point of the end of the change.
+ - FLAG -- change mode: nil for exposure, otherwise concealment.
 
 This hook might be invoked multiple times by a single command.
 
@@ -1354,10 +1359,10 @@ and eventually will not be invoked.")
 
 Functions on the hook should take two arguments:
 
- - new-start - integer indicating the point at the start of the first new item.
- - new-end - integer indicating the point of the end of the last new item.
+ - NEW-START -- integer indicating position of start of the first new item.
+ - NEW-END -- integer indicating position of end of the last new item.
 
-Some edits that introduce new items may missed by this hook -
+Some edits that introduce new items may missed by this hook:
 specifically edits that native allout routines do not control.
 
 This hook might be invoked multiple times by a single command.")
@@ -1367,10 +1372,10 @@ This hook might be invoked multiple times by a single command.")
 
 Functions on the hook must take two arguments:
 
- - depth - integer indicating the depth of the subtree that was deleted.
- - removed-from - integer indicating the point where the subtree was removed.
+ - DEPTH -- integer indicating the depth of the subtree that was deleted.
+ - REMOVED-FROM -- integer indicating the point where the subtree was removed.
 
-Some edits that remove or invalidate items may missed by this hook -
+Some edits that remove or invalidate items may missed by this hook:
 specifically edits that native allout routines do not control.
 
 This hook might be invoked multiple times by a single command.")
@@ -1380,10 +1385,10 @@ This hook might be invoked multiple times by a single command.")
 
 Functions on the hook should take two arguments:
 
- - depth-change - integer indicating depth increase, negative for decrease
- - start - integer indicating the start point of the shifted parent item.
+ - DEPTH-CHANGE -- integer indicating depth increase, negative for decrease
+ - START -- integer indicating the start point of the shifted parent item.
 
-Some edits that shift items can be missed by this hook - specifically edits
+Some edits that shift items can be missed by this hook: specifically edits
 that native allout routines do not control.
 
 This hook might be invoked multiple times by a single command.")
@@ -1460,7 +1465,7 @@ substition is used against the regexp matches, a la `replace-match'.")
   "Variable for regexps matching plaintext to remove before encryption.
 
 This is for the sake of redoing encryption in cases where the ciphertext
-incidentally contains strings that would disrupt mode operation -
+incidentally contains strings that would disrupt mode operation --
 for example, a line that happens to look like an allout-mode topic prefix.
 
 Entries must be symbols that are bound to the desired regexp values.
@@ -1478,7 +1483,7 @@ See `allout-encryption-ciphertext-rejection-regexps' for rejection reasons.")
 (make-variable-buffer-local 'allout-encryption-ciphertext-rejection-ceiling)
 ;;;_   > allout-mode-p ()
 ;; Must define this macro above any uses, or byte compilation will lack
-;; proper def, if file isn't loaded - eg, during emacs build!
+;; proper def, if file isn't loaded -- eg, during emacs build!
 (defmacro allout-mode-p ()
   "Return t if `allout-mode' is active in current buffer."
   'allout-mode)
@@ -1501,13 +1506,12 @@ See `allout-encryption-ciphertext-rejection-regexps' for rejection reasons.")
             (condition-case failure
                 (setq allout-after-save-decrypt
                       (allout-encrypt-decrypted except-mark))
-              (error (progn
-                       (message
-                        "allout-write-file-hook-handler suppressing error %s"
-                        failure)
-                       (sit-for 2))))))
+              (error (message
+                      "allout-write-file-hook-handler suppressing error %s"
+                      failure)
+                     (sit-for 2)))))
       ))
-    nil)
+  nil)
 ;;;_   > allout-auto-save-hook-handler ()
 (defun allout-auto-save-hook-handler ()
   "Implement `allout-encrypt-unencrypted-on-saves' policy for auto save."
@@ -1586,7 +1590,7 @@ the following two lines in your Emacs init file:
 \(allout-init t)"
 
   (interactive)
-  (if (interactive-p)
+  (if (called-interactively-p 'interactive)
       (progn
        (setq mode
              (completing-read
@@ -1610,7 +1614,7 @@ the following two lines in your Emacs init file:
     (cond ((not mode)
           (set find-file-hook-var-name
                 (delq hook (symbol-value find-file-hook-var-name)))
-          (if (interactive-p)
+          (if (called-interactively-p 'interactive)
               (message "Allout outline mode auto-activation inhibited.")))
          ((eq mode 'report)
           (if (not (memq hook (symbol-value find-file-hook-var-name)))
@@ -1653,11 +1657,11 @@ the following two lines in your Emacs init file:
   (put 'allout-exposure-category 'invisible 'allout)
   (put 'allout-exposure-category 'evaporate t)
   ;; XXX We use isearch-open-invisible *and* isearch-mode-end-hook.  The
-  ;; latter would be sufficient, but it seems that a separate behavior -
-  ;; the _transient_ opening of invisible text during isearch - is keyed to
-  ;; presence of the isearch-open-invisible property - even though this
+  ;; latter would be sufficient, but it seems that a separate behavior --
+  ;; the _transient_ opening of invisible text during isearch -- is keyed to
+  ;; presence of the isearch-open-invisible property -- even though this
   ;; property controls the isearch _arrival_ behavior.  This is the case at
-  ;; least in emacs 21, 22.0, and xemacs 21.4.
+  ;; least in emacs 21, 22.1, and xemacs 21.4.
   (put 'allout-exposure-category 'isearch-open-invisible
        'allout-isearch-end-handler)
   (if (featurep 'xemacs)
@@ -1709,7 +1713,7 @@ variable.  We recommend customizing `allout-command-prefix' to use just
 `\\C-c' as the command prefix, if the allout bindings don't conflict with
 any personal bindings you have on \\C-c.  In any case, outline structure
 navigation and authoring is simplified by positioning the cursor on an
-item's bullet character, the \"hot-spot\" - then you can invoke allout
+item's bullet character, the \"hot-spot\" -- then you can invoke allout
 commands with just the un-prefixed, un-control-shifted command letters.
 This is described further in the HOT-SPOT Operation section.
 
@@ -1730,7 +1734,7 @@ This is described further in the HOT-SPOT Operation section.
 \\[allout-backward-current-level] `allout-backward-current-level'
 \\[allout-end-of-entry] `allout-end-of-entry'
 \\[allout-beginning-of-current-entry] `allout-beginning-of-current-entry' (alternately, goes to hot-spot)
-\\[allout-beginning-of-line]  `allout-beginning-of-line' - like regular beginning-of-line, but
+\\[allout-beginning-of-line]  `allout-beginning-of-line' -- like regular beginning-of-line, but
      if immediately repeated cycles to the beginning of the current item
      and then to the hot-spot (if `allout-beginning-of-line-cycles' is set).
 
@@ -1748,9 +1752,9 @@ This is described further in the HOT-SPOT Operation section.
 \\[allout-rebullet-current-heading] `allout-rebullet-current-heading' Prompt for alternate bullet for
             current topic
 \\[allout-rebullet-topic] `allout-rebullet-topic'   Reconcile bullets of topic and
-            its' offspring - distinctive bullets are not changed, others
+            its' offspring -- distinctive bullets are not changed, others
             are alternated according to nesting depth.
-\\[allout-number-siblings] `allout-number-siblings'  Number bullets of topic and siblings -
+\\[allout-number-siblings] `allout-number-siblings'  Number bullets of topic and siblings --
            the offspring are not affected.
            With repeat count, revoke numbering.
 
@@ -1779,7 +1783,7 @@ M-x outlineify-sticky       Activate outline mode for current buffer,
 \\[allout-copy-exposed-to-buffer] `allout-copy-exposed-to-buffer'
                             Duplicate outline, sans concealed text, to
                             buffer with name derived from derived from that
-                            of current buffer - \"*BUFFERNAME exposed*\".
+                            of current buffer -- \"*BUFFERNAME exposed*\".
 \\[allout-flatten-exposed-to-buffer] `allout-flatten-exposed-to-buffer'
                             Like above 'copy-exposed', but convert topic
                             prefixes to section.subsection... numeric
@@ -1825,7 +1829,7 @@ single keystroke.  Regular navigation keys (eg, \\[forward-char], \\[next-line])
 this special translation, so you can use them to get out of the
 hot-spot and back to normal editing operation.
 
-In allout-mode, the normal beginning-of-line command (\\[allout-beginning-of-line]]) is
+In allout-mode, the normal beginning-of-line command (\\[allout-beginning-of-line]) is
 replaced with one that makes it easy to get to the hot-spot.  If you
 repeat it immediately it cycles (if `allout-beginning-of-line-cycles'
 is set) to the beginning of the item and then, if you hit it again
@@ -1848,7 +1852,7 @@ without changes to the allout core.  Here are key ones:
 
                             Terminology
 
-Topic hierarchy constituents - TOPICS and SUBTOPICS:
+Topic hierarchy constituents -- TOPICS and SUBTOPICS:
 
 ITEM:   A unitary outline element, including the HEADER and ENTRY text.
 TOPIC:  An ITEM and any ITEMs contained within it, ie having greater DEPTH
@@ -1956,7 +1960,7 @@ OPEN:     A TOPIC that is not CLOSED, though its OFFSPRING or BODY may be."
 
     (cond
 
-     ;; Provision for v19.18, 19.19 bug -
+     ;; Provision for v19.18, 19.19 bug --
      ;; Emacs v 19.18, 19.19 file-var code invokes prop-line-designated
      ;; modes twice when file is visited.  We have to avoid toggling mode
      ;; off on second invocation, so we detect it as best we can, and
@@ -2101,7 +2105,7 @@ OPEN:     A TOPIC that is not CLOSED, though its OFFSPRING or BODY may be."
                 (progn
                   (apply 'allout-expose-topic (list use-layout))
                   (message "Adjusting '%s' exposure... done." (buffer-name)))
-              ;; Problem applying exposure - notify user, but don't
+              ;; Problem applying exposure -- notify user, but don't
               ;; interrupt, eg, file visit:
               (error (message "%s" (car (cdr err)))
                      (sit-for 1))))))
@@ -2136,6 +2140,16 @@ OPEN:    A TOPIC that is not CLOSED, though its OFFSPRING or BODY may be."
 ;;;_  > allout-minor-mode
 (defalias 'allout-minor-mode 'allout-mode)
 
+;;;_  > allout-unload-function
+(defun allout-unload-function ()
+  "Unload the allout outline library."
+  (save-current-buffer
+    (dolist (buffer (buffer-list))
+      (set-buffer buffer)
+      (when allout-mode (allout-mode -1))))
+  ;; continue standard unloading
+  nil)
+
 ;;;_  - Position Assessment
 ;;;_   > allout-hidden-p (&optional pos)
 (defsubst allout-hidden-p (&optional pos)
@@ -2158,10 +2172,10 @@ OPEN:   A TOPIC that is not CLOSED, though its OFFSPRING or BODY may be."
   "Get confirmation before making arbitrary changes to invisible text.
 
 We expose the invisible text and ask for confirmation.  Refusal or
-keyboard-quit abandons the changes, with keyboard-quit additionally
+`keyboard-quit' abandons the changes, with keyboard-quit additionally
 reclosing the opened text.
 
-No confirmation is necessary when inhibit-read-only is set - eg, allout
+No confirmation is necessary when `inhibit-read-only' is set -- eg, allout
 internal functions use this feature cohesively bunch changes."
 
   (when (and (not inhibit-read-only) (not after))
@@ -2190,16 +2204,16 @@ internal functions use this feature cohesively bunch changes."
                    (concat "Modify concealed text?  (\"no\" just aborts,"
                            " \\[keyboard-quit] also reconceals) "))))
                 (progn (goto-char start)
-                       (error "Concealed-text change refused.")))
+                       (error "Concealed-text change refused")))
           (quit (allout-flag-region ol-start ol-end nil)
                 (allout-flag-region ol-start ol-end t)
-                (error "Concealed-text change abandoned, text reconcealed."))))
+                (error "Concealed-text change abandoned, text reconcealed"))))
       (goto-char start))))
 ;;;_  > allout-before-change-handler (beg end)
 (defun allout-before-change-handler (beg end)
   "Protect against changes to invisible text.
 
-See allout-overlay-interior-modification-handler for details."
+See `allout-overlay-interior-modification-handler' for details."
 
   (if (and (allout-mode-p) undo-in-progress (allout-hidden-p))
       (allout-show-to-offshoot))
@@ -2224,7 +2238,7 @@ function can also be used as an `isearch-mode-end-hook'."
   (if (and (allout-mode-p) (allout-hidden-p))
       (allout-show-to-offshoot)))
 
-;;;_ #3 Internal Position State-Tracking - "allout-recent-*" funcs
+;;;_ #3 Internal Position State-Tracking -- "allout-recent-*" funcs
 ;;; All the basic outline functions that directly do string matches to
 ;;; evaluate heading prefix location set the variables
 ;;; `allout-recent-prefix-beginning'  and `allout-recent-prefix-end'
@@ -2252,10 +2266,12 @@ function can also be used as an `isearch-mode-end-hook'."
 (defsubst allout-prefix-data ()
   "Register allout-prefix state data.
 
-For reference by `allout-recent' funcs.  Returns BEGINNING."
-  (setq allout-recent-prefix-end (or (match-end 1) (match-end 2))
+For reference by `allout-recent' funcs.  Return
+the new value of `allout-recent-prefix-beginning'."
+  (setq allout-recent-prefix-end (or (match-end 1) (match-end 2) (match-end 3))
         allout-recent-prefix-beginning (or (match-beginning 1)
-                                           (match-beginning 2))
+                                           (match-beginning 2)
+                                           (match-beginning 3))
         allout-recent-depth (max 1 (- allout-recent-prefix-end
                                       allout-recent-prefix-beginning
                                       allout-header-subtraction)))
@@ -2306,7 +2322,7 @@ to return the current depth of the most recently matched topic."
 (defsubst allout-do-doublecheck ()
   "True if current item conditions qualify for checking on topic aberrance."
   (and
-   ;; presume integrity of outline and yanked content during yank - necessary,
+   ;; presume integrity of outline and yanked content during yank -- necessary
    ;; to allow for level disparity of yank location and yanked text:
    (not allout-inhibit-aberrance-doublecheck)
    ;; allout-doublecheck-at-and-shallower is ceiling for doublecheck:
@@ -2344,12 +2360,12 @@ exceeds the topic by more than one."
           (allout-prefix-data)
           (goto-char allout-recent-prefix-beginning)
           (cond
-           ;; sibling - continue:
+           ;; sibling -- continue:
            ((eq allout-recent-depth depth))
-           ;; first offspring is excessive - aberrant:
+           ;; first offspring is excessive -- aberrant:
            ((> allout-recent-depth (1+ depth))
             (setq done t aberrant t))
-           ;; next non-sibling is lower-depth - not aberrant:
+           ;; next non-sibling is lower-depth -- not aberrant:
            (t (setq done t))))))
     (if aberrant
         aberrant
@@ -2384,6 +2400,8 @@ Actually, returns prefix beginning point."
 (defun allout-depth ()
   "Return depth of topic most immediately containing point.
 
+Does not do doublecheck for aberrant topic header.
+
 Return zero if point is not within any topic.
 
 Like `allout-current-depth', but respects hidden as well as visible topics."
@@ -2490,7 +2508,7 @@ Outermost is first."
 ;;;_   > allout-end-of-current-line ()
 (defun allout-end-of-current-line ()
   "Move to the end of line, past concealed text if any."
-  ;; XXX This is for symmetry with `allout-beginning-of-current-line' -
+  ;; XXX This is for symmetry with `allout-beginning-of-current-line' --
   ;; `move-end-of-line' doesn't suffer the same problem as
   ;; `move-beginning-of-line'.
   (let ((inhibit-field-text-motion t))
@@ -2564,7 +2582,7 @@ Outermost is first."
 
 Returns the location of the heading, or nil if none found.
 
-We skip anomolous low-level topics, a la `allout-aberrant-container-p'."
+We skip anomalous low-level topics, a la `allout-aberrant-container-p'."
   (save-match-data
 
     (if (looking-at allout-regexp)
@@ -2572,10 +2590,14 @@ We skip anomolous low-level topics, a la `allout-aberrant-container-p'."
 
     (when (re-search-forward allout-line-boundary-regexp nil 0)
       (allout-prefix-data)
+      (goto-char allout-recent-prefix-beginning)
+      (while (not (bolp))
+        (forward-char -1))
       (and (allout-do-doublecheck)
            ;; this will set allout-recent-* on the first non-aberrant topic,
            ;; whether it's the current one or one that disqualifies it:
            (allout-aberrant-container-p))
+      ;; this may or may not be the same as above depending on doublecheck:
       (goto-char allout-recent-prefix-beginning))))
 ;;;_   > allout-this-or-next-heading
 (defun allout-this-or-next-heading ()
@@ -2589,7 +2611,7 @@ We skip anomolous low-level topics, a la `allout-aberrant-container-p'."
 
 Return the location of the beginning of the heading, or nil if not found.
 
-We skip anomolous low-level topics, a la `allout-aberrant-container-p'."
+We skip anomalous low-level topics, a la `allout-aberrant-container-p'."
 
   (if (bobp)
       nil
@@ -2687,9 +2709,9 @@ starting point, and PREV-DEPTH is depth of prior topic."
                       ;; Register this one and move on:
                       (setq chart (cons allout-recent-prefix-beginning chart))
                       (if (and levels (<= levels 1))
-                          ;; At depth limit - skip sublevels:
+                          ;; At depth limit -- skip sublevels:
                           (or (allout-next-sibling curr-depth)
-                              ;; or no more siblings - proceed to
+                              ;; or no more siblings -- proceed to
                               ;; next heading at lesser depth:
                               (while (and (<= curr-depth
                                               allout-recent-depth)
@@ -2762,7 +2784,7 @@ start point."
          (let ((further (allout-chart-to-reveal here (if (null depth)
                                                           depth
                                                         (1- depth)))))
-           ;; We're on the start of a subtree - recurse with it, if there's
+           ;; We're on the start of a subtree -- recurse with it, if there's
            ;; more depth to go:
            (if further (setq result (append further result)))
            (setq chart (cdr chart)))
@@ -2879,7 +2901,7 @@ of (before any) topics, in which case we return nil."
   (let ((bol-point (point)))
     (if (allout-goto-prefix-doublechecked)
         (if (<= (point) bol-point)
-            (if (interactive-p)
+            (if (called-interactively-p 'interactive)
                 (allout-end-of-prefix)
               (point))
           (goto-char (point-min))
@@ -2946,7 +2968,7 @@ If already there, move cursor to bullet for hot-spot operation.
         (goto-char allout-recent-prefix-end)
       (goto-char (point-min)))
     (allout-end-of-prefix)
-    (if (and (interactive-p)
+    (if (and (called-interactively-p 'interactive)
             (= (point) start-point))
        (goto-char (allout-current-bullet-pos)))))
 ;;;_   > allout-end-of-entry (&optional inclusive)
@@ -2996,7 +3018,7 @@ collapsed."
         (while (and (< depth allout-recent-depth)
                     (setq last-ascended (allout-ascend))))
         (goto-char allout-recent-prefix-beginning)
-        (if (interactive-p) (allout-end-of-prefix))
+        (if (called-interactively-p 'interactive) (allout-end-of-prefix))
         (and last-ascended allout-recent-depth))))
 ;;;_   > allout-ascend ()
 (defun allout-ascend (&optional dont-move-if-unsuccessful)
@@ -3024,7 +3046,7 @@ which case point is returned to its original starting location."
                    (goto-char bolevel)
                    (allout-depth)
                    nil))))
-    (if (interactive-p) (allout-end-of-prefix))))
+    (if (called-interactively-p 'interactive) (allout-end-of-prefix))))
 ;;;_   > allout-descend-to-depth (depth)
 (defun allout-descend-to-depth (depth)
   "Descend to depth DEPTH within current topic.
@@ -3052,7 +3074,7 @@ Returning depth if successful, nil if not."
     (if (not (allout-ascend))
         (progn (goto-char start-point)
                (error "Can't ascend past outermost level"))
-      (if (interactive-p) (allout-end-of-prefix))
+      (if (called-interactively-p 'interactive) (allout-end-of-prefix))
       allout-recent-prefix-beginning)))
 
 ;;;_  - Linear
@@ -3150,7 +3172,7 @@ situation."
           (progn (goto-char start-point)
                  nil)
         ;; rationale: if any intervening items were at a lower depth, we
-        ;; would now be on the first offspring at the target depth - ie,
+        ;; would now be on the first offspring at the target depth -- ie,
         ;; the preceeding item (per the search direction) must be at a
         ;; lesser depth.  that's all we need to check.
         (if backward (allout-next-heading) (allout-previous-heading))
@@ -3197,7 +3219,7 @@ Presumes point is at the start of a topic prefix."
   (let ((depth (allout-depth)))
     (while (allout-previous-sibling depth nil))
     (prog1 allout-recent-depth
-      (if (interactive-p) (allout-end-of-prefix)))))
+      (if (called-interactively-p 'interactive) (allout-end-of-prefix)))))
 ;;;_   > allout-next-visible-heading (arg)
 (defun allout-next-visible-heading (arg)
   "Move to the next ARG'th visible heading line, backward if arg is negative.
@@ -3228,7 +3250,7 @@ Move to buffer limit in indicated direction if headings are exhausted."
                            (allout-aberrant-container-p))
                       ;; skip this aberrant prospective header line:
                       t
-                    ;; this prospective headerline qualifies - register:
+                    ;; this prospective headerline qualifies -- register:
                     (setq got allout-recent-prefix-beginning)
                     ;; and break the loop:
                     nil)))))
@@ -3250,7 +3272,7 @@ A heading line is one that starts with a `*' (or that `allout-regexp'
 matches)."
   (interactive "p")
   (prog1 (allout-next-visible-heading (- arg))
-    (if (interactive-p) (allout-end-of-prefix))))
+    (if (called-interactively-p 'interactive) (allout-end-of-prefix))))
 ;;;_   > allout-forward-current-level (arg)
 (defun allout-forward-current-level (arg)
   "Position point at the next heading of the same level.
@@ -3271,7 +3293,7 @@ Returns resulting position, else nil if none found."
                     (allout-previous-sibling)
                   (allout-next-sibling)))
       (setq arg (1- arg)))
-    (if (not (interactive-p))
+    (if (not (called-interactively-p 'interactive))
         nil
       (allout-end-of-prefix)
       (if (not (zerop arg))
@@ -3284,7 +3306,7 @@ Returns resulting position, else nil if none found."
 (defun allout-backward-current-level (arg)
   "Inverse of `allout-forward-current-level'."
   (interactive "p")
-  (if (interactive-p)
+  (if (called-interactively-p 'interactive)
       (let ((current-prefix-arg (* -1 arg)))
        (call-interactively 'allout-forward-current-level))
     (allout-forward-current-level (* -1 arg))))
@@ -3369,13 +3391,13 @@ this-command accordingly.
 
 Returns the qualifying command, if any, else nil."
   (interactive)
-  (let* ((key-string (if (numberp last-command-char)
-                         (char-to-string last-command-char)))
-         (key-num (cond ((numberp last-command-char) last-command-char)
+  (let* ((key-string (if (numberp last-command-event)
+                         (char-to-string last-command-event)))
+         (key-num (cond ((numberp last-command-event) last-command-event)
                         ;; for XEmacs character type:
                         ((and (fboundp 'characterp)
-                              (apply 'characterp (list last-command-char)))
-                         (apply 'char-to-int (list last-command-char)))
+                              (apply 'characterp (list last-command-event)))
+                         (apply 'char-to-int (list last-command-event)))
                         (t 0)))
          mapped-binding)
 
@@ -3396,7 +3418,7 @@ Returns the qualifying command, if any, else nil."
                                                     (>= 122 key-num)) ; "z"
                                                (- key-num 96) key-num)))
                                   t))))
-          ;; Qualified as an allout command - do hot-spot operation.
+          ;; Qualified as an allout command -- do hot-spot operation.
           (setq allout-post-goto-bullet t)
         ;; accept-defaults nil, or else we'll get allout-item-icon-key-handler.
         (setq mapped-binding (key-binding (char-to-string key-num))))
@@ -3498,7 +3520,7 @@ Second arg NEW indicates that a new topic is being opened after the
 topic at point, if non-nil.  Default bullet for new topics, eg, may
 be set (contingent to other args) to numbered bullets if previous
 sibling is one.  The implication otherwise is that the current topic
-is being adjusted - shifted or rebulleted - and we don't consider
+is being adjusted -- shifted or rebulleted -- and we don't consider
 bullet or previous sibling.
 
 Third arg DEPTH forces the topic prefix to that depth, regardless of
@@ -3544,11 +3566,11 @@ index for each successive sibling)."
           ;; Getting value for bullet char is practically the whole job:
 
           (cond
-                                        ; Simplest situation - level 1:
+                                        ; Simplest situation -- level 1:
            ((<= depth 1) (setq header-lead "") allout-primary-bullet)
                                         ; Simple, too: all asterisks:
            (allout-old-style-prefixes
-            ;; Cheat - make body the whole thing, null out header-lead and
+            ;; Cheat -- make body the whole thing, null out header-lead and
             ;; bullet-char:
             (setq body (make-string depth
                                     (string-to-char allout-primary-bullet)))
@@ -3626,8 +3648,8 @@ index for each successive sibling)."
   "Open a new topic at depth DEPTH.
 
 New topic is situated after current one, unless optional flag BEFORE
-is non-nil, or unless current line is completely empty - lacking even
-whitespace - in which case open is done on the current line.
+is non-nil, or unless current line is completely empty -- lacking even
+whitespace -- in which case open is done on the current line.
 
 When adding an offspring, it will be added immediately after the parent if
 the other offspring are exposed, or after the last child if the offspring
@@ -3692,7 +3714,7 @@ Nuances:
 
       (if (not opening-on-blank)
                                         ; Positioning and vertical
-                                        ; padding - only if not
+                                        ; padding -- only if not
                                         ; opening-on-blank:
           (progn
             (goto-char ref-topic)
@@ -3743,7 +3765,7 @@ Nuances:
                                  (open-line 1)))
                     (allout-end-of-current-subtree)
                     (if (looking-at "\n\n") (forward-char 1))))
-              ;; Going inwards - double-space if first offspring is
+              ;; Going inwards -- double-space if first offspring is
               ;; double-spaced, otherwise snug up.
               (allout-end-of-entry)
               (if (eobp)
@@ -3753,7 +3775,7 @@ Nuances:
               (backward-char 1)
               (if (bolp)
                   ;; Blank lines between current header body and next
-                  ;; header - get to last substantive (non-white-space)
+                  ;; header -- get to last substantive (non-white-space)
                   ;; line in body:
                   (progn (setq dbl-space t)
                          (re-search-backward "[^ \t\n]" nil t)))
@@ -3900,9 +3922,9 @@ Note that refill of indented paragraphs is not done."
                  (not (looking-at allout-regexp)))
           (if (> 0 (setq excess (- (- old-indent-end old-indent-begin)
                                     old-margin)))
-              ;; Text starts left of old margin - don't adjust:
+              ;; Text starts left of old margin -- don't adjust:
               nil
-            ;; Text was hanging at or right of old left margin -
+            ;; Text was hanging at or right of old left margin --
             ;; reindent it, preserving its existing indentation
             ;; beyond the old margin:
             (delete-region old-indent-begin old-indent-end)
@@ -3963,9 +3985,9 @@ Third arg NUMBER-CONTROL can force the prefix to or away from
 numbered form.  It has effect only if `allout-numbered-bullet' is
 non-nil and soliciting was not explicitly invoked (via first arg).
 Its effect, numbering or denumbering, then depends on the setting
-of the forth arg, INDEX.
+of the fourth arg, INDEX.
 
-If NUMBER-CONTROL is non-nil and forth arg INDEX is nil, then the
+If NUMBER-CONTROL is non-nil and fourth arg INDEX is nil, then the
 prefix of the topic is forced to be non-numbered.  Null index and
 non-nil NUMBER-CONTROL forces denumbering.  Non-nil INDEX (and
 non-nil NUMBER-CONTROL) forces a numbered-prefix form.  If non-nil
@@ -4050,7 +4072,7 @@ this function."
 
 Descends into invisible as well as visible topics, however.
 
-When optional sans-offspring is non-nil, subtopics are not
+When optional SANS-OFFSPRING is non-nil, subtopics are not
 shifted.  (Shifting a topic outwards without shifting its
 offspring is disallowed, since this would create a \"containment
 discontinuity\", where the depth difference between a topic and
@@ -4095,7 +4117,7 @@ Finally, if optional SANS-OFFSPRING is non-nil then the offspring
 are not shifted.  (Shifting a topic outwards without shifting
 its offspring is disallowed, since this would create a
 \"containment discontinuity\", where the depth difference between
-a topic and its immediate offspring is greater than one..)"
+a topic and its immediate offspring is greater than one.)"
 
   ;; XXX the recursion here is peculiar, and in general the routine may
   ;; need simplification with refactoring.
@@ -4160,7 +4182,7 @@ a topic and its immediate offspring is greater than one..)"
                                         nil)))) ;;; do-successors
 
           ((< starting-depth new-depth)
-           ;; Rare case - subtopic more than one level deeper than parent.
+           ;; Rare case -- subtopic more than one level deeper than parent.
            ;; Treat this one at an even deeper level:
            (allout-rebullet-topic-grunt relative-depth
                                          new-depth
@@ -4222,7 +4244,7 @@ Returns final depth."
 (defun allout-number-siblings (&optional denumber)
   "Assign numbered topic prefix to this topic and its siblings.
 
-With universal argument, denumber - assign default bullet to this
+With universal argument, denumber -- assign default bullet to this
 topic and its siblings.
 
 With repeated universal argument (`^U^U'), solicit bullet for each
@@ -4381,7 +4403,7 @@ Trailing whitespace is killed with a topic if that whitespace:
    previous one.
 
 Topic exposure is marked with text-properties, to be used by
-allout-yank-processing for exposure recovery."
+`allout-yank-processing' for exposure recovery."
 
   (interactive)
   (let* ((inhibit-field-text-motion t)
@@ -4412,7 +4434,7 @@ allout-yank-processing for exposure recovery."
     (run-hook-with-args 'allout-structure-deleted-hook depth (point))))
 ;;;_    > allout-copy-topic-as-kill ()
 (defun allout-copy-topic-as-kill ()
-  "Like allout-kill-topic, but save to kill ring instead of deleting."
+  "Like `allout-kill-topic', but save to kill ring instead of deleting."
   (interactive)
   (let ((buffer-read-only t))
     (condition-case nil
@@ -4437,7 +4459,7 @@ allout-yank-processing for exposure recovery."
                                                            'invisible
                                                            nil end))))
           (if (or (not next) (eq prev next))
-              ;; still not at start of hidden area - must not be any left.
+              ;; still not at start of hidden area -- must not be any left.
               (setq done t)
             (goto-char next)
             (setq prev next)
@@ -4478,7 +4500,7 @@ allout-yank-processing for exposure recovery."
                                                          'allout-was-hidden
                                                          nil end)))
         (if (or (not next) (eq prev next))
-            ;; no more or not advancing - must not be any left.
+            ;; no more or not advancing -- must not be any left.
             (setq done t)
           (goto-char next)
           (setq prev next)
@@ -4533,10 +4555,9 @@ however, are left exactly like normal, non-allout-specific yanks."
            ;; `rectify-numbering' if resituating (where several topics may
            ;; be resituating) or yanking a topic into a topic slot (bol):
            (rectify-numbering (or resituate
-                                  (and into-bol
-                                       (looking-at allout-regexp)))))
+                                  (and into-bol (looking-at allout-regexp)))))
       (if resituate
-          ;; Yanking a topic into the start of a topic - reconcile to fit:
+          ;; Yanking a topic into the start of a topic -- reconcile to fit:
           (let* ((inhibit-field-text-motion t)
                  (prefix-len (if (not (match-end 1))
                                  1
@@ -4676,7 +4697,7 @@ works with normal `yank' in non-outline buffers."
 
 Adapts level of popped topics to level of fresh prefix.
 
-Note - prefix changes to distinctive bullets will stick, if followed
+Note -- prefix changes to distinctive bullets will stick, if followed
 by pops to non-distinctive yanks.  Bug..."
 
   (interactive "*p")
@@ -4695,7 +4716,7 @@ by pops to non-distinctive yanks.  Bug..."
   (interactive)
   (if (not allout-file-xref-bullet)
       (error
-       "Outline cross references disabled - no `allout-file-xref-bullet'")
+       "Outline cross references disabled -- no `allout-file-xref-bullet'")
     (if (not (string= (allout-current-bullet) allout-file-xref-bullet))
         (error "Current heading lacks cross-reference bullet `%s'"
                allout-file-xref-bullet)
@@ -4824,7 +4845,7 @@ point of non-opened subtree?)"
                  (to-reveal (or (allout-chart-to-reveal chart chart-level)
                                 ;; interactive, show discontinuous children:
                                 (and chart
-                                     (interactive-p)
+                                     (called-interactively-p 'interactive)
                                      (save-excursion
                                        (allout-back-to-current-heading)
                                        (setq depth (allout-current-depth))
@@ -4919,16 +4940,16 @@ Useful for coherently exposing to a random point in a hidden region."
       )))
 ;;;_   > allout-show-current-subtree (&optional arg)
 (defun allout-show-current-subtree (&optional arg)
-  "Show everything within the current topic.  With a repeat-count,
-expose this topic and its siblings."
+  "Show everything within the current topic.
+With a repeat-count, expose this topic and its siblings."
   (interactive "P")
   (save-excursion
     (if (<= (allout-current-depth) 0)
-       ;; Outside any topics - try to get to the first:
+       ;; Outside any topics -- try to get to the first:
        (if (not (allout-next-heading))
            (error "No topics")
-         ;; got to first, outermost topic - set to expose it and siblings:
-         (message "Above outermost topic - exposing all.")
+         ;; got to first, outermost topic -- set to expose it and siblings:
+         (message "Above outermost topic -- exposing all.")
          (allout-flag-region (point-min)(point-max) nil))
       (allout-beginning-of-current-line)
       (if (not arg)
@@ -4966,7 +4987,7 @@ siblings, even if the target topic is already closed."
 
   (interactive)
   (let* ((from (point))
-         (sibs-msg "Top-level topic already closed - closing siblings...")
+         (sibs-msg "Top-level topic already closed -- closing siblings...")
          (current-exposed (not (allout-current-topic-collapsed-p t))))
     (cond (current-exposed (allout-flag-current-subtree t))
           (just-close nil)
@@ -5065,13 +5086,13 @@ Simple (numeric and null-list) specs are interpreted as follows:
        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 offspring.
+     - 0 means to close topic -- hide all offspring.
   :  - `repeat'
        apply prior element to all siblings at 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 the last
        ones.  (Only first of multiple colons at same level is
-       respected - subsequent ones are discarded.)
+       respected -- subsequent ones are discarded.)
   *  - completely opens the topic, including bodies.
   +  - shows all the sub headers, but not the bodies
   -  - exposes the body of the corresponding topic.
@@ -5119,11 +5140,11 @@ Examples:
                 ;; Expand the `repeat' spec to an explicit version,
                 ;; w.r.t. remaining siblings:
                 (let ((residue    ; = # of sibs not covered by remaining spec
-                       ;; Dang - could be nice to make use of the chart, sigh:
+                       ;; Dang, could be nice to make use of the chart, sigh:
                        (- (length (allout-chart-siblings))
                           (length spec))))
                   (if (< 0 residue)
-                      ;; Some residue - cover it with prev-elem:
+                      ;; Some residue -- cover it with prev-elem:
                       (setq spec (append (make-list residue prev-elem)
                                          spec)))))))
         ((numberp curr-elem)
@@ -5257,7 +5278,7 @@ Examples:
             (error "allout-new-exposure: Can't find any outline topics"))
        (list 'allout-expose-topic (list 'quote spec))))
 
-;;;_ #7 Systematic outline presentation - copying, printing, flattening
+;;;_ #7 Systematic outline presentation -- copying, printing, flattening
 
 ;;;_  - Mapping and processing of topics
 ;;;_   ( See also Subtree Charting, in Navigation code.)
@@ -5345,12 +5366,12 @@ the subject region.
 
 Optional START and END indicate bounds of region.
 
-optional arg, FORMAT, designates an alternate presentation form for
+Optional arg, FORMAT, designates an alternate presentation form for
 the prefix:
 
- list - Present prefix as numeric section.subsection..., starting with
+ list -- Present prefix as numeric section.subsection..., starting with
        section indicated by the list, innermost nesting first.
- `indent' (symbol) -  Convert header prefixes to all white space,
+ `indent' (symbol) --  Convert header prefixes to all white space,
                       except for distinctive bullets.
 
 The elements of the list produced are lists that represents a topic
@@ -5375,7 +5396,7 @@ header and body.  The elements of that list are:
       (beginning-of-line)
       ;; Goto initial topic, and register preceeding stuff, if any:
       (if (> (allout-goto-prefix-doublechecked) start)
-         ;; First topic follows beginning point - register preliminary stuff:
+         ;; First topic follows beginning point -- register preliminary stuff:
          (setq result (list (list 0 "" nil
                                   (buffer-substring start (1- (point)))))))
       (while (and (not done)
@@ -5443,7 +5464,7 @@ header and body.  The elements of that list are:
            (cond ((= new-depth depth)
                   (setq format (cons (1+ (car format))
                                          (cdr format))))
-                 ((> new-depth depth)  ; descending - assume by 1:
+                 ((> new-depth depth)  ; descending -- assume by 1:
                   (setq format (cons 1 format)))
                  (t
                                        ; Pop the residue:
@@ -5457,12 +5478,12 @@ header and body.  The elements of that list are:
                                 (cdr format)))))))
       ;; Put the list with first at front, to last at back:
       (nreverse result))))
-;;;_   > my-region-active-p ()
-(defmacro my-region-active-p ()
-  (if (fboundp 'region-active-p)
-      '(region-active-p)
-    'mark-active))
-;;;_   > allout-process-exposed (&optional func from to frombuf
+;;;_   > allout-region-active-p ()
+(defmacro allout-region-active-p ()
+  (cond ((fboundp 'use-region-p) '(use-region-p))
+        ((fboundp 'region-active-p) '(region-active-p))
+        (t 'mark-active)))
+;;_   > allout-process-exposed (&optional func from to frombuf
 ;;;                                        tobuf format)
 (defun allout-process-exposed (&optional func from to frombuf tobuf
                                          format start-num)
@@ -5474,12 +5495,12 @@ Apply FUNCTION to exposed portions FROM position TO position in buffer
 FROMBUF to buffer TOBUF.  Sixth optional arg, FORMAT, designates an
 alternate presentation form:
 
- `flat' - Present prefix as numeric section.subsection..., starting with
-        section indicated by the start-num, innermost nesting first.
- X`flat-indented' - Prefix is like `flat' for first topic at each
+ `flat' -- Present prefix as numeric section.subsection..., starting with
+        section indicated by the START-NUM, innermost nesting first.
+ X`flat-indented' -- Prefix is like `flat' for first topic at each
  X                level, but subsequent topics have only leaf topic
  X                number, padded with blanks to line up with first.
- `indent' (symbol) -  Convert header prefixes to all white space,
+ `indent' (symbol) --  Convert header prefixes to all white space,
                       except for distinctive bullets.
 
 Defaults:
@@ -5494,24 +5515,24 @@ Defaults:
                                        ; defaulting if necessary:
   (if (not func) (setq func 'allout-insert-listified))
   (if (not (and from to))
-      (if (my-region-active-p)
+      (if (allout-region-active-p)
          (setq from (region-beginning) to (region-end))
        (setq from (point-min) to (point-max))))
   (if frombuf
       (if (not (bufferp frombuf))
-         ;; Specified but not a buffer - get it:
+         ;; Specified but not a buffer -- get it:
          (let ((got (get-buffer frombuf)))
            (if (not got)
                (error (concat "allout-process-exposed: source buffer "
                               frombuf
                               " not found."))
              (setq frombuf got))))
-    ;; not specified - default it:
+    ;; not specified -- default it:
     (setq frombuf (current-buffer)))
   (if tobuf
       (if (not (bufferp tobuf))
          (setq tobuf (get-buffer-create tobuf)))
-    ;; not specified - default it:
+    ;; not specified -- default it:
     (setq tobuf (concat "*" (buffer-name frombuf) " exposed*")))
   (if (listp format)
       (nreverse format))
@@ -5584,7 +5605,7 @@ alternate presentation format for the outline:
                                   (goto-char beg)
                                   (allout-topic-flat-index))
                           '(1))))
-    (save-excursion (set-buffer tobuf)(erase-buffer))
+    (with-current-buffer tobuf (erase-buffer))
     (allout-process-exposed 'allout-insert-listified
                             beg
                             end
@@ -5598,7 +5619,7 @@ alternate presentation format for the outline:
 (defun allout-flatten-exposed-to-buffer (&optional arg tobuf)
   "Present numeric outline of outline's exposed portions in another buffer.
 
-The resulting outline is not compatible with outline mode - use
+The resulting outline is not compatible with outline mode -- use
 `allout-copy-exposed-to-buffer' if you want that.
 
 Use `allout-indented-exposed-to-buffer' for indented presentation.
@@ -5614,7 +5635,7 @@ used verbatim."
 (defun allout-indented-exposed-to-buffer (&optional arg tobuf)
   "Present indented outline of outline's exposed portions in another buffer.
 
-The resulting outline is not compatible with outline mode - use
+The resulting outline is not compatible with outline mode -- use
 `allout-copy-exposed-to-buffer' if you want that.
 
 Use `allout-flatten-exposed-to-buffer' for numeric sectional presentation.
@@ -5843,7 +5864,7 @@ encryption are encrypted.  See allout-encrypt-unencrypted-on-saves for
 auto-encryption specifics.
 
 \*NOTE WELL* that automatic encryption that happens during saves will
-default to symmetric encryption - you must deliberately (re)encrypt key-pair
+default to symmetric encryption -- you must deliberately (re)encrypt key-pair
 encrypted topics if you want them to continue to use the key-pair cipher.
 
 Level-one topics, with prefix consisting solely of an `*' asterisk, cannot be
@@ -5930,7 +5951,7 @@ See `allout-toggle-current-subtree-encryption' for more details."
                                                          subtree-end))
            (subtree-end-char (char-after (1- subtree-end)))
            (subtree-trailing-char (char-after subtree-end))
-           ;; kluge - result-text needs to be nil, but we also want to
+           ;; kluge -- result-text needs to be nil, but we also want to
            ;;         check for the error condition
            (result-text (if (or (string= "" subject-text)
                                 (string= "\n" subject-text))
@@ -5952,7 +5973,7 @@ See `allout-toggle-current-subtree-encryption' for more details."
 
       (when (not was-encrypted)
         ;; ensure that non-ascii chars pending encryption are noticed before
-        ;; they're encrypted, so the coding system is set to accomodate
+        ;; they're encrypted, so the coding system is set to accommodate
         ;; them.
         (setq buffer-file-coding-system
               (select-safe-coding-system subtree-beg subtree-end))
@@ -6017,18 +6038,19 @@ If DECRYPT is true (default false), then decrypt instead of encrypt.
 
 FETCH-PASS (default false) forces fresh prompting for the passphrase.
 
-KEY-TYPE indicates whether to use a 'symmetric or 'keypair cipher.
+KEY-TYPE, either `symmetric' or `keypair', specifies which type
+of cypher to use.
 
 FOR-KEY is human readable identification of the first of the user's
 eligible secret keys a keypair decryption targets, or else nil.
 
-Optional RETRIED is for internal use - conveys the number of failed keys
+Optional RETRIED is for internal use -- conveys the number of failed keys
 that have been solicited in sequence leading to this current call.
 
 Optional PASSPHRASE enables explicit delivery of the decryption passphrase,
 for verification purposes.
 
-Optional REJECTED is for internal use - conveys the number of
+Optional REJECTED is for internal use -- conveys the number of
 rejections due to matches against
 `allout-encryption-ciphertext-rejection-regexps', as limited by
 `allout-encryption-ciphertext-rejection-ceiling'.
@@ -6126,15 +6148,15 @@ Returns the resulting string, or nil if the transformation fails."
 
             (if status
                 (pgg-situate-output (point-min) (point-max))
-              ;; failed - handle passphrase caching
+              ;; failed -- handle passphrase caching
               (if verifying
                   (throw 'encryption-failed nil)
                 (pgg-remove-passphrase-from-cache target-cache-id t)
-                (error "Symmetric-cipher %scryption failed - %s"
+                (error "Symmetric-cipher %scryption failed -- %s"
                        (if decrypt "de" "en")
-                       "try again with different passphrase."))))
+                       "try again with different passphrase"))))
 
-           ;; encrypt 'keypair:
+           ;; encrypt `keypair':
            ((not decrypt)
 
             (setq status
@@ -6147,7 +6169,7 @@ Returns the resulting string, or nil if the transformation fails."
               (error (pgg-remove-passphrase-from-cache target-cache-id t)
                      (error "encryption failed"))))
 
-           ;; decrypt 'keypair:
+           ;; decrypt `keypair':
            (t
 
             (setq status
@@ -6163,7 +6185,7 @@ Returns the resulting string, or nil if the transformation fails."
                  1 (- (point-max) (if decrypt 0 1))))
           )
 
-        ;; validate result - non-empty
+        ;; validate result -- non-empty
         (cond ((not result-text)
                (if verifying
                    nil
@@ -6199,7 +6221,7 @@ Returns the resulting string, or nil if the transformation fails."
                     (string-match "[\C-a\C-k\C-o-\C-z\C-@]"
                                   result-text))
                (error (concat "Encryption produced non-armored text, which"
-                              "conflicts with allout mode - reconfigure!")))
+                              "conflicts with allout mode -- reconfigure!")))
 
               ;; valid result and just verifying or non-symmetric:
               ((or verifying (not (equal key-type 'symmetric)))
@@ -6208,7 +6230,7 @@ Returns the resulting string, or nil if the transformation fails."
                                                 passphrase t))
                result-text)
 
-              ;; valid result and regular symmetric - "register"
+              ;; valid result and regular symmetric -- "register"
               ;; passphrase with mnemonic aids/cache.
               (t
                (set-buffer allout-buffer)
@@ -6239,7 +6261,7 @@ CACHE-ID is the cache id of the key for the passphrase.
 
 PROMPT-ID is the id for use when prompting the user.
 
-KEY-TYPE is either 'symmetric or 'keypair.
+KEY-TYPE is either `symmetric' or `keypair'.
 
 ALLOUT-BUFFER is the buffer containing the entry being en/decrypted.
 
@@ -6261,8 +6283,7 @@ of the availability of a cached copy."
 
     ;; Symmetric hereon:
 
-    (save-excursion
-      (set-buffer allout-buffer)
+    (with-current-buffer allout-buffer
       (let* ((hint (if (and (not (string= allout-passphrase-hint-string ""))
                             (or (equal allout-passphrase-hint-handling 'always)
                                 (and (equal allout-passphrase-hint-handling
@@ -6302,7 +6323,7 @@ of the availability of a cached copy."
                  (if (and (not confirmation)
                           (if (yes-or-no-p
                                (concat "Passphrase differs from established"
-                                       " - use new one instead? "))
+                                       " -- use new one instead? "))
                               ;; deactivate password for subsequent
                               ;; confirmation:
                               (progn
@@ -6311,12 +6332,12 @@ of the availability of a cached copy."
                                 nil)
                             t))
                      (progn (pgg-remove-passphrase-from-cache cache-id t)
-                            (error "Wrong passphrase."))))
-                ;; No verifier string - force confirmation by repetition of
+                            (error "Wrong passphrase"))))
+                ;; No verifier string -- force confirmation by repetition of
                 ;; (new) passphrase:
                 ((or fetch-pass (not cached))
                  (pgg-remove-passphrase-from-cache cache-id t))))
-        ;; confirmation vs new input - doing pgg-read-passphrase will do the
+        ;; confirmation vs new input -- doing pgg-read-passphrase will do the
         ;; right thing, in either case:
         (if (not confirmation)
             (setq confirmation
@@ -6327,13 +6348,13 @@ of the availability of a cached copy."
             (if (equal got-pass confirmation)
                 confirmation
               (if (yes-or-no-p (concat "spelling of original and"
-                                       " confirmation differ - retry? "))
+                                       " confirmation differ -- retry? "))
                   (progn (setq retried (if retried (1+ retried) 1))
                          (pgg-remove-passphrase-from-cache cache-id t)
                          ;; recurse to this routine:
                          (pgg-read-passphrase prompt-sans-hint cache-id t))
                 (pgg-remove-passphrase-from-cache cache-id t)
-                (error "Confirmation failed."))))))))
+                (error "Confirmation failed"))))))))
 ;;;_  > allout-encrypted-topic-p ()
 (defun allout-encrypted-topic-p ()
   "True if the current topic is encryptable and encrypted."
@@ -6349,10 +6370,10 @@ of the availability of a cached copy."
 (defun allout-encrypted-key-info (text)
   "Return a pair of the key type and identity of a recipient's secret key.
 
-The key type is one of 'symmetric or 'keypair.
+The key type is one of `symmetric' or `keypair'.
 
-if 'keypair, and some of the user's secret keys are among those for which
-the message was encoded, return the identity of the first.  otherwise,
+If `keypair', and some of the user's secret keys are among those for which
+the message was encoded, return the identity of the first.  Otherwise,
 return nil for the second item of the pair.
 
 An error is raised if the text is not encrypted."
@@ -6397,7 +6418,7 @@ An error is raised if the text is not encrypted."
 See `allout-passphrase-verifier-string' and `allout-passphrase-hint-string'
 settings.
 
-PASSPHRASE is the passphrase being mnemonicized
+PASSPHRASE is the passphrase being mnemonicized.
 
 OUTLINE-BUFFER is the buffer of the outline being adjusted.
 
@@ -6459,8 +6480,7 @@ Derived from value of `allout-passphrase-verifier-string'."
   "True if passphrase successfully decrypts verifier, nil otherwise.
 
 \"Otherwise\" includes absence of passphrase verifier."
-  (save-excursion
-    (set-buffer allout-buffer)
+  (with-current-buffer allout-buffer
     (and (boundp 'allout-passphrase-verifier-string)
          allout-passphrase-verifier-string
          (allout-encrypt-string (allout-get-encryption-passphrase-verifier)
@@ -6475,7 +6495,7 @@ EXCEPT-MARK identifies a point whose containing topics should be excluded
 from encryption.  This supports 'except-current mode of
 `allout-encrypt-unencrypted-on-saves'.
 
-Such a topic has the allout-topic-encryption-bullet without an
+Such a topic has the `allout-topic-encryption-bullet' without an
 immediately following '*' that would mark the topic as being encrypted.  It
 must also have content."
   (let (done got content-beg)
@@ -6529,7 +6549,7 @@ must also have content."
   "Encrypt topics pending encryption except those containing exemption point.
 
 EXCEPT-MARK identifies a point whose containing topics should be excluded
-from encryption.  This supports 'except-current mode of
+from encryption.  This supports the `except-current' mode of
 `allout-encrypt-unencrypted-on-saves'.
 
 If a topic that is currently being edited was encrypted, we return a list
@@ -6597,7 +6617,7 @@ setup for auto-startup."
     (if (allout-goto-prefix)
        t
       (allout-open-topic 2)
-      (insert (concat "Dummy outline topic header - see"
+      (insert (concat "Dummy outline topic header -- see"
                       "`allout-mode' docstring: `^Hm'."))
       (allout-adjust-file-variable
        "allout-layout" (or allout-layout '(-1 : 0))))))
@@ -6605,7 +6625,7 @@ setup for auto-startup."
 (defun allout-file-vars-section-data ()
   "Return data identifying the file-vars section, or nil if none.
 
-Returns list `(beginning-point prefix-string suffix-string)'."
+Returns a list of the form (BEGINNING-POINT PREFIX-STRING SUFFIX-STRING)."
   ;; minimally gleaned from emacs 21.4 files.el hack-local-variables function.
   (let (beg prefix suffix)
     (save-excursion
@@ -6707,7 +6727,7 @@ not its value."
         got)
     (dolist (sym configvar-value)
       (if (not (boundp sym))
-          (if (yes-or-no-p (format "%s entry `%s' is unbound - remove it? "
+          (if (yes-or-no-p (format "%s entry `%s' is unbound -- remove it? "
                                    configvar-name sym))
               (delq sym (symbol-value configvar-name)))
         (push (symbol-value sym) got)))
@@ -6754,7 +6774,7 @@ Optional arg DO-DEFAULTING indicates to accept empty input (CR)."
                                            string
                                            ""))
                   nil))))
-      ;; got something out of loop - return it:
+      ;; got something out of loop -- return it:
       got)
   )
 ;;;_  : Strings:
@@ -6762,7 +6782,7 @@ Optional arg DO-DEFAULTING indicates to accept empty input (CR)."
 (defun regexp-sans-escapes (regexp &optional successive-backslashes)
   "Return a copy of REGEXP with all character escapes stripped out.
 
-Representations of actual backslashes - '\\\\\\\\' - are left as a
+Representations of actual backslashes -- '\\\\\\\\' -- are left as a
 single backslash.
 
 Optional arg SUCCESSIVE-BACKSLASHES is used internally for recursion."
@@ -6810,7 +6830,7 @@ If BEG is bigger than END we return 0."
   (cond ((null list) nil)
         ((atom (car list)) (cons (car list) (allout-flatten (cdr list))))
         (t (append (allout-flatten (car list)) (allout-flatten (cdr list))))))
-;;;_  : Compatability:
+;;;_  : Compatibility:
 ;;;_   > allout-mark-marker to accommodate divergent emacsen:
 (defun allout-mark-marker (&optional force buffer)
   "Accommodate the different signature for `mark-marker' across Emacsen.
@@ -6862,7 +6882,7 @@ BEG and END default respectively to the beginning and end of buffer."
                   (move-overlay o end (overlay-end o))
                 (delete-overlay o)))))))
   )
-;;;_   > copy-overlay if necessary - xemacs ~ 21.4
+;;;_   > copy-overlay if necessary -- xemacs ~ 21.4
 (if (not (fboundp 'copy-overlay))
     (defun copy-overlay (o)
       "Return a copy of overlay O."
@@ -6874,7 +6894,7 @@ BEG and END default respectively to the beginning and end of buffer."
         (while props
           (overlay-put o1 (pop props) (pop props)))
         o1)))
-;;;_   > add-to-invisibility-spec if necessary - xemacs ~ 21.4
+;;;_   > add-to-invisibility-spec if necessary -- xemacs ~ 21.4
 (if (not (fboundp 'add-to-invisibility-spec))
     (defun add-to-invisibility-spec (element)
       "Add ELEMENT to `buffer-invisibility-spec'.
@@ -6884,14 +6904,14 @@ that can be added."
           (setq buffer-invisibility-spec (list t)))
       (setq buffer-invisibility-spec
             (cons element buffer-invisibility-spec))))
-;;;_   > remove-from-invisibility-spec if necessary - xemacs ~ 21.4
+;;;_   > remove-from-invisibility-spec if necessary -- xemacs ~ 21.4
 (if (not (fboundp 'remove-from-invisibility-spec))
     (defun remove-from-invisibility-spec (element)
       "Remove ELEMENT from `buffer-invisibility-spec'."
       (if (consp buffer-invisibility-spec)
           (setq buffer-invisibility-spec (delete element
                                                  buffer-invisibility-spec)))))
-;;;_   > move-beginning-of-line if necessary - older emacs, xemacs
+;;;_   > move-beginning-of-line if necessary -- older emacs, xemacs
 (if (not (fboundp 'move-beginning-of-line))
     (defun move-beginning-of-line (arg)
       "Move point to beginning of current line as displayed.
@@ -6921,7 +6941,7 @@ To ignore intangibility, bind `inhibit-point-motion-hooks' to t."
         (skip-chars-backward "^\n"))
       (vertical-motion 0))
 )
-;;;_   > move-end-of-line if necessary - older emacs, xemacs
+;;;_   > move-end-of-line if necessary -- older emacs, xemacs
 (if (not (fboundp 'move-end-of-line))
     (defun move-end-of-line (arg)
       "Move point to end of current line as displayed.
@@ -6990,7 +7010,7 @@ To ignore intangibility, bind `inhibit-point-motion-hooks' to t."
     (isearch-repeat 'forward)
     (isearch-mode t)))
 
-;;;_ #11 Unit tests - this should be last item before "Provide"
+;;;_ #11 Unit tests -- this should be last item before "Provide"
 ;;;_  > allout-run-unit-tests ()
 (defun allout-run-unit-tests ()
   "Run the various allout unit tests."
@@ -7006,11 +7026,11 @@ To ignore intangibility, bind `inhibit-point-motion-hooks' to t."
   (while (boundp name) (makunbound name)))
 ;;;_   > allout-test-resumptions ()
 (defvar allout-tests-globally-unbound nil
-  "Fodder for allout resumptions tests - defvar just for byte compiler.")
+  "Fodder for allout resumptions tests -- defvar just for byte compiler.")
 (defvar allout-tests-globally-true nil
-  "Fodder for allout resumptions tests - defvar just just for byte compiler.")
+  "Fodder for allout resumptions tests -- defvar just for byte compiler.")
 (defvar allout-tests-locally-true nil
-  "Fodder for allout resumptions tests - defvar just for byte compiler.")
+  "Fodder for allout resumptions tests -- defvar just for byte compiler.")
 (defun allout-test-resumptions ()
   "Exercise allout resumptions."
   ;; for each resumption case, we also test that the right local/global
@@ -7046,10 +7066,10 @@ To ignore intangibility, bind `inhibit-point-motion-hooks' to t."
     (allout-tests-obliterate-variable 'allout-tests-locally-true)
     (set (make-local-variable 'allout-tests-locally-true) t)
     (assert (not (default-boundp 'allout-tests-locally-true))
-            nil (concat "Test setup mistake - variable supposed to"
+            nil (concat "Test setup mistake -- variable supposed to"
                         " not have global binding, but it does."))
     (assert (local-variable-p 'allout-tests-locally-true)
-            nil (concat "Test setup mistake - variable supposed to have"
+            nil (concat "Test setup mistake -- variable supposed to have"
                         " local binding, but it lacks one."))
     (allout-add-resumptions '(allout-tests-locally-true nil))
     (assert (not (default-boundp 'allout-tests-locally-true)))