]> code.delx.au - gnu-emacs/blobdiff - lisp/allout.el
Merged in changes from CVS HEAD
[gnu-emacs] / lisp / allout.el
index 17ccac191380282603f11e2fa9046cf1e93e273f..eb7ce68fdbc9d5fc56da2a3780a92d8dfa503194 100644 (file)
@@ -1,11 +1,11 @@
 ;;; allout.el --- extensive outline mode for use alone and with other modes
 
-;; Copyright (C) 1992, 1993, 1994, 2001 Free Software Foundation, Inc.
+;; Copyright (C) 1992, 1993, 1994, 2001, 2002 Free Software Foundation, Inc.
 
-;; Author: Ken Manheimer <klm@python.org>
-;; Maintainer: Ken Manheimer <klm@python.org>
+;; Author: Ken Manheimer <klm@zope.com>
+;; Maintainer: Ken Manheimer <klm@zope.com>
 ;; Created: Dec 1991 - first release to usenet
-;; Version: $Id: allout.el,v 1.35 2002/12/16 00:20:42 rost Exp $||
+;; Version: $Id: allout.el,v 1.47 2004/03/21 15:21:38 lektu Exp $||
 ;; Keywords: outlines mode wp languages
 
 ;; This file is part of GNU Emacs.
 ;; exposure.  It also provides for syntax-sensitive text like
 ;; programming languages.  (For an example, see the allout code
 ;; itself, which is organized in ;; an outline framework.)
-;; 
+;;
 ;; In addition to outline navigation and exposure, allout includes:
