Show
Ignore:
Timestamp:
08/18/06 08:35:31 (2 years ago)
Author:
miyoshi
Message:

Sync up with Emacs CVS HEAD.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/lisp/allout.el

    r4131 r4148  
    214214     (if (fboundp 'booleanp) 'booleanp '(lambda (x) (member x '(t nil))))) 
    215215 
     216;;;_  = allout-beginning-of-line-cycles 
     217(defcustom allout-beginning-of-line-cycles t 
     218  "*If non-nil, \\[allout-beginning-of-line] will cycle through smart-placement options. 
     219 
     220Cycling only happens on when the command is repeated, not when it 
     221follows a different command. 
     222 
     223Smart-placement means that repeated calls to this function will 
     224advance as follows: 
     225 
     226 - if the cursor is on a non-headline body line and not on the first column: 
     227   then it goes to the first column 
     228 - if the cursor is on the first column of a non-headline body line: 
     229   then it goes to the start of the headline within the item body 
     230 - if the cursor is on the headline and not the start of the headline: 
     231   then it goes to the start of the headline 
     232 - if the cursor is on the start of the headline: 
     233   then it goes to the bullet character \(for hotspot navigation\) 
     234 - if the cursor is on the bullet character: 
     235   then it goes to the first column of that line \(the headline\) 
     236 - if the cursor is on the first column of the headline: 
     237   then it goes to the start of the headline within the item body. 
     238 
     239In this fashion, you can use the beginning-of-line command to do 
     240its normal job and then, when repeated, advance through the 
     241entry, cycling back to start. 
     242 
     243If this configuration variable is nil, then the cursor is just 
     244advanced to the beginning of the line and remains there on 
     245repeated calls." 
     246  :type 'boolean :group 'allout) 
     247;;;_  = allout-end-of-line-cycles 
     248(defcustom allout-end-of-line-cycles t 
     249  "*If non-nil, \\[allout-end-of-line] will cycle through smart-placement options. 
     250 
     251Cycling only happens on when the command is repeated, not when it 
     252follows a different command. 
     253 
     254Smart-placement means that repeated calls to this function will 
     255advance as follows: 
     256 
     257 - if the cursor is not on the end-of-line, 
     258   then it goes to the end-of-line 
     259 - if the cursor is on the end-of-line but not the end-of-entry, 
     260   then it goes to the end-of-entry, exposing it if necessary 
     261 - if the cursor is on the end-of-entry, 
     262   then it goes to the end of the head line 
     263 
     264In this fashion, you can use the end-of-line command to do its 
     265normal job and then, when repeated, advance through the entry, 
     266cycling back to start. 
     267 
     268If this configuration variable is nil, then the cursor is just 
     269advanced to the end of the line and remains there on repeated 
     270calls." 
     271  :type 'boolean :group 'allout) 
     272 
    216273;;;_  = allout-header-prefix 
    217274(defcustom allout-header-prefix "." 
     275;; this string is treated as literal match.  it will be `regexp-quote'd, so 
     276;; one cannot use regular expressions to match varying header prefixes. 
    218277  "*Leading string which helps distinguish topic headers. 
    219278 
    220279Outline topic header lines are identified by a leading topic 
    221280header prefix, which mostly have the value of this var at their front. 
    222 \(Level 1 topics are exceptions.  They consist of only a single 
    223 character, which is typically set to the `allout-primary-bullet'.  Many 
    224 outlines start at level 2 to avoid this discrepancy." 
     281Level 1 topics are exceptions.  They consist of only a single 
     282character, which is typically set to the `allout-primary-bullet'." 
    225283  :type 'string 
    226284  :group 'allout) 
     
    301359  "*When non-nil, use mode-specific topic-header prefixes. 
    302360 
    303 Allout outline mode will use the mode-specific `allout-mode-leaders' 
    304 and/or comment-start string, if any, to lead the topic prefix string, 
    305 so topic headers look like comments in the programming language. 
    306  
    307 String values are used as they stand. 
     361Allout outline mode will use the mode-specific `allout-mode-leaders' or 
     362comment-start string, if any, to lead the topic prefix string, so topic 
     363headers look like comments in the programming language.  It will also use 
     364the comment-start string, with an '_' appended, for `allout-primary-bullet'. 
     365 
     366String values are used as literals, not regular expressions, so 
     367do not escape any regulare-expression characters. 
    308368 
    309369Value t means to first check for assoc value in `allout-mode-leaders' 
     
    314374`comment-start' to use only one of them, respectively. 
    315375 
    316 Value nil means to always use the default \(`.'). 
    317  
    318 comment-start strings that do not end in spaces are tripled, and an 
    319 `_' underscore is tacked on the end, to distinguish them from regular 
    320 comment strings.  comment-start strings that do end in spaces are not 
    321 tripled, but an underscore is substituted for the space. [This 
    322 presumes that the space is for appearance, not comment syntax.  You 
    323 can use `allout-mode-leaders' to override this behavior, when 
    324 incorrect.]" 
     376Value nil means to always use the default \(`.') and leave 
     377`allout-primary-bullet' unaltered. 
     378 
     379comment-start strings that do not end in spaces are tripled in 
     380the header-prefix, and an `_' underscore is tacked on the end, to 
     381distinguish them from regular comment strings.  comment-start 
     382strings that do end in spaces are not tripled, but an underscore 
     383is substituted for the space. [This presumes that the space is 
     384for appearance, not comment syntax.  You can use 
     385`allout-mode-leaders' to override this behavior, when 
     386undesired.]" 
    325387  :type '(choice (const t) (const nil) string 
    326388                 (const allout-mode-leaders) 
     
    335397  "Specific allout-prefix leading strings per major modes. 
    336398 
    337 Entries will be used instead or in lieu of mode-specific 
    338 comment-start strings.  See also `allout-use-mode-specific-leader'. 
     399Use this if the mode's comment-start string isn't what you 
     400prefer, or if the mode lacks a comment-start string.  See 
     401`allout-use-mode-specific-leader' for more details. 
    339402 
    340403If you're constructing a string that will comment-out outline 
    341404structuring so it can be included in program code, append an extra 
    342405character, like an \"_\" underscore, to distinguish the lead string 
    343 from regular comments that start at bol.") 
     406from regular comments that start at the beginning-of-line.") 
    344407 
    345408;;;_  = allout-old-style-prefixes 
     
    829892  (allout-reset-header-lead header-lead) 
    830893  header-lead) 
    831 ;;;_   > allout-infer-header-lead () 
    832 (defun allout-infer-header-lead () 
    833   "Determine appropriate `allout-header-prefix'
     894;;;_   > allout-infer-header-lead-and-primary-bullet () 
     895(defun allout-infer-header-lead-and-primary-bullet () 
     896  "Determine appropriate `allout-header-prefix' and `allout-primary-bullet'
    834897 
    835898Works according to settings of: 
     
    875938    (if (not leader) 
    876939        nil 
    877       (if (string= leader allout-header-prefix) 
    878           nil                           ; no change, nothing to do. 
    879         (setq allout-header-prefix leader) 
    880         allout-header-prefix)))) 
     940      (setq allout-header-prefix leader) 
     941      (if (not allout-old-style-prefixes) 
     942          ;; setting allout-primary-bullet makes the top level topics use - 
     943          ;; actually, be - the special prefix: 
     944          (setq allout-primary-bullet leader)) 
     945      allout-header-prefix))) 
     946(defalias 'allout-infer-header-lead 
     947  'allout-infer-header-lead-and-primary-bullet) 
    881948;;;_   > allout-infer-body-reindent () 
    882949(defun allout-infer-body-reindent () 
     
    931998  (setq allout-header-subtraction (1- (length allout-header-prefix))) 
    932999  ;; Produce the new allout-regexp: 
    933   (setq allout-regexp (concat "\\(\\
    934                               allout-header-prefix 
    935                               "[ \t]*[" 
    936                               allout-bullets-string 
    937                               "]\\)\\|\\
    938                               allout-primary-bullet 
    939                               "+\\|\^l")) 
     1000  (setq allout-regexp (concat "\\(
     1001                              (regexp-quote allout-header-prefix) 
     1002                              "[ \t]*[" 
     1003                              allout-bullets-string 
     1004                              "]\\)\\|
     1005                              (regexp-quote allout-primary-bullet) 
     1006                              "+\\|\^l")) 
    9401007  (setq allout-line-boundary-regexp 
    9411008        (concat "\\(\n\\)\\(" allout-regexp "\\)")) 
     
    9661033            keymap-list) 
    9671034    map)) 
    968 ;;;_   = allout-prior-bindings - being deprecated. 
    969 (defvar allout-prior-bindings nil 
    970   "Variable for use in V18, with allout-added-bindings, for 
    971 resurrecting, on mode deactivation, bindings that existed before 
    972 activation.  Being deprecated.") 
    973 ;;;_   = allout-added-bindings - being deprecated 
    974 (defvar allout-added-bindings nil 
    975   "Variable for use in V18, with allout-prior-bindings, for 
    976 resurrecting, on mode deactivation, bindings that existed before 
    977 activation.  Being deprecated.") 
    9781035;;;_  : Menu bar 
    9791036(defvar allout-mode-exposure-menu) 
     
    10511108;;;_   > allout-add-resumptions (&rest pairs) 
    10521109(defun allout-add-resumptions (&rest pairs) 
    1053   "Set name/value pairs
     1110  "Set name/value PAIRS
    10541111 
    10551112Old settings are preserved for later resumption using `allout-do-resumptions'. 
    10561113 
     1114The new values are set as a buffer local.  On resumption, the prior buffer 
     1115scope of the variable is restored along with its value.  If it was a void 
     1116buffer-local value, then it is left as nil on resumption. 
     1117 
    10571118The pairs are lists whose car is the name of the variable and car of the 
    1058 cdr is the new value:  '(some-var some-value)'. 
    1059  
    1060 The new value is set as a buffer local. 
    1061  
    1062 If the variable was not previously buffer-local, then that is noted and the 
    1063 `allout-do-resumptions' will just `kill-local-variable' of that binding. 
    1064  
    1065 If it previously was buffer-local, the old value is noted and resurrected 
    1066 by `allout-do-resumptions'.  \(If the local value was previously void, then 
    1067 it is left as nil on resumption.\) 
     1119cdr is the new value: '(some-var some-value)'.  The pairs can actually be 
     1120triples, where the third element qualifies the disposition of the setting, 
     1121as described further below. 
     1122 
     1123If the optional third element is the symbol 'extend, then the new value 
     1124created by `cons'ing the second element of the pair onto the front of the 
     1125existing value. 
     1126 
     1127If the optional third element is the symbol 'append, then the new value is 
     1128extended from the existing one by `append'ing a list containing the second 
     1129element of the pair onto the end of the existing value. 
     1130 
     1131Extension, and resumptions in general, should not be used for hook 
     1132functions - use the 'local mode of `add-hook' for that, instead. 
    10681133 
    10691134The settings are stored on `allout-mode-prior-settings'." 
     
    10711136    (let* ((pair (pop pairs)) 
    10721137           (name (car pair)) 
    1073            (value (cadr pair))) 
     1138           (value (cadr pair)) 
     1139           (qualifier (if (> (length pair) 2) 
     1140                          (caddr pair))) 
     1141           prior-value) 
    10741142      (if (not (symbolp name)) 
    10751143          (error "Pair's name, %S, must be a symbol, not %s" 
    10761144                 name (type-of name))) 
     1145      (setq prior-value (condition-case err 
     1146                            (symbol-value name) 
     1147                          (void-variable nil))) 
    10771148      (when (not (assoc name allout-mode-prior-settings)) 
    10781149        ;; Not already added as a resumption, create the prior setting entry. 
    10791150        (if (local-variable-p name) 
    10801151            ;; is already local variable - preserve the prior value: 
    1081             (push (list name (condition-case err 
    1082                                  (symbol-value name) 
    1083                                (void-variable nil))) 
    1084                   allout-mode-prior-settings) 
     1152            (push (list name prior-value) allout-mode-prior-settings) 
    10851153          ;; wasn't local variable, indicate so for resumption by killing 
    10861154          ;; local value, and make it local: 
    10871155          (push (list name) allout-mode-prior-settings) 
    10881156          (make-local-variable name))) 
    1089       (set name value)))) 
     1157      (if qualifier 
     1158          (cond ((eq qualifier 'extend) 
     1159                 (if (not (listp prior-value)) 
     1160                     (error "extension of non-list prior value attempted") 
     1161                   (set name (cons value prior-value)))) 
     1162                ((eq qualifier 'append) 
     1163                 (if (not (listp prior-value)) 
     1164                     (error "appending of non-list prior value attempted") 
     1165                   (set name (append prior-value (list value))))) 
     1166                (t (error "unrecognized setting qualifier `%s' encountered" 
     1167                          qualifier))) 
     1168        (set name value))))) 
    10901169;;;_   > allout-do-resumptions () 
    10911170(defun allout-do-resumptions () 
     
    11221201;;;_   x allout-view-change-hook 
    11231202(defvar allout-view-change-hook nil 
    1124   "*\(Deprecated\)  Hook that's run after allout outline exposure changes. 
    1125  
    1126 Switch to using `allout-exposure-change-hook' instead.  Both 
    1127 variables are currently respected, but this one will be ignored 
    1128 in a subsequent allout version.") 
     1203  "*\(Deprecated\) A hook run after allout outline exposure changes. 
     1204 
     1205Switch to using `allout-exposure-change-hook' instead.  Both hooks are 
     1206currently respected, but the other conveys the details of the exposure 
     1207change via explicit parameters, and this one will eventually be disabled in 
     1208a subsequent allout version.") 
    11291209;;;_   = allout-exposure-change-hook 
    11301210(defvar allout-exposure-change-hook nil 
    1131   "*Hook that's run after allout outline exposure changes. 
    1132  
    1133 This variable will replace `allout-view-change-hook' in a subsequent allout 
    1134 version, though both are currently respected.") 
    1135  
     1211  "*Hook that's run after allout outline subtree exposure changes. 
     1212 
     1213It is run at the conclusion of `allout-flag-region'. 
     1214 
     1215Functions on the hook must take three arguments: 
     1216 
     1217 - from - integer indicating the point at the start of the change. 
     1218 - to - integer indicating the point of the end of the change. 
     1219 - flag - change mode: nil for exposure, otherwise concealment. 
     1220 
     1221This hook might be invoked multiple times by a single command. 
     1222 
     1223This hook is replacing `allout-view-change-hook', which is being deprecated 
     1224and eventually will not be invoked.") 
     1225;;;_   = allout-structure-added-hook 
     1226(defvar allout-structure-added-hook nil 
     1227  "*Hook that's run after addition of items to the outline. 
     1228 
     1229Functions on the hook should take two arguments: 
     1230 
     1231 - new-start - integer indicating the point at the start of the first new item. 
     1232 - new-end - integer indicating the point of the end of the last new item. 
     1233 
     1234Some edits that introduce new items may missed by this hook - 
     1235specifically edits that native allout routines do not control. 
     1236 
     1237This hook might be invoked multiple times by a single command.") 
     1238;;;_   = allout-structure-deleted-hook 
     1239(defvar allout-structure-deleted-hook nil 
     1240  "*Hook that's run after disciplined deletion of subtrees from the outline. 
     1241 
     1242Functions on the hook must take two arguments: 
     1243 
     1244 - depth - integer indicating the depth of the subtree that was deleted. 
     1245 - removed-from - integer indicating the point where the subtree was removed. 
     1246 
     1247Some edits that remove or invalidate items may missed by this hook - 
     1248specifically edits that native allout routines do not control. 
     1249 
     1250This hook might be invoked multiple times by a single command.") 
     1251;;;_   = allout-structure-shifted-hook 
     1252(defvar allout-structure-shifted-hook nil 
     1253  "*Hook that's run after shifting of items in the outline. 
     1254 
     1255Functions on the hook should take two arguments: 
     1256 
     1257 - depth-change - integer indicating depth increase, negative for decrease 
     1258 - start - integer indicating the start point of the shifted parent item. 
     1259 
     1260Some edits that shift items can be missed by this hook - specifically edits 
     1261that native allout routines do not control. 
     1262 
     1263This hook might be invoked multiple times by a single command.") 
    11361264;;;_   = allout-outside-normal-auto-fill-function 
    11371265(defvar allout-outside-normal-auto-fill-function nil 
     
    11871315was encrypted automatically as part of a file write or autosave.") 
    11881316(make-variable-buffer-local 'allout-after-save-decrypt) 
     1317;;;_   = allout-encryption-plaintext-sanitization-regexps 
     1318(defvar allout-encryption-plaintext-sanitization-regexps nil 
     1319  "List of regexps whose matches are removed from plaintext before encryption. 
     1320 
     1321This is for the sake of removing artifacts, like escapes, that are added on 
     1322and not actually part of the original plaintext.  The removal is done just 
     1323prior to encryption. 
     1324 
     1325Entries must be symbols that are bound to the desired values. 
     1326 
     1327Each value can be a regexp or a list with a regexp followed by a 
     1328substitution string.  If it's just a regexp, all its matches are removed 
     1329before the text is encrypted.  If it's a regexp and a substitution, the 
     1330substition is used against the regexp matches, a la `replace-match'.") 
     1331(make-variable-buffer-local 'allout-encryption-text-removal-regexps) 
     1332;;;_   = allout-encryption-ciphertext-rejection-regexps 
     1333(defvar allout-encryption-ciphertext-rejection-regexps nil 
     1334  "Variable for regexps matching plaintext to remove before encryption. 
     1335 
     1336This is for the sake of redoing encryption in cases where the ciphertext 
     1337incidentally contains strings that would disrupt mode operation - 
     1338for example, a line that happens to look like an allout-mode topic prefix. 
     1339 
     1340Entries must be symbols that are bound to the desired regexp values. 
     1341 
     1342The encryption will be retried up to 
     1343`allout-encryption-ciphertext-rejection-limit' times, after which an error 
     1344is raised.") 
     1345 
     1346(make-variable-buffer-local 'allout-encryption-ciphertext-rejection-regexps) 
     1347;;;_   = allout-encryption-ciphertext-rejection-ceiling 
     1348(defvar allout-encryption-ciphertext-rejection-ceiling 5 
     1349  "Limit on number of times encryption ciphertext is rejected. 
     1350 
     1351See `allout-encryption-ciphertext-rejection-regexps' for rejection reasons.") 
     1352(make-variable-buffer-local 'allout-encryption-ciphertext-rejection-ceiling) 
    11891353;;;_   > allout-mode-p () 
    11901354;; Must define this macro above any uses, or byte compilation will lack 
     
    16381802                       'category 'allout-exposure-category) 
    16391803 
    1640       (run-hooks 'allout-mode-deactivate-hook
    1641       (setq allout-mode nil)) 
     1804      (setq allout-mode nil
     1805      (run-hooks 'allout-mode-deactivate-hook)) 
    16421806 
    16431807     ;; Activation: 
     
    16461810      (if allout-old-style-prefixes 
    16471811          ;; Inhibit all the fancy formatting: 
    1648           (allout-add-resumptions '((allout-primary-bullet "*") 
    1649                                     (allout-old-style-prefixes ())))) 
     1812          (allout-add-resumptions '(allout-primary-bullet "*"))) 
    16501813 
    16511814      (allout-overlay-preparations)     ; Doesn't hurt to redo this. 
     
    16551818 
    16561819      (set-allout-regexp) 
     1820      (allout-add-resumptions 
     1821       '(allout-encryption-ciphertext-rejection-regexps 
     1822         allout-line-boundary-regexp 
     1823         extend) 
     1824       '(allout-encryption-ciphertext-rejection-regexps 
     1825         allout-bob-regexp 
     1826         extend)) 
    16571827 
    16581828      ;; Produce map from current version of allout-keybindings-list: 
     
    16601830            (produce-allout-mode-map allout-keybindings-list)) 
    16611831      (substitute-key-definition 'beginning-of-line 
    1662                                  'move-beginning-of-line 
     1832                                 'allout-beginning-of-line 
     1833                                 allout-mode-map global-map) 
     1834      (substitute-key-definition 'move-beginning-of-line 
     1835                                 'allout-beginning-of-line 
    16631836                                 allout-mode-map global-map) 
    16641837      (substitute-key-definition 'end-of-line 
    1665                                  'move-end-of-line 
     1838                                 'allout-end-of-line 
     1839                                 allout-mode-map global-map) 
     1840      (substitute-key-definition 'move-end-of-line 
     1841                                 'allout-end-of-line 
    16661842                                 allout-mode-map global-map) 
    16671843      (produce-allout-mode-menubar-entries) 
     
    17181894          (setq do-layout t)) 
    17191895 
    1720       (run-hooks 'allout-mode-hook
    1721       (setq allout-mode t)) 
     1896      (setq allout-mode t
     1897      (run-hooks 'allout-mode-hook)) 
    17221898 
    17231899     ;; Reactivation: 
     
    20452221      (end-of-line) 
    20462222      (if (allout-hidden-p) (forward-char 1))))) 
     2223;;;_   > allout-beginning-of-line () 
     2224(defun allout-beginning-of-line () 
     2225  "Beginning-of-line with `allout-beginning-of-line-cycles' behavior, if set." 
     2226 
     2227  (interactive) 
     2228 
     2229  (if (or (not allout-beginning-of-line-cycles) 
     2230          (not (equal last-command this-command))) 
     2231      (move-beginning-of-line 1) 
     2232    (let ((beginning-of-body (save-excursion 
     2233                               (allout-beginning-of-current-entry) 
     2234                               (point)))) 
     2235      (cond ((= (current-column) 0) 
     2236             (allout-beginning-of-current-entry)) 
     2237            ((< (point) beginning-of-body) 
     2238             (allout-beginning-of-current-line)) 
     2239            ((= (point) beginning-of-body) 
     2240             (goto-char (allout-current-bullet-pos))) 
     2241            (t (allout-beginning-of-current-line) 
     2242               (if (< (point) beginning-of-body) 
     2243                   ;; we were on the headline after its start: 
     2244                   (allout-beginning-of-current-entry))))))) 
     2245;;;_   > allout-end-of-line () 
     2246(defun allout-end-of-line () 
     2247  "End-of-line with `allout-end-of-line-cycles' behavior, if set." 
     2248 
     2249  (interactive) 
     2250 
     2251  (if (or (not allout-end-of-line-cycles) 
     2252          (not (equal last-command this-command))) 
     2253      (allout-end-of-current-line) 
     2254    (let ((end-of-entry (save-excursion 
     2255                          (allout-end-of-entry) 
     2256                          (point)))) 
     2257      (cond ((not (eolp)) 
     2258             (allout-end-of-current-line)) 
     2259            ((or (allout-hidden-p) (save-excursion 
     2260                                     (forward-char -1) 
     2261                                     (allout-hidden-p))) 
     2262             (allout-back-to-current-heading) 
     2263             (allout-show-current-entry) 
     2264             (allout-end-of-entry)) 
     2265            ((>= (point) end-of-entry) 
     2266             (allout-back-to-current-heading) 
     2267             (allout-end-of-current-line)) 
     2268            (t (allout-end-of-entry)))))) 
    20472269;;;_   > allout-next-heading () 
    20482270(defsubst allout-next-heading () 
     
    21092331;;; traversal of the structure. 
    21102332 
    2111 ;;;_   > allout-chart-subtree (&optional levels orig-depth prev-depth) 
    2112 (defun allout-chart-subtree (&optional levels orig-depth prev-depth) 
     2333;;;_   > allout-chart-subtree (&optional levels visible orig-depth prev-depth) 
     2334(defun allout-chart-subtree (&optional levels visible orig-depth prev-depth) 
    21132335  "Produce a location \"chart\" of subtopics of the containing topic. 
    21142336 
    21152337Optional argument LEVELS specifies the depth \(relative to start 
    2116 depth) for the chart.  Subsequent optional args are not for public 
    2117 use. 
     2338depth) for the chart. 
     2339 
     2340When optional argument VISIBLE is non-nil, the chart includes 
     2341only the visible subelements of the charted subjects. 
     2342 
     2343The remaining optional args are not for internal use by the function. 
    21182344 
    21192345Point is left at the end of the subtree. 
     
    21422368        (progn (setq orig-depth (allout-depth)) 
    21432369               (or prev-depth (setq prev-depth (1+ orig-depth))) 
    2144                (allout-next-heading))) 
     2370               (if visible 
     2371                   (allout-next-visible-heading 1) 
     2372                 (allout-next-heading)))) 
    21452373 
    21462374    ;; Loop over the current levels' siblings.  Besides being more 
     
    21642392                               (while (and (<= curr-depth 
    21652393                                               (allout-recent-depth)) 
    2166                                            (allout-next-heading)))) 
    2167                          (allout-next-heading))) 
     2394                                           (if visible 
     2395                                               (allout-next-visible-heading 1) 
     2396                                             (allout-next-heading))))) 
     2397                         (if visible 
     2398                             (allout-next-visible-heading 1) 
     2399                           (allout-next-heading)))) 
    21682400 
    21692401                      ((and (< prev-depth curr-depth) 
     
    21742406                             (cons (allout-chart-subtree (and levels 
    21752407                                                               (1- levels)) 
    2176                                                           orig-depth 
    2177                                                           curr-depth) 
     2408                                                         visible 
     2409                                                         orig-depth 
     2410                                                         curr-depth) 
    21782411                                   chart)) 
    21792412                       ;; ... then continue with this one. 
     
    23702603                (> (allout-recent-depth) level)) 
    23712604      (allout-next-heading)) 
    2372     (and (not (eobp)) (forward-char -1)) 
     2605    (if (eobp) 
     2606        (allout-end-of-entry) 
     2607      (forward-char -1)) 
    23732608    (if (and (not include-trailing-blank) (= ?\n (preceding-char))) 
    23742609         (forward-char -1)) 
     
    26762911`allout-mode-map'.") 
    26772912(make-variable-buffer-local 'allout-post-goto-bullet) 
     2913;;;_   = allout-command-counter 
     2914(defvar allout-command-counter 0 
     2915  "Counter that monotonically increases in allout-mode buffers. 
     2916 
     2917Set by `allout-pre-command-business', to support allout addons in 
     2918coordinating with allout activity.") 
     2919(make-variable-buffer-local 'allout-command-counter) 
    26782920;;;_   > allout-post-command-business () 
    26792921(defun allout-post-command-business () 
     
    26932935        (allout-after-saves-handler)) 
    26942936 
    2695     ;; Implement -post-goto-bullet, if set: 
     2937    ;; Implement allout-post-goto-bullet, if set: 
    26962938    (if (and allout-post-goto-bullet 
    26972939             (allout-current-bullet-pos)) 
     
    27022944(defun allout-pre-command-business () 
    27032945  "Outline `pre-command-hook' function for outline buffers. 
    2704 Implements special behavior when cursor is on bullet character. 
     2946 
     2947Among other things, implements special behavior when the cursor is on the 
     2948topic bullet character. 
    27052949 
    27062950When the cursor is on the bullet character, self-insert characters are 
     
    27102954positioned on the bullet character of the destination topic. 
    27112955 
    2712 The upshot is that you can get easy, single (ie, unmodified) key 
     2956The upshot is that you can get easy, single \(ie, unmodified\) key 
    27132957outline maneuvering operations by positioning the cursor on the bullet 
    27142958char.  When in this mode you can use regular cursor-positioning 
     
    27182962  (if (not (allout-mode-p)) 
    27192963      nil 
     2964    ;; Increment allout-command-counter 
     2965    (setq allout-command-counter (1+ allout-command-counter)) 
     2966    ;; Do hot-spot navigation. 
    27202967    (if (and (eq this-command 'self-insert-command) 
    27212968             (eq (point)(allout-current-bullet-pos))) 
     
    29913238If OFFER-RECENT-BULLET is true, offer to use the bullet of the prior sibling. 
    29923239 
     3240Runs  
     3241 
    29933242Nuances: 
    29943243 
     
    30413290                      (point))) 
    30423291         dbl-space 
    3043          doing-beginning) 
     3292         doing-beginning 
     3293         start end) 
    30443294 
    30453295    (if (not opening-on-blank) 
     
    31423392                         (forward-char 1)))) 
    31433393          )) 
     3394    (setq start (point)) 
    31443395    (insert (concat (allout-make-topic-prefix opening-numbered t depth) 
    31453396                    " ")) 
     3397    (setq end (1+ (point))) 
    31463398 
    31473399    (allout-rebullet-heading (and offer-recent-bullet ref-bullet) 
     
    31513403                        (allout-show-children))) 
    31523404    (end-of-line) 
     3405 
     3406    (run-hook-with-args 'allout-structure-added-hook start end) 
    31533407    ) 
    31543408  ) 
     
    35493803  (interactive "p") 
    35503804  (if (> arg 0) 
     3805      ;; refuse to create a containment discontinuity: 
    35513806      (save-excursion 
    35523807        (allout-back-to-current-heading) 
     
    35653820                  (error (concat "Disallowed shift deeper than" 
    35663821                                 " containing topic's children."))))))) 
    3567   (allout-rebullet-topic arg)) 
     3822  (let ((where (point)) 
     3823        has-successor) 
     3824    (if (and (< arg 0) 
     3825             (allout-current-topic-collapsed-p) 
     3826             (save-excursion (allout-next-sibling))) 
     3827        (setq has-successor t)) 
     3828    (allout-rebullet-topic arg) 
     3829    (when (< arg 0) 
     3830      (save-excursion 
     3831        (if (allout-ascend) 
     3832            (allout-show-children))) 
     3833      (if has-successor 
     3834          (allout-show-children))) 
     3835    (run-hook-with-args 'allout-structure-shifted-hook arg where))) 
    35683836;;;_    > allout-shift-out (arg) 
    35693837(defun allout-shift-out (arg) 
     
    35753843depth, however." 
    35763844  (interactive "p") 
    3577   (if (< arg 0) 
    3578       (allout-shift-in (* arg -1))) 
    3579   (allout-rebullet-topic (* arg -1))) 
     3845  (allout-shift-in (* arg -1))) 
    35803846;;;_   : Surgery (kill-ring) functions with special provisions for outlines: 
    35813847;;;_    > allout-kill-line (&optional arg) 
     
    36113877            (if (not (looking-at allout-regexp)) 
    36123878                (allout-next-heading)) 
    3613             (allout-renumber-to-depth depth)))))) 
     3879            (allout-renumber-to-depth depth))) 
     3880      (run-hook-with-args 'allout-structure-deleted-hook depth (point))))) 
    36143881;;;_    > allout-kill-topic () 
    36153882(defun allout-kill-topic () 
     
    36573924    (sit-for 0) 
    36583925    (save-excursion 
    3659       (allout-renumber-to-depth depth)))) 
     3926      (allout-renumber-to-depth depth)) 
     3927    (run-hook-with-args 'allout-structure-deleted-hook depth (point)))) 
    36603928;;;_    > allout-yank-processing () 
    36613929(defun allout-yank-processing (&optional arg) 
     
    36843952  (if (< (allout-mark-marker t) (point)) 
    36853953      (exchange-point-and-mark)) 
    3686   (let* ((inhibit-field-text-motion t) 
    3687          (subj-beg (point)) 
    3688          (into-bol (bolp)) 
    3689         (subj-end (allout-mark-marker t)) 
    3690          (was-collapsed (get-text-property subj-beg 'allout-was-collapsed)) 
    3691         ;; 'resituate' if yanking an entire topic into topic header: 
    3692         (resituate (and (allout-e-o-prefix-p) 
    3693                         (looking-at (concat "\\(" allout-regexp "\\)")) 
    3694                         (allout-prefix-data (match-beginning 1) 
     3954  (allout-unprotected 
     3955   (let* ((subj-beg (point)) 
     3956          (into-bol (bolp)) 
     3957          (subj-end (allout-mark-marker t)) 
     3958          (was-collapsed (get-text-property subj-beg 'allout-was-collapsed)) 
     3959          ;; 'resituate' if yanking an entire topic into topic header: 
     3960          (resituate (and (allout-e-o-prefix-p) 
     3961                          (looking-at (concat "\\(" allout-regexp "\\)")) 
     3962                          (allout-prefix-data (match-beginning 1) 
    36953963                                              (match-end 1)))) 
    3696         ;; `rectify-numbering' if resituating (where several topics may 
    3697         ;; be resituating) or yanking a topic into a topic slot (bol): 
    3698         (rectify-numbering (or resituate 
    3699                                (and into-bol (looking-at allout-regexp))))) 
    3700     (if resituate 
     3964          ;; `rectify-numbering' if resituating (where several topics may 
     3965          ;; be resituating) or yanking a topic into a topic slot (bol): 
     3966          (rectify-numbering (or resituate 
     3967                                 (and into-bol (looking-at allout-regexp))))) 
     3968    (if resituate 
    37013969                                        ; The yanked stuff is a topic: 
    3702        (let* ((prefix-len (- (match-end 1) subj-beg)) 
    3703               (subj-depth (allout-recent-depth)) 
    3704               (prefix-bullet (allout-recent-bullet)) 
    3705               (adjust-to-depth 
    3706                ;; Nil if adjustment unnecessary, otherwise depth to which 
    3707                ;; adjustment should be made: 
    3708                (save-excursion 
    3709                  (and (goto-char subj-end) 
    3710                       (eolp) 
    3711                       (goto-char subj-beg) 
    3712                       (and (looking-at allout-regexp) 
    3713                            (progn 
    3714                              (beginning-of-line) 
    3715                              (not (= (point) subj-beg))) 
    3716                            (looking-at allout-regexp) 
    3717                            (allout-prefix-data (match-beginning 0) 
     3970         (let* ((prefix-len (- (match-end 1) subj-beg)) 
     3971                (subj-depth (allout-recent-depth)) 
     3972                (prefix-bullet (allout-recent-bullet)) 
     3973                (adjust-to-depth 
     3974                 ;; Nil if adjustment unnecessary, otherwise depth to which 
     3975                 ;; adjustment should be made: 
     3976                 (save-excursion 
     3977                   (and (goto-char subj-end) 
     3978                        (eolp) 
     3979                        (goto-char subj-beg) 
     3980                        (and (looking-at allout-regexp) 
     3981                             (progn 
     3982                               (beginning-of-line) 
     3983                               (not (= (point) subj-beg))) 
     3984                             (looking-at allout-regexp) 
     3985                             (allout-prefix-data (match-beginning 0) 
    37183986                                                 (match-end 0))) 
    3719                       (allout-recent-depth)))) 
    3720               (more t)) 
    3721          (setq rectify-numbering allout-numbered-bullet) 
    3722          (if adjust-to-depth 
     3987                        (allout-recent-depth)))) 
     3988                (more t)) 
     3989           (setq rectify-numbering allout-numbered-bullet) 
     3990           (if adjust-to-depth 
    37233991                                        ; Do the adjustment: 
    3724              (progn 
    3725                (message "... yanking") (sit-for 0) 
    3726                (save-restriction 
    3727                  (narrow-to-region subj-beg subj-end) 
     3992               (progn 
     3993                 (message "... yanking") (sit-for 0) 
     3994                 (save-restriction 
     3995                   (narrow-to-region subj-beg subj-end) 
    37283996                                        ; Trim off excessive blank 
    37293997                                        ; line at end, if any: 
    3730                  (goto-char (point-max)) 
    3731                  (if (looking-at "^$") 
    3732                      (allout-unprotected (delete-char -1))) 
     3998                   (goto-char (point-max)) 
     3999                   (if (looking-at "^$") 
     4000                       (allout-unprotected (delete-char -1))) 
    37334001                                        ; Work backwards, with each 
    37344002                                        ; shallowest level, 
     
    37364004                                        ; last processed topic from 
    37374005                                        ; the narrow region: 
    3738                  (while more 
    3739                    (allout-back-to-current-heading) 
     4006                   (while more 
     4007                     (allout-back-to-current-heading) 
    37404008                                        ; go as high as we can in each bunch: 
    3741                    (while (allout-ascend-to-depth (1- (allout-depth)))) 
    3742                    (save-excursion 
    3743                      (allout-rebullet-topic-grunt (- adjust-to-depth 
     4009                     (while (allout-ascend-to-depth (1- (allout-depth)))) 
     4010                     (save-excursion 
     4011                       (allout-rebullet-topic-grunt (- adjust-to-depth 
    37444012                                                       subj-depth)) 
    3745                      (allout-depth)) 
    3746                    (if (setq more (not (bobp))) 
    3747                        (progn (widen) 
    3748                               (forward-char -1) 
    3749                               (narrow-to-region subj-beg (point)))))) 
    3750                (message "") 
    3751                ;; Preserve new bullet if it's a distinctive one, otherwise 
    3752                ;; use old one: 
    3753                (if (string-match (regexp-quote prefix-bullet) 
    3754                                  allout-distinctive-bullets-string) 
     4013                       (allout-depth)) 
     4014                     (if (setq more (not (bobp))) 
     4015                         (progn (widen) 
     4016                                (forward-char -1) 
     4017                                (narrow-to-region subj-beg (point)))))) 
     4018                 (message "") 
     4019                 ;; Preserve new bullet if it's a distinctive one, otherwise 
     4020                 ;; use old one: 
     4021                 (if (string-match (regexp-quote prefix-bullet) 
     4022                                   allout-distinctive-bullets-string) 
    37554023                                        ; Delete from bullet of old to 
    37564024                                        ; before bullet of new: 
    3757                    (progn 
    3758                      (beginning-of-line) 
    3759                      (delete-region (point) subj-beg) 
    3760                      (set-marker (allout-mark-marker t) subj-end) 
    3761                      (goto-char subj-beg) 
    3762                      (allout-end-of-prefix)) 
     4025                     (progn 
     4026                       (beginning-of-line) 
     4027                       (delete-region (point) subj-beg) 
     4028                       (set-marker (allout-mark-marker t) subj-end) 
     4029                       (goto-char subj-beg) 
     4030                       (allout-end-of-prefix)) 
    37634031                                        ; Delete base subj prefix, 
    37644032                                        ; leaving old one: 
    3765                  (delete-region (point) (+ (point) 
    3766                                            prefix-len 
    3767                                            (- adjust-to-depth subj-depth))) 
     4033                   (delete-region (point) (+ (point) 
     4034                                             prefix-len 
     4035                                             (- adjust-to-depth subj-depth))) 
    37684036                                        ; and delete residual subj 
    37694037                                        ; prefix digits and space: 
    3770                  (while (looking-at "[0-9]") (delete-char 1)) 
    3771                  (if (looking-at " ") (delete-char 1)))) 
    3772            (exchange-point-and-mark)))) 
    3773     (if rectify-numbering 
    3774        (progn 
    3775          (save-excursion 
     4038                   (while (looking-at "[0-9]") (delete-char 1)) 
     4039                   (if (looking-at " ") (delete-char 1)))) 
     4040             (exchange-point-and-mark)))) 
     4041    (if rectify-numbering 
     4042         (progn 
     4043           (save-excursion 
    37764044                                        ; Give some preliminary feedback: 
    3777            (message "... reconciling numbers") (sit-for 0) 
     4045             (message "... reconciling numbers") (sit-for 0) 
    37784046                                        ; ... and renumber, in case necessary: 
    3779            (goto-char subj-beg) 
    3780            (if (allout-goto-prefix) 
    3781                (allout-rebullet-heading nil    ;;; solicit 
     4047             (goto-char subj-beg) 
     4048             (if (allout-goto-prefix) 
     4049                 (allout-rebullet-heading nil            ;;; solicit 
    37824050                                          (allout-depth) ;;; depth 
    3783                                           nil  ;;; number-control 
    3784                                     &