]> code.delx.au - gnu-emacs/blobdiff - lisp/allout.el
* lisp/descr-text.el (describe-char-unicode-data): Fix copy/paste errors.
[gnu-emacs] / lisp / allout.el
index 6b1542cd3f81f12a3ff16a19c5da645b2743f3a5..3a7b6e64d1bc31d57f2eb761d08998fe754be320 100644 (file)
@@ -1,13 +1,13 @@
 ;;; allout.el --- extensive outline mode for use alone and with other modes
 
-;; Copyright (C) 1992-1994, 2001-201 Free Software Foundation, Inc.
+;; Copyright (C) 1992-1994, 2001-2016 Free Software Foundation, Inc.
 
-;; Author: Ken Manheimer <ken dot manheimer at gmail dot com>
-;; Maintainer: Ken Manheimer <ken dot manheimer at gmail dot com>
+;; Author: Ken Manheimer <ken dot manheimer at gmail...>
+;; Maintainer: Ken Manheimer <ken dot manheimer at gmail...>
 ;; Created: Dec 1991 -- first release to usenet
 ;; Version: 2.3
 ;; Keywords: outlines, wp, languages, PGP, GnuPG
-;; Website: http://myriadicity.net/Sundry/EmacsAllout
+;; Website: http://myriadicity.net/software-and-systems/craft/emacs-allout
 
 ;; This file is part of GNU Emacs.
 
 
 ;;; Code:
 