-;; 
+;;
 ;;  - topic-oriented repositioning, cut, and paste
 ;;  - integral outline exposure-layout
 ;;  - incremental search with dynamic exposure and reconcealment of hidden text
 ;;  - automatic topic-number maintenance
 ;;  - "Hot-spot" operation, for single-keystroke maneuvering and
 ;;    exposure control.  (See the `allout-mode' docstring.)
-;; 
+;;
 ;; and many other features.
-;; 
+;;
 ;; The outline menubar additions provide quick reference to many of
-;; the features, and see the docstring of the variable `allout-init'
+;; the features, and see the docstring of the function `allout-init'
 ;; for instructions on priming your emacs session for automatic
 ;; activation of `allout-mode'.
-;; 
+;;
 ;; See the docstring of the variables `allout-layout' and
 ;; `allout-auto-activation' for details on automatic activation of
 ;; allout `allout-mode' as a minor mode.  (It has changed since allout
 ;; Note - the lines beginning with `;;;_' are outline topic headers.
 ;;        Just `ESC-x eval-current-buffer' to give it a whirl.
 
-;; Ken Manheimer       klm@python.org
+;; Ken Manheimer       klm@zope.com
 
 ;;; Code:
 
 ;;;_* Provide
-(provide 'outline)
 (provide 'allout)
 
 ;;;_* USER CUSTOMIZATION VARIABLES:
 (defgroup allout nil
   "Extensive outline mode for use alone and with other modes."
   :prefix "allout-"
-  :group 'outlines)
+  :group 'editing)
 
 ;;;_ + Layout, Mode, and Topic Header Configuration
 
@@ -83,17 +82,17 @@ outline mode is automatically activated when the buffer-specific
 variable `allout-layout' is non-nil, and whether or not the layout
 dictated by `allout-layout' should be imposed on mode activation.
 
-With value `t', auto-mode-activation and auto-layout are enabled.
-\(This also depends on `allout-find-file-hooks' being installed in
+With value t, auto-mode-activation and auto-layout are enabled.
+\(This also depends on `allout-find-file-hook' being installed in
 `find-file-hooks', which is also done by `allout-init'.)
 
 With value `ask', auto-mode-activation is enabled, and endorsement for
 performing auto-layout is asked of the user each time.
 
-With value `activate', only auto-mode-activation is enabled, 
+With value `activate', only auto-mode-activation is enabled,
 auto-layout is not.
 
-With value `nil', neither auto-mode-activation nor auto-layout are
+With value nil, neither auto-mode-activation nor auto-layout are
 enabled.
 
 See the docstring for `allout-init' for the proper interface to
@@ -110,8 +109,8 @@ this variable."
 Buffer-specific.
 
 A list value specifies a default layout for the current buffer, to be
-applied upon activation of allout `allout-mode'.  Any non-nil value will
-automatically trigger allout `allout-mode', provided `allout-init'
+applied upon activation of `allout-mode'.  Any non-nil value will
+automatically trigger `allout-mode', provided `allout-init'
 has been called to enable it.
 
 See the docstring for `allout-init' for details on setting up for
@@ -190,7 +189,7 @@ of this var to take effect."
 
 These bullets are used to distinguish topics from the run-of-the-mill
 ones.  They are not used in the standard topic headers created by
-the topic-opening, shifting, and rebulleting \(eg, on topic shift, 
+the topic-opening, shifting, and rebulleting \(eg, on topic shift,
 topic paste, blanket rebulleting) routines, but are offered among the
 choices for rebulleting.  They are not altered by the above automatic
 rebulleting, so they can be used to characterize topics, eg:
@@ -227,14 +226,14 @@ so topic headers look like comments in the programming language.
 
 String values are used as they stand.
 
-Value `t' means to first check for assoc value in `allout-mode-leaders'
+Value t means to first check for assoc value in `allout-mode-leaders'
 alist, then use comment-start string, if any, then use default \(`.').
 \(See note about use of comment-start strings, below.)
 
 Set to the symbol for either of `allout-mode-leaders' or
 `comment-start' to use only one of them, respectively.
 
-Value `nil' means to always use the default \(`.').
+Value nil means to always use the default \(`.').
 
 comment-start strings that do not end in spaces are tripled, and an
 `_' underscore is tacked on the end, to distinguish them from regular
@@ -243,7 +242,7 @@ tripled, but an underscore 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
 incorrect.]"
-  :type '(choice (const t) (const nil) string 
+  :type '(choice (const t) (const nil) string
                 (const allout-mode-leaders)
                 (const comment-start))
   :group 'allout)
@@ -261,7 +260,7 @@ from regular comments that start at bol.")
 
 ;;;_  = allout-old-style-prefixes
 (defcustom allout-old-style-prefixes nil
-  "*When non-nil, use only old-and-crusty allout-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
@@ -481,7 +480,7 @@ When active, topic body lines that are indented even with or beyond
 their topic header are reindented to correspond with depth shifts of
 the header.
 
-A value of `t' enables reindent in non-programming-code buffers, ie
+A value of t enables reindent in non-programming-code buffers, ie
 those that do not have the variable `comment-start' set.  A value of
 `force' enables reindent whether or not `comment-start' is set."
   :type '(choice (const nil) (const t) (const text) (const force))
@@ -509,7 +508,7 @@ behavior."
 ;;;_  : Version
 ;;;_   = allout-version
 (defvar allout-version
-  (let ((rcs-rev "$Revision: 1.35 $"))
+  (let ((rcs-rev "$Revision: 1.47 $"))
     (condition-case err
        (save-match-data
          (string-match "Revision: \\([0-9]+\\.[0-9]+\\)" rcs-rev)
@@ -547,7 +546,7 @@ and `allout-distinctive-bullets-string'.")
 (make-variable-buffer-local 'allout-bullets-string-len)
 ;;;_   = allout-line-boundary-regexp
 (defvar allout-line-boundary-regexp ()
-  "Allout-regexp with allout-style beginning-of-line anchor.
+  "`allout-regexp' with outline style beginning-of-line anchor.
 
 \(Ie, C-j, *or* C-m, for prefixes of hidden topics).  This is properly
 set when `allout-regexp' is produced by `set-allout-regexp', so
@@ -790,16 +789,16 @@ activation.  Being deprecated.")
                      "----"
                      ["Duplicate Exposed" allout-copy-exposed-to-buffer t]
                      ["Duplicate Exposed, numbered"
-                      allout-flatten-exposed-to-buffer t] 
+                      allout-flatten-exposed-to-buffer t]
                      ["Duplicate Exposed, indented"
-                      allout-indented-exposed-to-buffer t] 
+                      allout-indented-exposed-to-buffer t]
                      "----"
                      ["Set Header Lead" allout-reset-header-lead t]
                      ["Set New Exposure" allout-expose-topic t])))
 ;;;_  : Mode-Specific Variable Maintenance Utilities
 ;;;_   = allout-mode-prior-settings
 (defvar allout-mode-prior-settings nil
-  "Internal outline mode use; settings to be resumed on mode deactivation.")
+  "Internal `allout-mode' use; settings to be resumed on mode deactivation.")
 (make-variable-buffer-local 'allout-mode-prior-settings)
 ;;;_   > allout-resumptions (name &optional value)
 (defun allout-resumptions (name &optional value)
@@ -894,7 +893,7 @@ It's automatically reset to nil after every buffer modification.")
 (make-variable-buffer-local 'allout-override-protect)
 ;;;_   > allout-unprotected (expr)
 (defmacro allout-unprotected (expr)
-  "Evaluate EXPRESSION with `allout-override-protect' let-bound `t'."
+  "Evaluate EXPRESSION with `allout-override-protect' let-bound t."
   `(let ((allout-override-protect t))
      ,expr))
 ;;;_   = allout-undo-aggregation
@@ -911,9 +910,9 @@ mode from prop-line file-var activation.  Used by `allout-mode' function
 to track repeats.")
 ;;;_   > allout-write-file-hook ()
 (defun allout-write-file-hook ()
-  "In outline mode, run as a `local-write-file-hooks' activity.
+  "In `allout-mode', run as a `local-write-file-hooks' activity.
 
-Currently just sets `allout-during-write-cue', so allout-change-protection
+Currently just sets `allout-during-write-cue', so outline change-protection
 knows to keep inactive during file write."
   (setq allout-during-write-cue t)
   nil)
@@ -928,10 +927,11 @@ knows to keep inactive during file write."
   'allout-mode)
 ;;;_  = allout-explicitly-deactivated
 (defvar allout-explicitly-deactivated nil
-  "Allout-mode was last deliberately deactivated.
+  "Non-nil if `allout-mode' was last deliberately deactivated.
 So `allout-post-command-business' should not reactivate it...")
 (make-variable-buffer-local 'allout-explicitly-deactivated)
 ;;;_  > allout-init (&optional mode)
+;;;###autoload
 (defun allout-init (&optional mode)
   "Prime `allout-mode' to enable/disable auto-activation, wrt `allout-layout'.
 
@@ -950,9 +950,9 @@ of allout outline mode, contingent to the buffer-specific setting of
 the `allout-layout' variable.  (See `allout-layout' and
 `allout-expose-topic' docstrings for more details on auto layout).
 
-`allout-init' works by setting up (or removing) the allout-mode
-find-file-hook, and giving `allout-auto-activation' a suitable
-setting.
+`allout-init' works by setting up (or removing)
+`allout-find-file-hook' in `find-file-hooks', and giving
+`allout-auto-activation' a suitable setting.
 
 To prime your emacs session for full auto-outline operation, include
 the following two lines in your emacs init file:
@@ -984,10 +984,11 @@ the following two lines in your emacs init file:
           (if (interactive-p)
               (message "Allout outline mode auto-activation inhibited.")))
          ((eq mode 'report)
-          (if (not (memq hook find-file-hooks))
-              (allout-init nil)
-            ;; Just punt and use the reports from each of the modes:
-            (allout-init (symbol-value curr-mode))))
+          (if (memq hook find-file-hooks)
+              ;; Just punt and use the reports from each of the modes:
+              (allout-init (symbol-value curr-mode))
+            (allout-init nil)
+            (message "Allout outline mode auto-activation inhibited.")))
          (t (add-hook 'find-file-hooks hook)
             (set curr-mode             ; `set', not `setq'!
                  (cond ((eq mode 'activate)
@@ -1005,10 +1006,10 @@ the following two lines in your emacs init file:
                        ((message
                          "Outline mode auto-activation and -layout enabled.")
                         'full)))))))
-                  
+
 ;;;_  > allout-setup-menubar ()
 (defun allout-setup-menubar ()
-  "Populate the current buffer's menubar with allout allout-mode stuff."
+  "Populate the current buffer's menubar with `allout-mode' stuff."
   (let ((menus (list allout-mode-exposure-menu
                     allout-mode-editing-menu
                     allout-mode-navigation-menu
@@ -1027,7 +1028,7 @@ the following two lines in your emacs init file:
 Optional arg forces mode to re-initialize iff arg is positive num or
 symbol.  Allout outline mode always runs as a minor mode.
 
-Allout outline mode provides extensive allout-oriented formatting and
+Allout outline mode 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
@@ -1048,7 +1049,7 @@ and many other features.
 Below is a description of the bindings, and then explanation of
 special `allout-mode' features and terminology.  See also the outline
 menubar additions for quick reference to many of the features, and see
-the docstring of the variable `allout-init' for instructions on
+the docstring of the function `allout-init' for instructions on
 priming your emacs session for automatic activation of `allout-mode'.
 
 
@@ -1078,7 +1079,7 @@ C-c <     allout-shift-out        ... less deep.
 C-c<CR>        allout-rebullet-topic   Reconcile bullets of topic and its offspring
                                - distinctive bullets are not changed, others
                                  alternated according to nesting depth.
-C-c b  allout-rebullet-current-heading Prompt for alternate bullet for
+C-c *  allout-rebullet-current-heading Prompt for alternate bullet for
                                         current topic.
 C-c #  allout-number-siblings  Number bullets of topic and siblings - the
                                offspring are not affected.  With repeat
@@ -1176,7 +1177,7 @@ PREFIX-LEAD:
        `allout-header-prefix' and then reinitializing `allout-mode'.
 
        By setting the prefix-lead to the comment-string of a
-       programming language, you can embed allout-structuring in
+       programming language, you can embed outline structuring in
        program code without interfering with the language processing
        of that code.  See `allout-use-mode-specific-leader'
        docstring for more detail.
@@ -1237,7 +1238,7 @@ OPEN:     A topic that is not closed, though its offspring or body may be."
      ;; off on second invocation, so we detect it as best we can, and
      ;; skip everything.
      ((and same-complex-command                ; Still in same complex command
-                                      ; as last time `allout-mode' invoked.
+                                       ; as last time `allout-mode' invoked.
          active                        ; Already activated.
          (not explicit-activation)     ; Prop-line file-vars don't have args.
          (string-match "^19.1[89]"     ; Bug only known to be in v19.18 and
@@ -1364,7 +1365,7 @@ OPEN:     A topic that is not closed, though its offspring or body may be."
 
       (or (assq 'allout-mode minor-mode-alist)
          (setq minor-mode-alist
-              (cons '(allout-mode " Outl") minor-mode-alist)))
+              (cons '(allout-mode " Allout") minor-mode-alist)))
 
       (allout-setup-menubar)
 
@@ -1650,7 +1651,7 @@ Optional argument LEVELS specifies the depth \(relative to start
 depth) for the chart.  Subsequent optional args are not for public
 use.
 
-Charts are used to capture outline structure, so that allout-altering
+Charts are used to capture outline structure, so that outline altering
 routines need assess the structure only once, and then use the chart
 for their elaborate manipulations.
 
@@ -2019,7 +2020,7 @@ Return depth if successful, nil otherwise."
         nil))))
 ;;;_   > allout-previous-sibling (&optional depth backward)
 (defun allout-previous-sibling (&optional depth backward)
-  "Like `allout-forward-current-level',but backwards & respect invisible topics.
+  "Like `allout-forward-current-level', but backwards & respect invisible topics.
 
 Optional DEPTH specifies depth to traverse, default current depth.
 
@@ -2330,19 +2331,19 @@ are mapped to the command of the corresponding control-key on the
 ;;;_   > allout-pre-command-business ()
 (defun allout-pre-command-business ()
   "Outline `pre-command-hook' function for outline buffers.
-Implements special behavior when cursor is on bullet char.
+Implements special behavior when cursor is on bullet character.
 
-Self-insert characters are reinterpreted control-character references
-into the `allout-mode-map'.  The `allout-mode' post-command hook will
-position a cursor that has moved as a result of such reinterpretation,
-on the destination topic's bullet, when the cursor wound up in the
+When the cursor is on the bullet character, self-insert characters are
+reinterpreted as the corresponding control-character in the
+`allout-mode-map'.  The `allout-mode' `post-command-hook' insures that
+the cursor which has moved as a result of such reinterpretation is
+positioned on the bullet character of the destination topic.
 
 The upshot is that you can get easy, single (ie, unmodified) key
 outline maneuvering operations by positioning the cursor on the bullet
-char.  You stay in this mode until you use some regular
-cursor-positioning command to relocate the cursor off of a bullet
-char."
-
+char.  When in this mode you can use regular cursor-positioning
+command/keystrokes to relocate the cursor off of a bullet character to
+return to regular interpretation of self-insert characters."
   (if (not (allout-mode-p))
       ;; Shouldn't be invoked if not in allout allout-mode, but just in case:
       nil
@@ -2458,12 +2459,12 @@ The function checks to ensure that the rebinding is done only once."
 
   (add-hook 'isearch-mode-end-hook 'allout-isearch-rectification)
   (if (fboundp 'allout-real-isearch-abort)
-      ;; 
+      ;;
       nil
                                         ; Ensure load of isearch-mode:
     (if (or (and (fboundp 'isearch-mode)
                  (fboundp 'isearch-abort))
-            (condition-case error 
+            (condition-case error
                 (load-library "isearch-mode")
               ('file-error (message
                            "Skipping isearch-mode provisions - %s '%s'"
@@ -2474,7 +2475,7 @@ The function checks to ensure that the rebinding is done only once."
                           (setq allout-isearch-dynamic-expose nil))))
         ;; Isearch-mode loaded, encapsulate specific entry points for
         ;; outline dynamic-exposure business:
-        (progn 
+        (progn
          ;; stash crucial isearch-mode funcs under known, private
          ;; names, then register wrapper functions under the old
          ;; names, in their stead:
@@ -2494,7 +2495,7 @@ actual quits."
 ;;; Prevent unnecessary font-lock while isearching!
 (defvar isearch-was-font-locking nil)
 (defun isearch-inhibit-font-lock ()
-  "Inhibit font-lock while isearching - for use on `isearch-mode-hook'."
+  "Inhibit `font-lock-mode' while isearching - for use on `isearch-mode-hook'."
   (if (and (allout-mode-p) (boundp 'font-lock-mode) font-lock-mode)
       (setq isearch-was-font-locking t
            font-lock-mode nil)))
@@ -2907,7 +2908,7 @@ topic prior to the current one."
   "Name of modal fill function being wrapped by `allout-auto-fill'.")
 ;;;_    > allout-auto-fill ()
 (defun allout-auto-fill ()
-  "Allout-mode autofill function.
+  "`allout-mode' autofill function.
 
 Maintains outline hanging topic indentation if
 `allout-use-hanging-indents' is set."
@@ -3014,9 +3015,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
@@ -3322,7 +3323,7 @@ Leaves primary topic's trailing vertical whitespace, if any."
 ;;;_    > allout-yank-processing ()
 (defun allout-yank-processing (&optional arg)
 
-  "Incidental allout-specific business to be done just after text yanks.
+  "Incidental outline specific business to be done just after text yanks.
 
 Does depth adjustment of yanked topics, when:
 
@@ -3338,7 +3339,7 @@ header into which it's being yanked.
 
 The point is left in front of yanked, adjusted topics, rather than
 at the end (and vice-versa with the mark).  Non-adjusted yanks,
-however, are left exactly like normal, non-allout-specific yanks."
+however, are left exactly like normal, not outline specific yanks."
 
   (interactive "*P")
                                        ; Get to beginning, leaving
@@ -3448,7 +3449,7 @@ however, are left exactly like normal, non-allout-specific yanks."
       (exchange-point-and-mark))))
 ;;;_    > allout-yank (&optional arg)
 (defun allout-yank (&optional arg)
-  "Allout-mode yank, with depth and numbering adjustment of yanked topics.
+  "`allout-mode' yank, with depth and numbering adjustment of yanked topics.
 
 Non-topic yanks work no differently than normal yanks.
 
@@ -3472,7 +3473,7 @@ exactly like normal yanks.
 Numbering of yanked topics, and the successive siblings at the depth
 into which they're being yanked, is adjusted.
 
-`Allout-yank-pop' works with `allout-yank' just like normal yank-pop
+`allout-yank-pop' works with `allout-yank' just like normal yank-pop
 works with normal yank in non-outline buffers."
 
   (interactive "*P")
@@ -3561,7 +3562,7 @@ See `allout-flag-region' for more details."
 
 This is a way to give restricted peek at a concealed locality without the
 expense of exposing its context, but can leave the outline with aberrant
-exposure.  `allout-hide-current-entry-completely' or `allout-show-offshoot'
+exposure.  `allout-hide-current-entry-completely' or `allout-show-to-offshoot'
 should be used after the peek to rectify the exposure."
 
   (interactive)
@@ -4052,7 +4053,7 @@ and retains start position."
 
 Optional arg CONTEXT indicates interior levels to include."
   (let ((delim ".")
-       result 
+       result
        numstr
        (context-depth (or (and context 2) 1)))
     ;; Take care of the explicit context:
@@ -4095,7 +4096,7 @@ Optional arg CONTEXT indicates interior levels to include."
 (defun allout-stringify-flat-index-indented (flat-index)
   "Convert list representing section/subsection/... to document string."
   (let ((delim ".")
-       result 
+       result
        numstr)
     ;; Take care of the explicit context:
     (setq numstr (int-to-string (car flat-index))
@@ -4533,7 +4534,7 @@ BULLET string, and a list of TEXT strings for the body."
         (curr-line)
         body-content bop)
                                        ; Do the head line:
-    (insert (concat "\\OneHeadLine{\\verb\1 " 
+    (insert (concat "\\OneHeadLine{\\verb\1 "
                    (allout-latex-verb-quote bullet)
                    "\1}{"
                    depth
@@ -4735,7 +4736,7 @@ function.  If HOOK is void, it is first set to nil."
 
 GNU XEmacs takes two optional args, while mainline GNU Emacs does not,
 so pass them along when appropriate."
-  (if (string-match " XEmacs " emacs-version)
+  (if (featurep 'xemacs)
       (mark-marker force buffer)
     (mark-marker)))
 
@@ -4769,4 +4770,5 @@ so pass them along when appropriate."
 ;;;allout-layout: (0 : -1 -1 0)
 ;;;End:
 
+;;; arch-tag: cf38fbc3-c044-450f-8bff-afed8ba5681c
 ;;; allout.el ends here