+(declare-function epa-passphrase-callback-function
+                 "epa" (context key-id handback))
+
 ;;;_* Dependency loads
 (require 'overlay)
 (eval-when-compile
-  ;; Most of the requires here are for stuff covered by autoloads, which
-  ;; byte-compiling doesn't trigger.
-  (require 'epg)
-  (require 'epa)
-  (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.
@@ -170,7 +168,7 @@ respective allout-mode keybinding variables, `allout-command-prefix',
   ;; the function value keymap of allout-mode-map is used in
   ;; minor-mode-map-alist - update it:
   (fset allout-mode-map allout-mode-map-value))
-;;;_  * intialize the mode map:
+;;;_  * initialize the mode map:
 ;; ensure that allout-mode-map has some setting even if allout-mode hasn't
 ;; been invoked:
 (allout-compose-and-institute-keymap)
@@ -178,7 +176,7 @@ respective allout-mode keybinding variables, `allout-command-prefix',
 (defcustom allout-command-prefix "\C-c "
   "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
+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-keybindings
@@ -231,7 +229,7 @@ See `allout-unprefixed-keybindings' for the list of keybindings
 that are not prefixed.
 
 Use vector format for the keys:
-  - put literal keys after a '?' question mark, eg: '?a', '?.'
+  - put literal keys after a `?' question mark, eg: `?a', `?.'
   - enclose control, shift, or meta-modified keys as sequences within
     parentheses, with the literal key, as above, preceded by the name(s)
     of the modifiers, eg: [(control ?a)]
@@ -240,6 +238,7 @@ See the existing keys for examples.
 Functions can be bound to multiple keys, but binding keys to
 multiple functions will not work - the last binding for a key
 prevails."
+  :version "24.1"
   :type 'allout-keybindings-binding
   :group 'allout-keybindings
   :set 'allout-compose-and-institute-keymap
@@ -258,11 +257,12 @@ This is in contrast to the majority of allout-mode bindings on
 preceding command key.
 
 Use vector format for the keys:
-  - put literal keys after a '?' question mark, eg: '?a', '?.'
+  - put literal keys after a `?' question mark, eg: `?a', `?.'
   - enclose control, shift, or meta-modified keys as sequences within
     parentheses, with the literal key, as above, preceded by the name(s)
     of the modifiers, eg: [(control ?a)]
 See the existing keys for examples."
+  :version "24.1"
   :type 'allout-keybindings-binding
   :group 'allout-keybindings
   :set 'allout-compose-and-institute-keymap
@@ -279,7 +279,7 @@ Intended to be used as the `allout-auto-activation' :set function."
 ;;;_  > allout-setup ()
 ;;;###autoload
 (defun allout-setup ()
-  "Do fundamental emacs session for allout auto-activation.
+  "Do fundamental Emacs session for allout auto-activation.
 
 Establishes allout processing as part of visiting a file if
 `allout-auto-activation' is non-nil, or removes it otherwise.
@@ -298,7 +298,7 @@ Control whether and how allout outline mode is automatically
 activated when files are visited with non-nil buffer-specific
 file variable `allout-layout'.
 
-When allout-auto-activation is \"On\" \(t), allout mode is
+When allout-auto-activation is \"On\" (t), allout mode is
 activated in buffers with non-nil `allout-layout', and the
 specified layout is applied.
 
@@ -322,7 +322,7 @@ With value nil, inhibit any automatic allout-mode activation."
   "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
+`allout-layout' has the local value t.  This docstring describes the
 layout specifications.
 
 A list value specifies a default layout for the current buffer,
@@ -402,6 +402,7 @@ else allout's special hanging-indent maintaining auto-fill function,
 ;;;_  = allout-inhibit-auto-fill-on-headline
 (defcustom allout-inhibit-auto-fill-on-headline nil
   "If non-nil, auto-fill will be inhibited while on topic's header line."
+  :version "24.1"
   :type 'boolean
   :group 'allout)
 (make-variable-buffer-local 'allout-inhibit-auto-fill-on-headline)
@@ -560,7 +561,7 @@ of this var to take effect."
 These bullets are distinguish topics with particular character.
 They are not used by default in the topic creation routines, but
 are offered as options when you modify topic creation with a
-universal argument \(\\[universal-argument]), or during rebulleting \(\\[allout-rebullet-current-heading]).
+universal argument (\\[universal-argument]), or during rebulleting (\\[allout-rebullet-current-heading]).
 
 Distinctive bullets are not cycled when topics are shifted or
 otherwise automatically rebulleted, so their marking is
@@ -591,7 +592,7 @@ software.  By default:
 See `allout-plain-bullets-string' for the standard, alternating
 bullets.
 
-You must run `set-allout-regexp' in order for outline mode to
+You must run `allout-set-regexp' in order for outline mode to
 adopt changes of this value.
 
 DO NOT include the close-square-bracket, `]', on either of the bullet
@@ -609,10 +610,10 @@ strings."
 Allout outline mode will use the mode-specific `allout-mode-leaders' or
 comment-start string, if any, to lead the topic prefix string, so topic
 headers look like comments in the programming language.  It will also use
-the comment-start string, with an '_' appended, for `allout-primary-bullet'.
+the comment-start string, with an `_' appended, for `allout-primary-bullet'.
 
 String values are used as literals, not regular expressions, so
-do not escape any regulare-expression characters.
+do not escape any regular-expression characters.
 
 Value t means to first check for assoc value in `allout-mode-leaders'
 alist, then use comment-start string, if any, then use default (`.').
@@ -764,6 +765,7 @@ Set this var to the bullet you want to use for file cross-references."
   "If non-nil, `allout-flatten-exposed-to-buffer' abbreviates topic
 numbers to minimal amount with some context.  Otherwise, entire
 numbers are always used."
+  :version "24.1"
   :type 'boolean
   :group 'allout)
 
@@ -795,9 +797,9 @@ numbers are always used."
   :group 'allout)
 ;;;_  - allout-title
 (defcustom allout-title '(or buffer-file-name (buffer-name))
-  "Expression to be evaluated to determine the title for LaTeX
-formatted copy."
+  "Expression to evaluate to determine the title for LaTeX formatted copy."
   :type 'sexp
+  :risky t
   :group 'allout)
 ;;;_  - allout-line-skip
 (defcustom allout-line-skip ".05cm"
@@ -825,7 +827,7 @@ formatted copy."
 (defcustom allout-encrypt-unencrypted-on-saves t
   "If non-nil, topics pending encryption are encrypted during buffer saves.
 
-This provents file-system exposure of un-encrypted contents of
+This prevents file-system exposure of un-encrypted contents of
 items marked for encryption.
 
 When non-nil, if the topic currently being edited is decrypted,
@@ -844,7 +846,7 @@ such topics are encrypted.)"
 (defvar allout-auto-save-temporarily-disabled nil
   "True while topic encryption is pending and auto-saving was active.
 
-The value of buffer-saved-size at the time of decryption is used,
+The value of `buffer-saved-size' at the time of decryption is used,
 for restoring when all encryptions are established.")
 (defvar allout-just-did-undo nil
   "True just after undo commands, until allout-post-command-business.")
@@ -910,12 +912,12 @@ For details, see `allout-toggle-current-subtree-encryption's 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-auto-activation'
+In buffers where this is non-nil (and if `allout-auto-activation'
 has been customized to enable this behavior), `allout-mode' will be
 automatically activated.  The layout dictated by the value will be used to
 set the initial exposure when `allout-mode' is activated.
 
-\*You should not setq-default this variable non-nil unless you want every
+*You should not setq-default this variable non-nil unless you want every
 visited file to be treated as an allout file.*
 
 The value would typically be set by a file local variable.  For
@@ -931,7 +933,7 @@ followed by the equivalent of `(allout-expose-topic 0 : -1 -1 0)'.
 \(This is the layout used for the allout.el source file.)
 
 `allout-default-layout' describes the specification format.
-`allout-layout' can additionally have the value `t', in which
+`allout-layout' can additionally have the value t, in which
 case the value of `allout-default-layout' is used.")
 (make-variable-buffer-local 'allout-layout)
 ;;;###autoload
@@ -941,17 +943,17 @@ case the value of `allout-default-layout' is used.")
 ;;;_  : Topic header format
 ;;;_   = allout-regexp
 (defvar allout-regexp ""
-  "*Regular expression to match the beginning of a heading line.
+  "Regular expression to match the beginning of a heading line.
 
 Any line whose beginning matches this regexp is considered a
 heading.  This var is set according to the user configuration vars
-by `set-allout-regexp'.")
+by `allout-set-regexp'.")
 (make-variable-buffer-local 'allout-regexp)
 ;;;_   = allout-bullets-string
 (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 `allout-set-regexp',
 and is produced from the elements of `allout-plain-bullets-string'
 and `allout-distinctive-bullets-string'.")
 (make-variable-buffer-local 'allout-bullets-string)
@@ -961,23 +963,23 @@ and `allout-distinctive-bullets-string'.")
 (make-variable-buffer-local 'allout-bullets-string-len)
 ;;;_   = allout-depth-specific-regexp
 (defvar allout-depth-specific-regexp ""
-  "*Regular expression to match a heading line prefix for a particular depth.
+  "Regular expression to match a heading line prefix for a particular depth.
 
 This expression is used to search for depth-specific topic
 headers at depth 2 and greater.  Use `allout-depth-one-regexp'
 for to seek topics at depth one.
 
 This var is set according to the user configuration vars by
-`set-allout-regexp'.  It is prepared with format strings for two
+`allout-set-regexp'.  It is prepared with format strings for two
 decimal numbers, which should each be one less than the depth of the
 topic prefix to be matched.")
 (make-variable-buffer-local 'allout-depth-specific-regexp)
 ;;;_   = allout-depth-one-regexp
 (defvar allout-depth-one-regexp ""
-  "*Regular expression to match a heading line prefix for depth one.
+  "Regular expression to match a heading line prefix for depth one.
 
 This var is set according to the user configuration vars by
-`set-allout-regexp'.  It is prepared with format strings for two
+`allout-set-regexp'.  It is prepared with format strings for two
 decimal numbers, which should each be one less than the depth of the
 topic prefix to be matched.")
 (make-variable-buffer-local 'allout-depth-one-regexp)
@@ -985,7 +987,7 @@ topic prefix to be matched.")
 (defvar allout-line-boundary-regexp ()
   "`allout-regexp' prepended with a newline for the search target.
 
-This is properly set by `set-allout-regexp'.")
+This is properly set by `allout-set-regexp'.")
 (make-variable-buffer-local 'allout-line-boundary-regexp)
 ;;;_   = allout-bob-regexp
 (defvar allout-bob-regexp ()
@@ -997,7 +999,7 @@ This is properly set by `set-allout-regexp'.")
 (make-variable-buffer-local 'allout-header-subtraction)
 ;;;_   = allout-plain-bullets-string-len
 (defvar allout-plain-bullets-string-len (length allout-plain-bullets-string)
-  "Length of `allout-plain-bullets-string', updated by `set-allout-regexp'.")
+  "Length of `allout-plain-bullets-string', updated by `allout-set-regexp'.")
 (make-variable-buffer-local 'allout-plain-bullets-string-len)
 
 ;;;_   = allout-doublecheck-at-and-shallower
@@ -1010,9 +1012,9 @@ determination of aberrance is according to the mistaken item
 being followed by a legitimate item of excessively greater depth.
 
 The classic example of a mistaken item, for a standard allout
-outline configuration, is a body line that begins with an '...'
+outline configuration, is a body line that begins with an `...'
 ellipsis.  This happens to contain a legitimate depth-2 header
-prefix, constituted by two '..' dots at the beginning of the
+prefix, constituted by two `..' dots at the beginning of the
 line.  The only thing that can distinguish it *in principle* from
 a legitimate one is if the following real header is at a depth
 that is discontinuous from the depth of 2 implied by the
@@ -1032,12 +1034,12 @@ suitably economical.")
   (interactive "sNew lead string: ")
   (setq allout-header-prefix header-lead)
   (setq allout-header-subtraction (1- (length allout-header-prefix)))
-  (set-allout-regexp))
+  (allout-set-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.
 
-Useful when for encapsulating outline structure in programming
+Useful for encapsulating outline structure in programming
 language comments.  Returns the leading string."
 
   (interactive "P")
@@ -1112,8 +1114,8 @@ file is programming code."
           comment-start
           (not (eq 'force allout-reindent-bodies)))
       (setq allout-reindent-bodies nil)))
-;;;_   > set-allout-regexp ()
-(defun set-allout-regexp ()
+;;;_   > allout-set-regexp ()
+(defun allout-set-regexp ()
   "Generate proper topic-header regexp form for outline functions.
 
 Works with respect to `allout-plain-bullets-string' and
@@ -1240,12 +1242,13 @@ Also refresh various data structures that hinge on the regexp."
                             "[^" allout-primary-bullet "]"))
                   "\\)"
                   ))))
+(define-obsolete-function-alias 'set-allout-regexp 'allout-set-regexp "25.2")
 ;;;_  : Menu bar
 (defvar allout-mode-exposure-menu)
 (defvar allout-mode-editing-menu)
 (defvar allout-mode-navigation-menu)
 (defvar allout-mode-misc-menu)
-(defun produce-allout-mode-menubar-entries ()
+(defun allout-produce-mode-menubar-entries ()
   (require 'easymenu)
   (easy-menu-define allout-mode-exposure-menu
                    allout-mode-map-value
@@ -1324,20 +1327,20 @@ scope of the variable is restored along with its value.  If it was a void
 buffer-local value, then it is left as nil on resumption.
 
 The pairs are lists whose car is the name of the variable and car of the
-cdr is the new value: '(some-var some-value)'.  The pairs can actually be
+cdr is the new value: `(some-var some-value)'.  The pairs can actually be
 triples, where the third element qualifies the disposition of the setting,
 as described further below.
 
-If the optional third element is the symbol 'extend, then the new value
+If the optional third element is the symbol `extend', then the new value
 created by `cons'ing the second element of the pair onto the front of the
 existing value.
 
-If the optional third element is the symbol 'append, then the new value is
+If the optional third element is the symbol `append', then the new value is
 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
@@ -1399,19 +1402,21 @@ their settings before allout-mode was started."
      ,expr))
 ;;;_   = allout-mode-hook
 (defvar allout-mode-hook nil
-  "*Hook that's run when allout mode starts.")
+  "Hook run when allout mode starts.")
 ;;;_   = allout-mode-deactivate-hook
-(defvar allout-mode-deactivate-hook nil
-  "*Hook that's run when allout mode ends.")
 (define-obsolete-variable-alias 'allout-mode-deactivate-hook
   'allout-mode-off-hook "24.1")
+(defvar allout-mode-deactivate-hook nil
+  "Hook run when allout mode ends.")
 ;;;_   = allout-exposure-category
 (defvar allout-exposure-category nil
   "Symbol for use as allout invisible-text overlay category.")
-;;;_   = allout-exposure-change-hook
-(defvar allout-exposure-change-hook nil
-  "*Hook that's run after allout outline subtree exposure changes.
 
+;;;_   = allout-exposure-change-functions
+(define-obsolete-variable-alias 'allout-exposure-change-hook
+  'allout-exposure-change-functions "24.3")
+(defcustom allout-exposure-change-functions nil
+  "Abnormal hook run after allout outline subtree exposure changes.
 It is run at the conclusion of `allout-flag-region'.
 
 Functions on the hook must take three arguments:
@@ -1420,34 +1425,49 @@ Functions on the hook must take three arguments:
  - 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.")
-;;;_   = allout-structure-added-hook
-(defvar allout-structure-added-hook nil
-  "*Hook that's run after addition of items to the outline.
+This hook might be invoked multiple times by a single command."
+  :type 'hook
+  :group 'allout
+  :version "24.3")
 
+;;;_   = allout-structure-added-functions
+(define-obsolete-variable-alias 'allout-structure-added-hook
+  'allout-structure-added-functions "24.3")
+(defcustom allout-structure-added-functions nil
+  "Abnormal hook run after adding items to an Allout outline.
 Functions on the hook should take two arguments:
 
  - NEW-START -- integer indicating position of start of the first new item.
  - NEW-END -- integer indicating position of end of the last new item.
 
-This hook might be invoked multiple times by a single command.")
-;;;_   = allout-structure-deleted-hook
-(defvar allout-structure-deleted-hook nil
-  "*Hook that's run after disciplined deletion of subtrees from the outline.
+This hook might be invoked multiple times by a single command."
+  :type 'hook
+  :group 'allout
+  :version "24.3")
 
+;;;_   = allout-structure-deleted-functions
+(define-obsolete-variable-alias 'allout-structure-deleted-hook
+  'allout-structure-deleted-functions "24.3")
+(defcustom allout-structure-deleted-functions nil
+  "Abnormal hook run after deleting subtrees from an Allout outline.
 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.
 
-Some edits that remove or invalidate items may missed by this hook:
+Some edits that remove or invalidate items may 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.")
-;;;_   = allout-structure-shifted-hook
-(defvar allout-structure-shifted-hook nil
-  "*Hook that's run after shifting of items in the outline.
+This hook might be invoked multiple times by a single command."
+  :type 'hook
+  :group 'allout
+  :version "24.3")
 
+;;;_   = allout-structure-shifted-functions
+(define-obsolete-variable-alias 'allout-structure-shifted-hook
+  'allout-structure-shifted-functions "24.3")
+(defcustom allout-structure-shifted-functions nil
+  "Abnormal hook run after shifting items in an Allout outline.
 Functions on the hook should take two arguments:
 
  - DEPTH-CHANGE -- integer indicating depth increase, negative for decrease
@@ -1456,26 +1476,33 @@ Functions on the hook should take two arguments:
 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.")
+This hook might be invoked multiple times by a single command."
+  :type 'hook
+  :group 'allout
+  :version "24.3")
+
 ;;;_   = allout-after-copy-or-kill-hook
-(defvar allout-after-copy-or-kill-hook nil
-  "*Hook that's run after copying outline text.
+(defcustom allout-after-copy-or-kill-hook nil
+  "Normal hook run after copying outline text.."
+  :type 'hook
+  :group 'allout
+  :version "24.3")
 
-Functions on the hook should not require any arguments.")
 ;;;_   = allout-post-undo-hook
-(defvar allout-post-undo-hook nil
-  "*Hook that's run after undo activity.
-
+(defcustom allout-post-undo-hook nil
+  "Normal hook run after undo activity.
 The item that's current when the hook is run *may* be the one
-that was affected by the undo.
+that was affected by the undo.."
+  :type 'hook
+  :group 'allout
+  :version "24.3")
 
-Functions on the hook should not require any arguments.")
 ;;;_   = allout-outside-normal-auto-fill-function
 (defvar allout-outside-normal-auto-fill-function nil
-  "Value of normal-auto-fill-function outside of allout mode.
+  "Value of `normal-auto-fill-function' outside of allout mode.
 
-Used by allout-auto-fill to do the mandated normal-auto-fill-function
-wrapped within allout's automatic fill-prefix setting.")
+Used by `allout-auto-fill' to do the mandated `normal-auto-fill-function'
+wrapped within allout's automatic `fill-prefix' setting.")
 (make-variable-buffer-local 'allout-outside-normal-auto-fill-function)
 ;;;_   = prevent redundant activation by desktop mode:
 (add-to-list 'desktop-minor-mode-handlers '(allout-mode . nil))
@@ -1486,7 +1513,7 @@ already associated with a file.
 
 It consists of an encrypted random string useful only to verify that a
 passphrase entered by the user is effective for decryption.  The passphrase
-itself is \*not* recorded in the file anywhere, and the encrypted contents
+itself is *not* recorded in the file anywhere, and the encrypted contents
 are random binary characters to avoid exposing greater susceptibility to
 search attacks.
 
@@ -1494,8 +1521,8 @@ The verifier string is retained as an Emacs file variable, as well as in
 the Emacs buffer state, if file variable adjustments are enabled.  See
 `allout-enable-file-variable-adjustment' for details about that.")
 (make-variable-buffer-local 'allout-passphrase-verifier-string)
-(make-obsolete 'allout-passphrase-verifier-string
-               'allout-passphrase-verifier-string "23.3")
+(make-obsolete-variable 'allout-passphrase-verifier-string
+                       'allout-passphrase-verifier-string "23.3")
 ;;;###autoload
 (put 'allout-passphrase-verifier-string 'safe-local-variable 'stringp)
 ;;;_   = allout-passphrase-hint-string
@@ -1510,8 +1537,8 @@ state, if file variable adjustments are enabled.  See
 `allout-enable-file-variable-adjustment' for details about that.")
 (make-variable-buffer-local 'allout-passphrase-hint-string)
 (setq-default allout-passphrase-hint-string "")
-(make-obsolete 'allout-passphrase-hint-string
-               'allout-passphrase-hint-string "23.3")
+(make-obsolete-variable 'allout-passphrase-hint-string
+                       'allout-passphrase-hint-string "23.3")
 ;;;###autoload
 (put 'allout-passphrase-hint-string 'safe-local-variable 'stringp)
 ;;;_   = allout-after-save-decrypt
@@ -1537,14 +1564,14 @@ Entries must be symbols that are bound to the desired values.
 Each value can be a regexp or a list with a regexp followed by a
 substitution string.  If it's just a regexp, all its matches are removed
 before the text is encrypted.  If it's a regexp and a substitution, the
-substition is used against the regexp matches, a la `replace-match'.")
-(make-variable-buffer-local 'allout-encryption-text-removal-regexps)
+substitution is used against the regexp matches, a la `replace-match'.")
+(make-variable-buffer-local 'allout-encryption-plaintext-sanitization-regexps)
 ;;;_   = allout-encryption-ciphertext-rejection-regexps
 (defvar allout-encryption-ciphertext-rejection-regexps nil
   "Variable for regexps matching plaintext to remove before encryption.
 
 This is used to detect strings in encryption results that would
-register as allout mode structural elements, for exmple, as a
+register as allout mode structural elements, for example, as a
 topic prefix.
 
 Entries must be symbols that are bound to the desired regexp values.
@@ -1576,7 +1603,7 @@ message if an error is encountered.  The message will serve as a
 non-nil return on `write-contents-functions' to prevent saving of
 the buffer while it has decrypted content.
 
-This behavior depends on emacs versions that implement the
+This behavior depends on Emacs versions that implement the
 `write-contents-functions' hook."
 
   (if (or (not (allout-mode-p))
@@ -1627,12 +1654,11 @@ and the place for the cursor after the decryption is done."
   )
 ;;;_   > allout-called-interactively-p ()
 (defmacro allout-called-interactively-p ()
-  "A version of called-interactively-p independent of emacs version."
+  "A version of `called-interactively-p' independent of Emacs version."
   ;; ... to ease maintenance of allout without betraying deprecation.
-  (if (equal (subr-arity (symbol-function 'called-interactively-p))
-             '(0 . 0))
-      '(called-interactively-p)
-    '(called-interactively-p 'interactive)))
+  (if (ignore-errors (called-interactively-p 'interactive) t)
+      '(called-interactively-p 'interactive)
+    '(called-interactively-p)))
 ;;;_   = allout-inhibit-aberrance-doublecheck nil
 ;; In some exceptional moments, disparate topic depths need to be allowed
 ;; momentarily, eg when one topic is being yanked into another and they're
@@ -1660,11 +1686,10 @@ from what it did before, for backwards compatibility.
 
 MODE is the activation mode - see `allout-auto-activation' for
 valid values."
-
+  (declare (obsolete allout-auto-activation "23.3"))
   (custom-set-variables (list 'allout-auto-activation (format "%s" mode)))
   (format "%s" mode))
-(make-obsolete 'allout-init
-               "customize 'allout-auto-activation' instead." "23.3")
+
 ;;;_  > allout-setup-menubar ()
 (defun allout-setup-menubar ()
   "Populate the current buffer's menubar with `allout-mode' stuff."
@@ -1712,7 +1737,7 @@ Allout outline mode is a minor mode that provides extensive
 outline oriented formatting and manipulation.  It enables
 structural editing of outlines, as well as navigation and
 exposure.  It also is specifically aimed at accommodating
-syntax-sensitive text like programming languages.  \(For example,
+syntax-sensitive text like programming languages.  (For example,
 see the allout code itself, which is organized as an allout
 outline.)
 
@@ -1733,7 +1758,7 @@ Below is a description of the key bindings, and then description
 of special `allout-mode' features and terminology.  See also the
 outline menubar additions for quick reference to many of the
 features.  Customize `allout-auto-activation' to prepare your
-emacs session for automatic activation of `allout-mode'.
+Emacs session for automatic activation of `allout-mode'.
 
 The bindings are those listed in `allout-prefixed-keybindings'
 and `allout-unprefixed-keybindings'.  We recommend customizing
@@ -1781,7 +1806,7 @@ 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 --
            the offspring are not affected.
@@ -1791,12 +1816,12 @@ the HOT-SPOT Operation section.
         ----------------------------------
 \\[allout-kill-topic] `allout-kill-topic'   Kill current topic, including offspring.
 \\[allout-copy-topic-as-kill] `allout-copy-topic-as-kill' Copy current topic, including offspring.
-\\[allout-kill-line]     `allout-kill-line'    kill-line, attending to outline structure.
+\\[allout-kill-line]     `allout-kill-line'    Kill line, attending to outline structure.
 \\[allout-copy-line-as-kill]     `allout-copy-line-as-kill' Copy line but don't delete it.
 \\[allout-yank] `allout-yank'        Yank, adjusting depth of yanked topic to
                              depth of heading if yanking into bare topic
                              heading (ie, prefix sans text).
-\\[allout-yank-pop]     `allout-yank-pop'       Is to allout-yank as yank-pop is to yank
+\\[allout-yank-pop]     `allout-yank-pop'       Is to `allout-yank' as `yank-pop' is to `yank'.
 
         Topic-oriented Encryption:
         -------------------------
@@ -1814,7 +1839,7 @@ M-x outlineify-sticky       Activate outline mode for current buffer,
                             buffer with name derived from derived from that
                             of current buffer -- \"*BUFFERNAME exposed*\".
 \\[allout-flatten-exposed-to-buffer] `allout-flatten-exposed-to-buffer'
-                            Like above 'copy-exposed', but convert topic
+                            Like above `copy-exposed', but convert topic
                             prefixes to section.subsection... numeric
                             format.
 \\[customize-variable] allout-auto-activation
@@ -1836,9 +1861,9 @@ for a save, it is automatically decrypted for continued editing.
 NOTE: A few GnuPG v2 versions improperly preserve incorrect
 symmetric decryption keys, preventing entry of the correct key on
 subsequent decryption attempts until the cache times-out.  That
-can take several minutes.  \(Decryption of other entries is not
+can take several minutes.  (Decryption of other entries is not
 affected.)  Upgrade your EasyPG version, if you can, and you can
-deliberately clear your gpg-agent's cache by sending it a '-HUP'
+deliberately clear your gpg-agent's cache by sending it a `-HUP'
 signal.
 
 See `allout-toggle-current-subtree-encryption' function docstring
@@ -1872,17 +1897,17 @@ at the beginning of the current entry.
 
                              Extending Allout
 
-Allout exposure and authoring activites all have associated
+Allout exposure and authoring activities all have associated
 hooks, by which independent code can cooperate with allout
 without changes to the allout core.  Here are key ones:
 
 `allout-mode-hook'
-`allout-mode-deactivate-hook' \(deprecated)
+`allout-mode-deactivate-hook' (deprecated)
 `allout-mode-off-hook'
-`allout-exposure-change-hook'
-`allout-structure-added-hook'
-`allout-structure-deleted-hook'
-`allout-structure-shifted-hook'
+`allout-exposure-change-functions'
+`allout-structure-added-functions'
+`allout-structure-deleted-functions'
+`allout-structure-shifted-functions'
 `allout-after-copy-or-kill-hook'
 `allout-post-undo-hook'
 
@@ -1939,7 +1964,7 @@ PREFIX-LEAD:
         When the PREFIX-LEAD is set to the comment-string of a
         programming language, outline structuring can be embedded in
         program code without interfering with processing of the text
-        (by emacs or the language processor) as program code.  This
+        (by Emacs or the language processor) as program code.  This
         setting happens automatically when allout mode is used in
         programming-mode buffers.  See `allout-use-mode-specific-leader'
         docstring for more detail.
@@ -1951,8 +1976,8 @@ BULLET: A character at the end of the ITEM PREFIX, it must be one of
         `allout-distinctive-bullets-string'.  When creating a TOPIC,
         plain BULLETs are by default used, according to the DEPTH of the
         TOPIC.  Choice among the distinctive BULLETs is offered when you
-        provide a universal argugment \(\\[universal-argument]) to the
-        TOPIC creation command, or when explictly rebulleting a TOPIC.  The
+        provide a universal argument (\\[universal-argument]) to the
+        TOPIC creation command, or when explicitly rebulleting a TOPIC.  The
         significance of the various distinctive bullets is purely by
         convention.  See the documentation for the above bullet strings for
         more details.
@@ -2005,7 +2030,7 @@ OPEN:     A TOPIC that is not CLOSED, though its OFFSPRING or BODY may be."
       (allout-infer-header-lead-and-primary-bullet)
       (allout-infer-body-reindent)
 
-      (set-allout-regexp)
+      (allout-set-regexp)
       (allout-add-resumptions '(allout-encryption-ciphertext-rejection-regexps
                                 allout-line-boundary-regexp
                                 extend)
@@ -2014,7 +2039,7 @@ OPEN:     A TOPIC that is not CLOSED, though its OFFSPRING or BODY may be."
                                 extend))
 
       (allout-compose-and-institute-keymap)
-      (produce-allout-mode-menubar-entries)
+      (allout-produce-mode-menubar-entries)
 
       (add-to-invisibility-spec '(allout . t))
 
@@ -2056,21 +2081,21 @@ OPEN:   A TOPIC that is not CLOSED, though its OFFSPRING or BODY may be."
                  use-layout
                  (and (not (string= allout-auto-activation "activate"))
                       (if (string= allout-auto-activation "ask")
-                          (if (y-or-n-p (format "Expose %s with layout '%s'? "
-                                                (buffer-name)
-                                                use-layout))
+                          (if (y-or-n-p (format-message
+                                         "Expose %s with layout `%s'? "
+                                         (buffer-name) use-layout))
                               t
                             (message "Skipped %s layout." (buffer-name))
                             nil)
                         t)))
         (save-excursion
-          (message "Adjusting '%s' exposure..." (buffer-name))
+          (message "Adjusting `%s' exposure..." (buffer-name))
           (goto-char 0)
           (allout-this-or-next-heading)
           (condition-case err
               (progn
                 (apply 'allout-expose-topic (list use-layout))
-                (message "Adjusting '%s' exposure... done."
+                (message "Adjusting `%s' exposure... done."
                          (buffer-name)))
             ;; Problem applying exposure -- notify user, but don't
             ;; interrupt, eg, file visit:
@@ -2100,8 +2125,8 @@ OPEN:     A TOPIC that is not CLOSED, though its OFFSPRING or BODY may be."
 
 ;;;_  > allout-overlay-insert-in-front-handler (ol after beg end
 ;;;                                                &optional prelen)
-(defun allout-overlay-insert-in-front-handler (ol after beg end
-                                                  &optional prelen)
+(defun allout-overlay-insert-in-front-handler (ol after beg _end
+                                                  &optional _prelen)
   "Shift the overlay so stuff inserted in front of it is excluded."
   (if after
       ;; ??? Shouldn't moving the overlay should be unnecessary, if overlay
@@ -2110,7 +2135,7 @@ OPEN:     A TOPIC that is not CLOSED, though its OFFSPRING or BODY may be."
 ;;;_  > allout-overlay-interior-modification-handler (ol after beg end
 ;;;                                                      &optional prelen)
 (defun allout-overlay-interior-modification-handler (ol after beg end
-                                                        &optional prelen)
+                                                        &optional _prelen)
   "Get confirmation before making arbitrary changes to invisible text.
 
 We expose the invisible text and ask for confirmation.  Refusal or
@@ -2173,7 +2198,7 @@ See `allout-overlay-interior-modification-handler' for details."
             (allout-overlay-interior-modification-handler
              overlay nil beg end nil))))))
 ;;;_  > allout-isearch-end-handler (&optional overlay)
-(defun allout-isearch-end-handler (&optional overlay)
+(defun allout-isearch-end-handler (&optional _overlay)
   "Reconcile allout outline exposure on arriving in hidden text after isearch.
 
 Optional OVERLAY parameter is for when this function is used by
@@ -2221,8 +2246,8 @@ the new value of `allout-recent-prefix-beginning'."
                                       allout-recent-prefix-beginning
                                       allout-header-subtraction)))
   allout-recent-prefix-beginning)
-;;;_  > nullify-allout-prefix-data ()
-(defsubst nullify-allout-prefix-data ()
+;;;_  > allout-nullify-prefix-data ()
+(defsubst allout-nullify-prefix-data ()
   "Mark allout prefix data as being uninformative."
   (setq allout-recent-prefix-end (point)
         allout-recent-prefix-beginning (point)
@@ -2250,7 +2275,7 @@ to return the current prefix."
                                   allout-recent-prefix-end))
 ;;;_  > allout-recent-bullet ()
 (defmacro allout-recent-bullet ()
-  "Like allout-recent-prefix, but returns bullet of last encountered prefix.
+  "Like `allout-recent-prefix', but returns bullet of last encountered prefix.
 
 All outline functions which directly do string matches to assess
 headings set the variables `allout-recent-prefix-beginning' and
@@ -2283,7 +2308,7 @@ If topic has no offspring, then the next sibling with offspring will
 determine whether or not this one is determined to be aberrant.
 
 If true, then the allout-recent-* settings are calibrated on the
-offspring that qaulifies it as aberrant, ie with depth that
+offspring that qualifies it as aberrant, ie with depth that
 exceeds the topic by more than one."
 
   ;; This is most clearly understood when considering standard-prefix-leader
@@ -2357,7 +2382,7 @@ Like `allout-current-depth', but respects hidden as well as visible topics."
           allout-recent-depth
         (progn
           ;; Oops, no prefix, nullify it:
-          (nullify-allout-prefix-data)
+          (allout-nullify-prefix-data)
           ;; ... and return 0:
           0)))))
 ;;;_    > allout-current-depth ()
@@ -2525,7 +2550,7 @@ Outermost is first."
 (defun allout-mark-active-p ()
   "True if the mark is currently or always active."
   ;; `(cond (boundp...))' (or `(if ...)') invokes special byte-compiler
-  ;; provisions, at least in fsf emacs to prevent warnings about lack of,
+  ;; provisions, at least in GNU Emacs to prevent warnings about lack of,
   ;; eg, region-active-p.
   (cond ((boundp 'mark-active)
          mark-active)
@@ -2625,13 +2650,13 @@ The remaining optional args are for internal use by the function.
 Point is left at the end of the subtree.
 
 Charts are used to capture outline structure, so that outline-altering
-routines need assess the structure only once, and then use the chart
+routines need to assess the structure only once, and then use the chart
 for their elaborate manipulations.
 
 The chart entries for the topics are in reverse order, so the
 last topic is listed first.  The entry for each topic consists of
 an integer indicating the point at the beginning of the topic
-prefix.  Charts for offspring consists of a list containing,
+prefix.  Charts for offspring consist of a list containing,
 recursively, the charts for the respective subtopics.  The chart
 for a topics' offspring precedes the entry for the topic itself.
 
@@ -2712,7 +2737,7 @@ starting point, and PREV-DEPTH is depth of prior topic."
                                        ; and maybe not preferable.
     ))
 ;;;_   > allout-chart-siblings (&optional start end)
-(defun allout-chart-siblings (&optional start end)
+(defun allout-chart-siblings (&optional _start _end)
   "Produce a list of locations of this and succeeding sibling topics.
 Effectively a top-level chart of siblings.  See `allout-chart-subtree'
 for an explanation of charts."
@@ -3030,7 +3055,7 @@ Returning depth if successful, nil if not."
       nil))
   )
 ;;;_   > allout-up-current-level (arg)
-(defun allout-up-current-level (arg)
+(defun allout-up-current-level (_arg)
   "Move out ARG levels from current visible topic."
   (interactive "p")
   (let ((start-point (point)))
@@ -3100,7 +3125,7 @@ Return the start point of the new topic if successful, nil otherwise.
 
 Costs more than regular `allout-next-sibling' for short traversals:
 
- - we have to check the prior (next, if travelling backwards)
+ - we have to check the prior (next, if traveling backwards)
    item to confirm connectivity with the prior topic, and
  - if confirmed, we have to reestablish the allout-recent-* settings with
    some extra navigation
@@ -3177,7 +3202,7 @@ Presumes point is at the start of a topic prefix."
   "Go back to the first sibling at this level, visible or not."
   (allout-end-of-level 'backward))
 ;;;_   > allout-end-of-level (&optional backward)
-(defun allout-end-of-level (&optional backward)
+(defun allout-end-of-level (&optional _backward)
   "Go to the last sibling at this level, visible or not."
 
   (let ((depth (allout-depth)))
@@ -3186,7 +3211,7 @@ Presumes point is at the start of a topic prefix."
       (if (allout-called-interactively-p) (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.
+  "Move to the next ARGth visible heading line, backward if ARG is negative.
 
 Move to buffer limit in indicated direction if headings are exhausted."
 
@@ -3334,7 +3359,7 @@ coordinating with allout activity.")
       (run-hooks 'allout-post-undo-hook)
       (cond ((and (= buffer-saved-size -1)
                   allout-auto-save-temporarily-disabled)
-             ;; user possibly undid a decryption, deinhibit auto-save:
+             ;; user possibly undid a decryption, disinhibit auto-save:
              (allout-maybe-resume-auto-save-info-after-encryption))
             ((save-excursion
                (save-restriction
@@ -3388,8 +3413,8 @@ return to regular interpretation of self-insert characters."
   "Catchall handling of key bindings in hot-spots.
 
 Translates unmodified keystrokes to corresponding allout commands, when
-they would qualify if prefixed with the allout-command-prefix, and sets
-this-command accordingly.
+they would qualify if prefixed with the `allout-command-prefix', and sets
+`this-command' accordingly.
 
 Returns the qualifying command, if any, else nil."
   (interactive)
@@ -3454,14 +3479,15 @@ Offer one suitable for current depth DEPTH as default."
 
   (let* ((default-bullet (or (and (stringp current-bullet) current-bullet)
                              (allout-bullet-for-depth depth)))
-        (sans-escapes (regexp-sans-escapes allout-bullets-string))
+        (sans-escapes (allout-regexp-sans-escapes allout-bullets-string))
         choice)
     (save-excursion
       (goto-char (allout-current-bullet-pos))
-      (setq choice (solicit-char-in-string
-                    (format "Select bullet: %s ('%s' default): "
-                            sans-escapes
-                            (allout-substring-no-properties default-bullet))
+      (setq choice (allout-solicit-char-in-string
+                    (format-message
+                     "Select bullet: %s (`%s' default): "
+                     sans-escapes
+                     (allout-substring-no-properties default-bullet))
                     sans-escapes
                     t)))
     (message "")
@@ -3533,7 +3559,7 @@ the current topics' depth.
 If INSTEAD is:
 
 - nil, then the bullet char for the context is used, per distinction or depth
-- a \(numeric) character, then character's string representation is used
+- a (numeric) character, then character's string representation is used
 - a string, then the user is asked for bullet with the first char as default
 - anything else, the user is solicited with bullet char per context as default
 
@@ -3543,7 +3569,7 @@ PRIOR-BULLET.)
 Fifth arg, NUMBER-CONTROL, matters only if `allout-numbered-bullet'
 is non-nil *and* no specific INSTEAD was specified.  Then
 NUMBER-CONTROL non-nil forces prefix to either numbered or
-denumbered format, depending on the value of the sixth arg, INDEX.
+unnumbered format, depending on the value of the sixth arg, INDEX.
 
 \(Note that NUMBER-CONTROL does *not* apply to level 1 topics.  Sorry...)
 
@@ -3557,7 +3583,7 @@ number is used as the index for the numbered prefix (allowing, eg,
 sequential renumbering to not require this function counting back the
 index for each successive sibling)."
 ;;;_    . Code:
-  ;; The options are ordered in likely frequence of use, most common
+  ;; The options are ordered in likely frequency of use, most common
   ;; highest, least lowest.  Ie, more likely to be doing prefix
   ;; adjustments than soliciting, and yet more than numbering.
   ;; Current prefix is least dominant, but most likely to be commonly
@@ -3696,7 +3722,7 @@ Nuances:
   (save-match-data
     (let* ((inhibit-field-text-motion t)
            (depth (+ (allout-current-depth) relative-depth))
-           (opening-on-blank (if (looking-at "^\$")
+           (opening-on-blank (if (looking-at "^$")
                                  (not (setq before nil))))
            ;; bunch o vars set while computing ref-topic
            opening-numbered
@@ -3807,7 +3833,7 @@ Nuances:
             ;;(if doing-beginning (goto-char doing-beginning))
             (if (not (bobp))
                 ;; We insert a newline char rather than using open-line to
-                ;; avoid rear-stickiness inheritence of read-only property.
+                ;; avoid rear-stickiness inheritance of read-only property.
                 (progn (if (and (not (> depth ref-depth))
                                 (not before))
                            (open-line 1)
@@ -3822,7 +3848,7 @@ Nuances:
                        (if (and (not (eobp))
                                 (or (not (bolp))
                                     (and (not (bobp))
-                                         ;; bolp doesnt detect concealed
+                                         ;; bolp doesn't detect concealed
                                          ;; trailing newlines, compensate:
                                          (save-excursion
                                            (forward-char -1)
@@ -3841,7 +3867,7 @@ Nuances:
                           (allout-show-children)))
       (end-of-line)
 
-      (run-hook-with-args 'allout-structure-added-hook start end)
+      (run-hook-with-args 'allout-structure-added-functions start end)
       )
     )
   )
@@ -3849,7 +3875,7 @@ Nuances:
 (defun allout-open-subtopic (arg)
   "Open new topic header at deeper level than the current one.
 
-Negative universal arg means to open deeper, but place the new topic
+Negative universal ARG means to open deeper, but place the new topic
 prior to the current one."
   (interactive "p")
   (allout-open-topic 1 (> 0 arg) (< 1 arg)))
@@ -3857,9 +3883,9 @@ prior to the current one."
 (defun allout-open-sibtopic (arg)
   "Open new topic header at same level as the current one.
 
-Positive universal arg means to use the bullet of the prior sibling.
+Positive universal ARG means to use the bullet of the prior sibling.
 
-Negative universal arg means to place the new topic prior to the current
+Negative universal ARG means to place the new topic prior to the current
 one."
   (interactive "p")
   (allout-open-topic 0 (> 0 arg) (not (= 1 arg))))
@@ -3867,7 +3893,7 @@ one."
 (defun allout-open-supertopic (arg)
   "Open new topic header at shallower level than the current one.
 
-Negative universal arg means to open shallower, but place the new
+Negative universal ARG means to open shallower, but place the new
 topic prior to the current one."
 
   (interactive "p")
@@ -3909,7 +3935,7 @@ Maintains outline hanging topic indentation if
       (if (or allout-former-auto-filler allout-use-hanging-indents)
           (funcall use-auto-fill-function)))))
 ;;;_    > allout-reindent-body (old-depth new-depth &optional number)
-(defun allout-reindent-body (old-depth new-depth &optional number)
+(defun allout-reindent-body (old-depth new-depth &optional _number)
   "Reindent body lines which were indented at OLD-DEPTH to NEW-DEPTH.
 
 Optional arg NUMBER indicates numbering is being added, and it must
@@ -3966,7 +3992,7 @@ Note that refill of indented paragraphs is not done."
                                                nil     ;;; number-control
                                                nil     ;;; index
                                                t)      ;;; do-successors
-                      (run-hook-with-args 'allout-exposure-change-hook
+                      (run-hook-with-args 'allout-exposure-change-functions
                                           from to t))
       (setq arg (1- arg))
       (if (<= arg 0)
@@ -3992,7 +4018,7 @@ All args are optional.
 
 If INSTEAD is:
 - nil, then the bullet char for the context is used, per distinction or depth
-- a \(numeric) character, then character's string representation is used
+- a (numeric) character, then character's string representation is used
 - a string, then the user is asked for bullet with the first char as default
 - anything else, the user is solicited with bullet char per context as default
 
@@ -4033,7 +4059,7 @@ this function."
                                                 number-control
                                                 index)))
 
-    ;; Is new one is identical to old?
+    ;; Is new one identical to old?
     (if (and (= current-depth new-depth)
              (string= current-bullet
                       (substring new-prefix (1- (length new-prefix)))))
@@ -4067,7 +4093,7 @@ this function."
                (not (allout-encrypted-topic-p)))
          (allout-reindent-body current-depth new-depth))
 
-      (run-hook-with-args 'allout-exposure-change-hook mb me nil)
+      (run-hook-with-args 'allout-exposure-change-functions mb me nil)
 
       ;; Recursively rectify successive siblings of orig topic if
       ;; caller elected for it:
@@ -4329,7 +4355,7 @@ the file can be adjusted to any positive depth, however."
                   (allout-show-children))))))
     (let ((where (point)))
       (allout-rebullet-topic 1 (and (> arg 1) 'sans-offspring))
-      (run-hook-with-args 'allout-structure-shifted-hook arg where))))
+      (run-hook-with-args 'allout-structure-shifted-functions arg where))))
 ;;;_    > allout-shift-out (arg)
 (defun allout-shift-out (arg)
   "Decrease depth of current heading and any topics collapsed within it.
@@ -4369,7 +4395,7 @@ subtopics into siblings of the item."
                   (goto-char child-point)
                   (allout-shift-out 1))))
           (allout-rebullet-topic (* arg -1))))
-      (run-hook-with-args 'allout-structure-shifted-hook (* arg -1) where))))
+      (run-hook-with-args 'allout-structure-shifted-functions (* arg -1) where))))
 ;;;_   : Surgery (kill-ring) functions with special provisions for outlines:
 ;;;_    > allout-kill-line (&optional arg)
 (defun allout-kill-line (&optional arg)
@@ -4404,10 +4430,10 @@ subtopics into siblings of the item."
               (if (not (save-match-data (looking-at allout-regexp)))
                   (allout-next-heading))
               (allout-renumber-to-depth depth)))
-        (run-hook-with-args 'allout-structure-deleted-hook depth (point))))))
+        (run-hook-with-args 'allout-structure-deleted-functions depth (point))))))
 ;;;_    > allout-copy-line-as-kill ()
 (defun allout-copy-line-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
@@ -4452,7 +4478,7 @@ Topic exposure is marked with text-properties, to be used by
 
       (save-excursion
         (allout-renumber-to-depth depth))
-      (run-hook-with-args 'allout-structure-deleted-hook depth (point)))))
+      (run-hook-with-args 'allout-structure-deleted-functions 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."
@@ -4538,7 +4564,7 @@ Topic exposure is marked with text-properties, to be used by
             (if next (goto-char next)))))
       (set-buffer-modified-p was-modified))))
 ;;;_    > allout-yank-processing ()
-(defun allout-yank-processing (&optional arg)
+(defun allout-yank-processing (&optional _arg)
 
   "Incidental allout-specific business to be done just after text yanks.
 
@@ -4664,7 +4690,7 @@ however, are left exactly like normal, non-allout-specific yanks."
         (allout-deannotate-hidden (allout-mark-marker t) (point)))
       (if (not resituate)
           (exchange-point-and-mark))
-      (run-hook-with-args 'allout-structure-added-hook subj-beg subj-end))))
+      (run-hook-with-args 'allout-structure-added-functions subj-beg subj-end))))
 ;;;_    > allout-yank (&optional arg)
 (defun allout-yank (&optional arg)
   "`allout-mode' yank, with depth and numbering adjustment of yanked topics.
@@ -4761,9 +4787,9 @@ by pops to non-distinctive yanks.  Bug..."
 ;;;_   > allout-flag-region (from to flag)
 (defun allout-flag-region (from to flag)
   "Conceal text between FROM and TO if FLAG is non-nil, else reveal it.
-
-Exposure-change hook `allout-exposure-change-hook' is run with the same
-arguments as this function, after the exposure changes are made."
+After the exposure changes are made, run the abnormal hook
+`allout-exposure-change-functions' with the same arguments as
+this function."
 
   ;; We use outline invisibility spec.
   (remove-overlays from to 'category 'allout-exposure-category)
@@ -4779,7 +4805,7 @@ arguments as this function, after the exposure changes are made."
                 (overlay-put o (pop props) (pop props))
               (error nil))))))
     (setq allout-this-command-hid-text t))
-  (run-hook-with-args 'allout-exposure-change-hook from to flag))
+  (run-hook-with-args 'allout-exposure-change-functions from to flag))
 ;;;_   > allout-flag-current-subtree (flag)
 (defun allout-flag-current-subtree (flag)
   "Conceal currently-visible topic's subtree if FLAG non-nil, else reveal it."
@@ -5110,15 +5136,15 @@ Simple (numeric and null-list) specs are interpreted as follows:
   -  - exposes the body of the corresponding topic.
 
 Examples:
-\(allout-expose-topic '(-1 : 0))
+\(allout-expose-topic \\='(-1 : 0))
        Close this and all following topics at current level, exposing
        only their immediate children, but close down the last topic
        at this current level completely.
-\(allout-expose-topic '(-1 () : 1 0))
+\(allout-expose-topic \\='(-1 () : 1 0))
        Close current topic so only the immediate subtopics are shown;
        show the children in the second to last topic, and completely
        close the last one.
-\(allout-expose-topic '(-2 : -1 *))
+\(allout-expose-topic \\='(-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 open the last one."
@@ -5284,11 +5310,11 @@ Examples:
         Expose children and grandchildren of first topic at current
        level, and expose children of subsequent topics at current
        level *except* for the last, which should be opened completely."
-  (list 'save-excursion
-       '(if (not (or (allout-goto-prefix-doublechecked)
-                     (allout-next-heading)))
-            (error "allout-new-exposure: Can't find any outline topics"))
-       (list 'allout-expose-topic (list 'quote spec))))
+  `(save-excursion
+     (if (not (or (allout-goto-prefix-doublechecked)
+                 (allout-next-heading)))
+        (error "allout-new-exposure: Can't find any outline topics"))
+     (allout-expose-topic ',spec)))
 
 ;;;_ #7 Systematic outline presentation -- copying, printing, flattening
 
@@ -5321,7 +5347,7 @@ Optional arg CONTEXT indicates interior levels to include."
                        (cons (make-string
                               (1+ (truncate (if (zerop (car flat-index))
                                                 1
-                                              (log10 (car flat-index)))))
+                                              (log (car flat-index) 10))))
                               ? )
                              result)))
            (setq flat-index (cdr flat-index)))
@@ -5361,7 +5387,7 @@ Optional arg CONTEXT indicates interior levels to include."
                        (cons (make-string
                               (1+ (truncate (if (zerop (car flat-index))
                                                 1
-                                              (log10 (car flat-index)))))
+                                              (log (car flat-index) 10))))
                               ? )
                              result)))
            (setq flat-index (cdr flat-index)))
@@ -5500,7 +5526,7 @@ header and body.  The elements of that list are:
 ;;_   > allout-process-exposed (&optional func from to frombuf
 ;;;                                        tobuf format)
 (defun allout-process-exposed (&optional func from to frombuf tobuf
-                                         format start-num)
+                                        format _start-num)
   "Map function on exposed parts of current topic; results to another buffer.
 
 All args are options; default values itemized below.
@@ -5537,9 +5563,8 @@ Defaults:
          ;; 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."))
+               (error "allout-process-exposed: source buffer %s not found."
+                      frombuf)
              (setq frombuf got))))
     ;; not specified -- default it:
     (setq frombuf (current-buffer)))
@@ -5565,9 +5590,9 @@ Defaults:
 
 LISTIFIED is a list representing each topic header and body:
 
\`(depth prefix text)'
+ `(depth prefix text)'
 
-or \`(depth prefix text bullet-plus)'
+or `(depth prefix text bullet-plus)'
 
 If `bullet-plus' is specified, it is inserted just after the entire prefix."
   (setq listified (cdr listified))
@@ -5664,7 +5689,7 @@ used verbatim."
 
 ;;;_  - LaTeX formatting
 ;;;_   > allout-latex-verb-quote (string &optional flow)
-(defun allout-latex-verb-quote (string &optional flow)
+(defun allout-latex-verb-quote (string &optional _flow)
   "Return copy of STRING for literal reproduction across LaTeX processing.
 Expresses the original characters (including carriage returns) of the
 string across LaTeX processing."
@@ -5685,7 +5710,7 @@ across LaTeX processing, within the context of a `verbatim'
 environment.  Leaves point at the end of the line."
   (let ((inhibit-field-text-motion t))
     (beginning-of-line)
-    (let ((beg (point))
+    (let (;(beg (point))
           (end (point-at-eol)))
       (save-match-data
         (while (re-search-forward "\\\\"
@@ -5769,7 +5794,7 @@ environment.  Leaves point at the end of the line."
   (set-buffer buffer)
   (insert "\n\\end{document}\n"))
 ;;;_   > allout-latexify-one-item (depth prefix bullet text)
-(defun allout-latexify-one-item (depth prefix bullet text)
+(defun allout-latexify-one-item (depth _prefix bullet text)
   "Insert LaTeX commands for formatting one outline item.
 
 Args are the topics numeric DEPTH, the header PREFIX lead string, the
@@ -5854,12 +5879,12 @@ With repeat count, copy the exposed portions of entire buffer."
 (defun allout-toggle-current-subtree-encryption (&optional keymode-cue)
   "Encrypt clear or decrypt encoded topic text.
 
-Allout uses emacs 'epg' libary to perform encryption.  Symmetric
+Allout uses Emacs `epg' library to perform encryption.  Symmetric
 and keypair encryption are supported.  All encryption is ascii
 armored.
 
 Entry encryption defaults to symmetric key mode unless keypair
-recipients are associated with the file \(see
+recipients are associated with the file (see
 `epa-file-encrypt-to') or the function is invoked with a
 \(KEYMODE-CUE) universal argument greater than 1.
 
@@ -5871,7 +5896,7 @@ encryption.
 Further, encrypting with a KEYMODE-CUE universal argument greater
 than 4 - eg, preceded by a doubled Ctrl-U - causes association of
 the specified recipients with the file, replacing those currently
-associated with it.  This can be used to deassociate any
+associated with it.  This can be used to dissociate any
 recipients with the file, by selecting no recipients in the
 dialog.
 
@@ -5881,10 +5906,10 @@ pending encryption or encrypted.  `*' asterisk immediately after
 the bullet signals that the body is encrypted, its absence means
 the topic is meant to be encrypted but is not currently.  When a
 file with topics pending encryption is saved, topics pending
-encryption are encrypted.  See allout-encrypt-unencrypted-on-saves
+encryption are encrypted.  See `allout-encrypt-unencrypted-on-saves'
 for auto-encryption specifics.
 
-\*NOTE WELL* that automatic encryption that happens during saves will
+*NOTE WELL* that automatic encryption that happens during saves will
 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.
 
@@ -5900,7 +5925,7 @@ encrypted.  If you want to encrypt the contents of a top-level topic, use
   "Encrypt clear text or decrypt encoded topic contents (body and subtopics.)
 
 Entry encryption defaults to symmetric key mode unless keypair
-recipients are associated with the file \(see
+recipients are associated with the file (see
 `epa-file-encrypt-to') or the function is invoked with a
 \(KEYMODE-CUE) universal argument greater than 1.
 
@@ -5912,11 +5937,11 @@ encryption.
 Further, encrypting with a KEYMODE-CUE universal argument greater
 than 4 - eg, preceded by a doubled Ctrl-U - causes association of
 the specified recipients with the file, replacing those currently
-associated with it.  This can be used to deassociate any
+associated with it.  This can be used to dissociate any
 recipients with the file, by selecting no recipients in the
 dialog.
 
-Encryption and decryption uses the emacs epg library.
+Encryption and decryption uses the Emacs `epg' library.
 
 Encrypted text will be ascii-armored.
 
@@ -6018,8 +6043,18 @@ See `allout-toggle-current-subtree-encryption' for more details."
           (allout-inhibit-auto-save-info-for-decryption was-buffer-saved-size)
         (allout-maybe-resume-auto-save-info-after-encryption))
 
-      (run-hook-with-args 'allout-structure-added-hook
+      (run-hook-with-args 'allout-structure-added-functions
                           bullet-pos subtree-end))))
+
+(declare-function epg-context-set-passphrase-callback "epg"
+                  (context passphrase-callback))
+(declare-function epg-list-keys "epg" (context &optional name mode))
+(declare-function epg-decrypt-string "epg" (context cipher))
+(declare-function epg-encrypt-string "epg"
+                  (context plain recipients &optional sign always-trust))
+(declare-function epg-user-id-string "epg" (user-id) t)
+(declare-function epg-key-user-id-list "epg" (key) t)
+
 ;;;_  > allout-encrypt-string (text decrypt allout-buffer keymode-cue
 ;;;                                 &optional rejected)
 (defun allout-encrypt-string (text decrypt allout-buffer keymode-cue
@@ -6033,7 +6068,7 @@ If DECRYPT is true (default false), then decrypt instead of encrypt.
 ALLOUT-BUFFER identifies the buffer containing the text.
 
 Entry encryption defaults to symmetric key mode unless keypair
-recipients are associated with the file \(see
+recipients are associated with the file (see
 `epa-file-encrypt-to') or the function is invoked with a
 \(KEYMODE-CUE) universal argument greater than 1.
 
@@ -6045,7 +6080,7 @@ encryption.
 Further, encrypting with a KEYMODE-CUE universal argument greater
 than 4 - eg, preceded by a doubled Ctrl-U - causes association of
 the specified recipients with the file, replacing those currently
-associated with it.  This can be used to deassociate any
+associated with it.  This can be used to dissociate any
 recipients with the file, by selecting no recipients in the
 dialog.
 
@@ -6057,9 +6092,9 @@ rejections due to matches against
 NOTE: A few GnuPG v2 versions improperly preserve incorrect
 symmetric decryption keys, preventing entry of the correct key on
 subsequent decryption attempts until the cache times-out.  That
-can take several minutes.  \(Decryption of other entries is not
+can take several minutes.  (Decryption of other entries is not
 affected.)  Upgrade your EasyPG version, if you can, and you can
-deliberately clear your gpg-agent's cache by sending it a '-HUP'
+deliberately clear your gpg-agent's cache by sending it a `-HUP'
 signal."
 
   (require 'epg)
@@ -6196,7 +6231,7 @@ signal."
 (defun allout-inhibit-auto-save-info-for-decryption (was-buffer-saved-size)
   "Temporarily prevent auto-saves in this buffer when an item is decrypted.
 
-WAS-BUFFER-SAVED-SIZE is the value of buffer-saved-size *before*
+WAS-BUFFER-SAVED-SIZE is the value of `buffer-saved-size' *before*
 the decryption."
   (when (not (or (= buffer-saved-size -1) (= was-buffer-saved-size -1)))
     (setq allout-auto-save-temporarily-disabled was-buffer-saved-size
@@ -6229,8 +6264,8 @@ the decryption."
   "Return the point of the next topic pending encryption, or nil if none.
 
 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."
+immediately following `*' that would mark the topic as being encrypted.
+It must also have content."
   (let (done got content-beg)
     (save-match-data
       (while (not done)
@@ -6307,7 +6342,7 @@ save.  See `allout-encrypt-unencrypted-on-saves' for more info."
                   ;; we had to wait for this 'til now so prior topics are
                   ;; encrypted, any relevant text shifts are in place:
                   editing-point (- current-mark-position
-                                   (count-trailing-whitespace-region
+                                   (allout-count-trailing-whitespace-region
                                     bo-subtree current-mark-position))))
           (allout-toggle-subtree-encryption)
           (if (not was-modified)
@@ -6328,11 +6363,11 @@ save.  See `allout-encrypt-unencrypted-on-saves' for more info."
 ;;;###autoload
 (defalias 'outlinify-sticky 'outlineify-sticky)
 ;;;###autoload
-(defun outlineify-sticky (&optional arg)
+(defun outlineify-sticky (&optional _arg)
   "Activate outline mode and establish file var so it is started subsequently.
 
 See `allout-layout' and customization of `allout-auto-activation'
-for details on preparing emacs for automatic allout activation."
+for details on preparing Emacs for automatic allout activation."
 
   (interactive "P")
 
@@ -6344,8 +6379,9 @@ for details on preparing emacs for automatic allout activation."
     (if (allout-goto-prefix)
        t
       (allout-open-topic 2)
-      (insert (concat "Dummy outline topic header -- see"
-                      "`allout-mode' docstring: `^Hm'."))
+      (insert (substitute-command-keys
+               (concat "Dummy outline topic header -- see"
+                       " `allout-mode' docstring: `\\[describe-mode]'.")))
       (allout-adjust-file-variable
        "allout-layout" (or allout-layout '(-1 : 0))))))
 ;;;_   > allout-file-vars-section-data ()
@@ -6380,7 +6416,7 @@ Returns a list of the form (BEGINNING-POINT PREFIX-STRING SUFFIX-STRING)."
 (defun allout-adjust-file-variable (varname value)
   "Adjust the setting of an Emacs file variable named VARNAME to VALUE.
 
-This activity is inhibited if either `enable-local-variables'
+This activity is inhibited if either `enable-local-variables' or
 `allout-enable-file-variable-adjustment' are nil.
 
 When enabled, an entry for the variable is created if not already present,
@@ -6454,8 +6490,9 @@ 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? "
-                                   configvar-name sym))
+          (if (yes-or-no-p (format-message
+                           "%s entry `%s' is unbound -- remove it? "
+                           configvar-name sym))
               (delq sym (symbol-value configvar-name)))
         (push (symbol-value sym) got)))
     (reverse got)))
@@ -6471,8 +6508,8 @@ not its value."
   (allout-end-of-current-subtree)
   (exchange-point-and-mark))
 ;;;_  : UI:
-;;;_   > solicit-char-in-string (prompt string &optional do-defaulting)
-(defun solicit-char-in-string (prompt string &optional do-defaulting)
+;;;_   > allout-solicit-char-in-string (prompt string &optional do-defaulting)
+(defun allout-solicit-char-in-string (prompt string &optional do-defaulting)
   "Solicit (with first arg PROMPT) choice of a character from string STRING.
 
 Optional arg DO-DEFAULTING indicates to accept empty input (CR)."
@@ -6505,11 +6542,11 @@ Optional arg DO-DEFAULTING indicates to accept empty input (CR)."
       got)
   )
 ;;;_  : Strings:
-;;;_   > regexp-sans-escapes (string)
-(defun regexp-sans-escapes (regexp &optional successive-backslashes)
+;;;_   > allout-regexp-sans-escapes (string)
+(defun allout-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."
@@ -6525,11 +6562,11 @@ Optional arg SUCCESSIVE-BACKSLASHES is used internally for recursion."
     (if (or (not successive-backslashes) (= 2 successive-backslashes))
        ;; Include first char:
        (concat (substring regexp 0 1)
-               (regexp-sans-escapes (substring regexp 1)))
+               (allout-regexp-sans-escapes (substring regexp 1)))
       ;; Exclude first char, but maintain count:
-      (regexp-sans-escapes (substring regexp 1) successive-backslashes))))
-;;;_   > count-trailing-whitespace-region (beg end)
-(defun count-trailing-whitespace-region (beg end)
+      (allout-regexp-sans-escapes (substring regexp 1) successive-backslashes))))
+;;;_   > allout-count-trailing-whitespace-region (beg end)
+(defun allout-count-trailing-whitespace-region (beg end)
   "Return number of trailing whitespace chars between BEG and END.
 
 If BEG is bigger than END we return 0."
@@ -6661,7 +6698,7 @@ To ignore intangibility, bind `inhibit-point-motion-hooks' to t."
       (if (/= arg 1)
           (condition-case nil (line-move (1- arg)) (error nil)))
 
-      ;; Move to beginning-of-line, ignoring fields and invisibles.
+      ;; Move to beginning-of-line, ignoring fields and invisible text.
       (skip-chars-backward "^\n")
       (while (and (not (bobp))
                   (let ((prop
@@ -6761,9 +6798,9 @@ To ignore intangibility, bind `inhibit-point-motion-hooks' to t."
   "Isearch (regexp) for topic with bullet BULLET."
   (interactive)
   (if (not bullet)
-      (setq bullet (solicit-char-in-string
+      (setq bullet (allout-solicit-char-in-string
                    "ISearch for topic with bullet: "
-                   (regexp-sans-escapes allout-bullets-string))))
+                   (allout-regexp-sans-escapes allout-bullets-string))))
 
   (let ((isearch-regexp t)
        (isearch-string (concat "^"