diff options
| -rw-r--r-- | lisp/ChangeLog | 80 | ||||
| -rw-r--r-- | lisp/allout.el | 361 |
2 files changed, 365 insertions, 76 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 1e4a8590f29..6450b0028c8 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,3 +1,83 @@ | |||
| 1 | 2010-11-13 Ken Manheimer <ken.manheimer@gmail.com> | ||
| 2 | |||
| 3 | Another omnibus checkin of a backlog of fixes. (Now that i'm | ||
| 4 | using bzr i should be able to interact with the gnu version | ||
| 5 | control repository in smaller, properly incremental steps, from | ||
| 6 | here on.) | ||
| 7 | |||
| 8 | This main features of the changes here are: | ||
| 9 | |||
| 10 | - implement user customization for the allout key bindings | ||
| 11 | - add a customization control by which the user can inhibit use of | ||
| 12 | a trailing Ctl-H, so by default it's reserved for use with | ||
| 13 | describe-prefix-bindings | ||
| 14 | - adapt to new version of called-interactively-p, while | ||
| 15 | maintaining backwards compatability with old version | ||
| 16 | - fix hotspot navigation so i works properly with meta-modified keys | ||
| 17 | |||
| 18 | + allout.el (allout-keybindings), (allout-bind-keys), | ||
| 19 | (allout-keybindings-binding), allout-prefixed-keybindings, | ||
| 20 | allout-unprefixed-keybindings, allout-preempt-trailing-ctrl-h, | ||
| 21 | allout-keybindings-list, | ||
| 22 | allout-mode-map-adjustments, (allout-setup-mode-map): Establish | ||
| 23 | allout-mode keymaps as user customizable settings, and also | ||
| 24 | establish a customizable setting which regulates whether or not a | ||
| 25 | trailing control-h is reserved for use with | ||
| 26 | describe-prefix-bindings - and inihibit it by default, so that | ||
| 27 | control-h *is* reserved for describe-prefix-bindings unless the | ||
| 28 | user changes this setting. | ||
| 29 | |||
| 30 | (allout-hotspot-key-handler): Distinguish more explicitly and | ||
| 31 | accurately between modified and unmodified events, and handle | ||
| 32 | modified events more comprehensively. | ||
| 33 | |||
| 34 | (allout-substring-no-properties): Alias to use or provide version | ||
| 35 | of 'substring-no-properties'. | ||
| 36 | (allout-solicit-alternate-bullet): Use | ||
| 37 | 'allout-substring-no-properties'. | ||
| 38 | |||
| 39 | (allout-next-single-char-property-change): Alias to use or provide | ||
| 40 | version of 'next-single-char-property-change'. | ||
| 41 | (allout-annotate-hidden), (allout-hide-by-annotation): Use | ||
| 42 | 'allout-next-single-char-property-change'. | ||
| 43 | |||
| 44 | (allout-select-safe-coding-system): Alias to use or provide | ||
| 45 | version of 'select-safe-coding-system'. | ||
| 46 | (allout-toggle-subtree-encryption): Use | ||
| 47 | 'allout-select-safe-coding-system'. | ||
| 48 | |||
| 49 | (allout-set-buffer-multibyte): Alias to use or provide version of | ||
| 50 | 'set-buffer-multibyte'. | ||
| 51 | (allout-encrypt-string): Use 'allout-set-buffer-multibyte'. | ||
| 52 | |||
| 53 | (allout-called-interactively-p): Macro for using the different | ||
| 54 | versions of called-interactively-p identically, depending on the | ||
| 55 | subroutine's argument signature. | ||
| 56 | |||
| 57 | (allout-back-to-current-heading), (allout-beginning-of-current-entry) | ||
| 58 | - use '(interactive "p")' instead of '(called-interactively-p)'. | ||
| 59 | |||
| 60 | (allout-init), (allout-ascend), (allout-end-of-level), | ||
| 61 | (allout-previous-visible-heading), (allout-forward-current-level), | ||
| 62 | (allout-backward-current-level), (allout-show-children) - use | ||
| 63 | '(allout-called-interactively-p)' instead of | ||
| 64 | '(called-interactively-p)'. | ||
| 65 | |||
| 66 | (allout-before-change-handler): Exempt edits to the (overlaid) | ||
| 67 | character after the allout outline bullet from edit confirmation | ||
| 68 | prompt. | ||
| 69 | |||
| 70 | (allout-add-resumptions): Ensure that it respects correct buffer | ||
| 71 | for keybindings. | ||
| 72 | |||
| 73 | (allout-beginning-of-line): Use | ||
| 74 | 'allout-previous-single-char-property-change' alias for the sake | ||
| 75 | of diverse compatibility. | ||
| 76 | |||
| 77 | (allout-end-of-line): Use 'allout-mark-active-p' to encapsulate | ||
| 78 | respect for mark activity. | ||
| 79 | |||
| 80 | |||
| 1 | 2010-11-13 Chong Yidong <cyd@stupidchicken.com> | 81 | 2010-11-13 Chong Yidong <cyd@stupidchicken.com> |
| 2 | 82 | ||
| 3 | * frame.el (frame-notice-user-settings): Don't clobber other | 83 | * frame.el (frame-notice-user-settings): Don't clobber other |
diff --git a/lisp/allout.el b/lisp/allout.el index 4d003900cbc..278fb7673d8 100644 --- a/lisp/allout.el +++ b/lisp/allout.el | |||
| @@ -1,7 +1,7 @@ | |||
| 1 | ;;; allout.el --- extensive outline mode for use alone and with other modes | 1 | ;;; allout.el --- extensive outline mode for use alone and with other modes |
| 2 | 2 | ||
| 3 | ;; Copyright (C) 1992, 1993, 1994, 2001, 2002, 2003, 2004, 2005, 2006, | 3 | ;; Copyright (C) 1992, 1993, 1994, 2001, 2002, 2003, 2004, 2005, |
| 4 | ;; 2007, 2008, 2009, 2010 Free Software Foundation, Inc. | 4 | ;; 2006, 2007, 2008, 2009 Free Software Foundation, Inc. |
| 5 | 5 | ||
| 6 | ;; Author: Ken Manheimer <ken dot manheimer at gmail dot com> | 6 | ;; Author: Ken Manheimer <ken dot manheimer at gmail dot com> |
| 7 | ;; Maintainer: Ken Manheimer <ken dot manheimer at gmail dot com> | 7 | ;; Maintainer: Ken Manheimer <ken dot manheimer at gmail dot com> |
| @@ -98,21 +98,142 @@ | |||
| 98 | 98 | ||
| 99 | ;;;_* USER CUSTOMIZATION VARIABLES: | 99 | ;;;_* USER CUSTOMIZATION VARIABLES: |
| 100 | 100 | ||
| 101 | ;;;_ > defgroup allout | 101 | ;;;_ > defgroup allout, allout-keybindings |
| 102 | (defgroup allout nil | 102 | (defgroup allout nil |
| 103 | "Extensive outline mode for use alone and with other modes." | 103 | "Extensive outline mode for use alone and with other modes." |
| 104 | :prefix "allout-" | 104 | :prefix "allout-" |
| 105 | :group 'outlines) | 105 | :group 'outlines) |
| 106 | (defgroup allout-keybindings nil | ||
| 107 | "Allout outline mode keyboard bindings configuration." | ||
| 108 | :group 'allout) | ||
| 106 | 109 | ||
| 107 | ;;;_ + Layout, Mode, and Topic Header Configuration | 110 | ;;;_ + Layout, Mode, and Topic Header Configuration |
| 108 | 111 | ||
| 109 | ;;;_ = allout-command-prefix | 112 | ;;;_ > allout-keybindings incidentals: |
| 113 | ;;;_ > allout-bind-keys &optional varname value | ||
| 114 | (defun allout-bind-keys (&optional varname value) | ||
| 115 | "Rebuild the `allout-mode-map' according to the keybinding specs. | ||
| 116 | |||
| 117 | Useful standalone, to init the map, or in customizing the | ||
| 118 | respective allout-mode keybinding variables, `allout-command-prefix', | ||
| 119 | `allout-prefixed-keybindings', and `allout-unprefixed-keybindings'" | ||
| 120 | ;; Set the customization variable, if any: | ||
| 121 | (when varname | ||
| 122 | (set-default varname value)) | ||
| 123 | (let ((map (make-sparse-keymap)) | ||
| 124 | key) | ||
| 125 | (when (boundp 'allout-prefixed-keybindings) | ||
| 126 | ;; Be tolerant of the moments when the variables are first being defined. | ||
| 127 | (dolist (entry allout-prefixed-keybindings) | ||
| 128 | (define-key map | ||
| 129 | ;; XXX vector vs non-vector key descriptions? | ||
| 130 | (vconcat allout-command-prefix | ||
| 131 | (car (read-from-string (car entry)))) | ||
| 132 | (cadr entry)))) | ||
| 133 | (when (boundp 'allout-unprefixed-keybindings) | ||
| 134 | (dolist (entry allout-unprefixed-keybindings) | ||
| 135 | (define-key map (car (read-from-string (car entry))) (cadr entry)))) | ||
| 136 | (setq allout-mode-map map) | ||
| 137 | map | ||
| 138 | )) | ||
| 139 | ;;;_ = allout-command-prefix | ||
| 110 | (defcustom allout-command-prefix "\C-c " | 140 | (defcustom allout-command-prefix "\C-c " |
| 111 | "Key sequence to be used as prefix for outline mode command key bindings. | 141 | "Key sequence to be used as prefix for outline mode command key bindings. |
| 112 | 142 | ||
| 113 | Default is '\C-c<space>'; just '\C-c' is more short-and-sweet, if you're | 143 | Default is '\C-c<space>'; just '\C-c' is more short-and-sweet, if you're |
| 114 | willing to let allout use a bunch of \C-c keybindings." | 144 | willing to let allout use a bunch of \C-c keybindings." |
| 115 | :type 'string | 145 | :type 'string |
| 146 | :group 'allout-keybindings | ||
| 147 | :set 'allout-bind-keys) | ||
| 148 | ;;;_ = allout-keybindings-binding | ||
| 149 | (define-widget 'allout-keybindings-binding 'lazy | ||
| 150 | "Structure of allout keybindings customization items." | ||
| 151 | :type '(repeat | ||
| 152 | (list (string :tag "Key" :value "[(meta control shift ?f)]") | ||
| 153 | (function :tag "Function name" | ||
| 154 | :value allout-forward-current-level)))) | ||
| 155 | ;;;_ = allout-prefixed-keybindings | ||
| 156 | (defcustom allout-prefixed-keybindings | ||
| 157 | '(("[(control ?n)]" allout-next-visible-heading) | ||
| 158 | ("[(control ?p)]" allout-previous-visible-heading) | ||
| 159 | ;; ("[(control ?u)]" allout-up-current-level) | ||
| 160 | ("[(control ?f)]" allout-forward-current-level) | ||
| 161 | ("[(control ?b)]" allout-backward-current-level) | ||
| 162 | ("[(control ?a)]" allout-beginning-of-current-entry) | ||
| 163 | ("[(control ?e)]" allout-end-of-entry) | ||
| 164 | ("[(control ?i)]" allout-show-children) | ||
| 165 | ("[(control ?i)]" allout-show-children) | ||
| 166 | ("[(control ?s)]" allout-show-current-subtree) | ||
| 167 | ("[(control ?t)]" allout-toggle-current-subtree-exposure) | ||
| 168 | ("[(control ?h)]" allout-hide-current-subtree) | ||
| 169 | ("[?h]" allout-hide-current-subtree) | ||
| 170 | ("[(control ?o)]" allout-show-current-entry) | ||
| 171 | ("[?!]" allout-show-all) | ||
| 172 | ("[?x]" allout-toggle-current-subtree-encryption) | ||
| 173 | ("[? ]" allout-open-sibtopic) | ||
| 174 | ("[?.]" allout-open-subtopic) | ||
| 175 | ("[?,]" allout-open-supertopic) | ||
| 176 | ("[?']" allout-shift-in) | ||
| 177 | ("[?>]" allout-shift-in) | ||
| 178 | ("[?<]" allout-shift-out) | ||
| 179 | ("[(control ?m)]" allout-rebullet-topic) | ||
| 180 | ("[?*]" allout-rebullet-current-heading) | ||
| 181 | ("[?']" allout-number-siblings) | ||
| 182 | ("[(control ?k)]" allout-kill-topic) | ||
| 183 | ("[??]" allout-copy-topic-as-kill) | ||
| 184 | ("[?@]" allout-resolve-xref) | ||
| 185 | ("[?=?c]" allout-copy-exposed-to-buffer) | ||
| 186 | ("[?=?i]" allout-indented-exposed-to-buffer) | ||
| 187 | ("[?=?t]" allout-latexify-exposed) | ||
| 188 | ("[?=?p]" allout-flatten-exposed-to-buffer) | ||
| 189 | ) | ||
| 190 | "Allout-mode key bindings that are prefixed with `allout-command-prefix'. | ||
| 191 | |||
| 192 | See `allout-unprefixed-keybindings' for the list of keybindings | ||
| 193 | that are not prefixed. | ||
| 194 | |||
| 195 | Use vector format for the keys: | ||
| 196 | - put literal keys after a '?' question mark, eg: '?a', '?.' | ||
| 197 | - enclose control, shift, or meta-modified keys as sequences within | ||
| 198 | parentheses, with the literal key, as above, preceded by the name(s) | ||
| 199 | of the modifers, eg: [(control ?a)] | ||
| 200 | See the existing keys for examples. | ||
| 201 | |||
| 202 | Functions can be bound to multiple keys, but binding keys to | ||
| 203 | multiple functions will not work - the last binding for a key | ||
| 204 | prevails." | ||
| 205 | :type 'allout-keybindings-binding | ||
| 206 | :group 'allout-keybindings | ||
| 207 | :set 'allout-bind-keys | ||
| 208 | ) | ||
| 209 | ;;;_ = allout-unprefixed-keybindings | ||
| 210 | (defcustom allout-unprefixed-keybindings | ||
| 211 | '(("[(control ?k)]" allout-kill-line) | ||
| 212 | ("[??(meta ?k)]" allout-copy-line-as-kill) | ||
| 213 | ("[(control ?y)]" allout-yank) | ||
| 214 | ("[??(meta ?y)]" allout-yank-pop) | ||
| 215 | ) | ||
| 216 | "Allout-mode functions bound to keys without any added prefix. | ||
| 217 | |||
| 218 | This is in contrast to the majority of allout-mode bindings on | ||
| 219 | `allout-prefixed-bindings', whose bindings are created with a | ||
| 220 | preceeding command key. | ||
| 221 | |||
| 222 | Use vector format for the keys: | ||
| 223 | - put literal keys after a '?' question mark, eg: '?a', '?.' | ||
| 224 | - enclose control, shift, or meta-modified keys as sequences within | ||
| 225 | parentheses, with the literal key, as above, preceded by the name(s) | ||
| 226 | of the modifers, eg: [(control ?a)] | ||
| 227 | See the existing keys for examples." | ||
| 228 | :type 'allout-keybindings-binding | ||
| 229 | :group 'allout-keybindings | ||
| 230 | :set 'allout-bind-keys | ||
| 231 | ) | ||
| 232 | |||
| 233 | ;;;_ = allout-preempt-trailing-ctrl-h | ||
| 234 | (defcustom allout-preempt-trailing-ctrl-h nil | ||
| 235 | "Use <prefix>-\C-h, instead of leaving it for describe-prefix-bindings?" | ||
| 236 | :type 'boolean | ||
| 116 | :group 'allout) | 237 | :group 'allout) |
| 117 | 238 | ||
| 118 | ;;;_ = allout-keybindings-list | 239 | ;;;_ = allout-keybindings-list |
| @@ -133,9 +254,13 @@ unless optional third, non-nil element is present.") | |||
| 133 | ("\C-a" allout-beginning-of-current-entry) | 254 | ("\C-a" allout-beginning-of-current-entry) |
| 134 | ("\C-e" allout-end-of-entry) | 255 | ("\C-e" allout-end-of-entry) |
| 135 | ; Exposure commands: | 256 | ; Exposure commands: |
| 136 | ("\C-i" allout-show-children) | 257 | ([(control i)] allout-show-children) ; xemacs translates "\C-i" to tab |
| 258 | ("\C-i" allout-show-children) ; but we still need this for hotspot | ||
| 137 | ("\C-s" allout-show-current-subtree) | 259 | ("\C-s" allout-show-current-subtree) |
| 138 | ("\C-h" allout-hide-current-subtree) | 260 | ;; binding to \C-h is included if allout-preempt-trailing-ctrl-h, |
| 261 | ;; so user controls whether or not to preempt the conventional ^H | ||
| 262 | ;; binding to help-command. | ||
| 263 | ("\C-h" allout-hide-current-subtree) | ||
| 139 | ("\C-t" allout-toggle-current-subtree-exposure) | 264 | ("\C-t" allout-toggle-current-subtree-exposure) |
| 140 | ("h" allout-hide-current-subtree) | 265 | ("h" allout-hide-current-subtree) |
| 141 | ("\C-o" allout-show-current-entry) | 266 | ("\C-o" allout-show-current-entry) |
| @@ -753,7 +878,7 @@ disable auto-saves for that file." | |||
| 753 | ;;;_ + Developer | 878 | ;;;_ + Developer |
| 754 | ;;;_ = allout-developer group | 879 | ;;;_ = allout-developer group |
| 755 | (defgroup allout-developer nil | 880 | (defgroup allout-developer nil |
| 756 | "Settings for topic encryption features of allout outliner." | 881 | "Allout settings developers care about, including topic encryption and more." |
| 757 | :group 'allout) | 882 | :group 'allout) |
| 758 | ;;;_ = allout-run-unit-tests-on-load | 883 | ;;;_ = allout-run-unit-tests-on-load |
| 759 | (defcustom allout-run-unit-tests-on-load nil | 884 | (defcustom allout-run-unit-tests-on-load nil |
| @@ -1163,6 +1288,13 @@ See doc string for `allout-keybindings-list' for format of binding list." | |||
| 1163 | (car (cdr cell))))))) | 1288 | (car (cdr cell))))))) |
| 1164 | keymap-list) | 1289 | keymap-list) |
| 1165 | map)) | 1290 | map)) |
| 1291 | ;;;_ > allout-mode-map-adjustments (base-map) | ||
| 1292 | (defun allout-mode-map-adjustments (base-map) | ||
| 1293 | "Do conditional additions to specified base-map, like inclusion of \\C-h." | ||
| 1294 | (if allout-preempt-trailing-ctrl-h | ||
| 1295 | (cons '("\C-h" allout-hide-current-subtree) base-map) | ||
| 1296 | base-map) | ||
| 1297 | ) | ||
| 1166 | ;;;_ : Menu bar | 1298 | ;;;_ : Menu bar |
| 1167 | (defvar allout-mode-exposure-menu) | 1299 | (defvar allout-mode-exposure-menu) |
| 1168 | (defvar allout-mode-editing-menu) | 1300 | (defvar allout-mode-editing-menu) |
| @@ -1278,7 +1410,7 @@ The settings are stored on `allout-mode-prior-settings'." | |||
| 1278 | (void-variable nil))) | 1410 | (void-variable nil))) |
| 1279 | (when (not (assoc name allout-mode-prior-settings)) | 1411 | (when (not (assoc name allout-mode-prior-settings)) |
| 1280 | ;; Not already added as a resumption, create the prior setting entry. | 1412 | ;; Not already added as a resumption, create the prior setting entry. |
| 1281 | (if (local-variable-p name) | 1413 | (if (local-variable-p name (current-buffer)) |
| 1282 | ;; is already local variable -- preserve the prior value: | 1414 | ;; is already local variable -- preserve the prior value: |
| 1283 | (push (list name prior-value) allout-mode-prior-settings) | 1415 | (push (list name prior-value) allout-mode-prior-settings) |
| 1284 | ;; wasn't local variable, indicate so for resumption by killing | 1416 | ;; wasn't local variable, indicate so for resumption by killing |
| @@ -1541,6 +1673,14 @@ and the place for the cursor after the decryption is done." | |||
| 1541 | (goto-char (cadr allout-after-save-decrypt)) | 1673 | (goto-char (cadr allout-after-save-decrypt)) |
| 1542 | (setq allout-after-save-decrypt nil)) | 1674 | (setq allout-after-save-decrypt nil)) |
| 1543 | ) | 1675 | ) |
| 1676 | ;;;_ > allout-called-interactively-p () | ||
| 1677 | (defmacro allout-called-interactively-p () | ||
| 1678 | "A version of called-interactively-p independent of emacs version." | ||
| 1679 | ;; ... to ease maintenance of allout without betraying deprecation. | ||
| 1680 | (if (equal (subr-arity (symbol-function 'called-interactively-p)) | ||
| 1681 | '(0 . 0)) | ||
| 1682 | '(called-interactively-p) | ||
| 1683 | '(called-interactively-p 'interactive))) | ||
| 1544 | ;;;_ = allout-inhibit-aberrance-doublecheck nil | 1684 | ;;;_ = allout-inhibit-aberrance-doublecheck nil |
| 1545 | ;; In some exceptional moments, disparate topic depths need to be allowed | 1685 | ;; In some exceptional moments, disparate topic depths need to be allowed |
| 1546 | ;; momentarily, eg when one topic is being yanked into another and they're | 1686 | ;; momentarily, eg when one topic is being yanked into another and they're |
| @@ -1554,7 +1694,7 @@ and the place for the cursor after the decryption is done." | |||
| 1554 | This should only be momentarily let-bound non-nil, not set | 1694 | This should only be momentarily let-bound non-nil, not set |
| 1555 | non-nil in a lasting way.") | 1695 | non-nil in a lasting way.") |
| 1556 | 1696 | ||
| 1557 | ;;;_ #2 Mode activation | 1697 | ;;;_ #2 Mode environment and activation |
| 1558 | ;;;_ = allout-explicitly-deactivated | 1698 | ;;;_ = allout-explicitly-deactivated |
| 1559 | (defvar allout-explicitly-deactivated nil | 1699 | (defvar allout-explicitly-deactivated nil |
| 1560 | "If t, `allout-mode's last deactivation was deliberate. | 1700 | "If t, `allout-mode's last deactivation was deliberate. |
| @@ -1590,7 +1730,7 @@ the following two lines in your Emacs init file: | |||
| 1590 | \(allout-init t)" | 1730 | \(allout-init t)" |
| 1591 | 1731 | ||
| 1592 | (interactive) | 1732 | (interactive) |
| 1593 | (if (called-interactively-p 'interactive) | 1733 | (if (allout-called-interactively-p) |
| 1594 | (progn | 1734 | (progn |
| 1595 | (setq mode | 1735 | (setq mode |
| 1596 | (completing-read | 1736 | (completing-read |
| @@ -1614,7 +1754,7 @@ the following two lines in your Emacs init file: | |||
| 1614 | (cond ((not mode) | 1754 | (cond ((not mode) |
| 1615 | (set find-file-hook-var-name | 1755 | (set find-file-hook-var-name |
| 1616 | (delq hook (symbol-value find-file-hook-var-name))) | 1756 | (delq hook (symbol-value find-file-hook-var-name))) |
| 1617 | (if (called-interactively-p 'interactive) | 1757 | (if (allout-called-interactively-p) |
| 1618 | (message "Allout outline mode auto-activation inhibited."))) | 1758 | (message "Allout outline mode auto-activation inhibited."))) |
| 1619 | ((eq mode 'report) | 1759 | ((eq mode 'report) |
| 1620 | (if (not (memq hook (symbol-value find-file-hook-var-name))) | 1760 | (if (not (memq hook (symbol-value find-file-hook-var-name))) |
| @@ -1656,7 +1796,7 @@ the following two lines in your Emacs init file: | |||
| 1656 | (setplist 'allout-exposure-category nil) | 1796 | (setplist 'allout-exposure-category nil) |
| 1657 | (put 'allout-exposure-category 'invisible 'allout) | 1797 | (put 'allout-exposure-category 'invisible 'allout) |
| 1658 | (put 'allout-exposure-category 'evaporate t) | 1798 | (put 'allout-exposure-category 'evaporate t) |
| 1659 | ;; XXX We use isearch-open-invisible *and* isearch-mode-end-hook. The | 1799 | ;; ??? We use isearch-open-invisible *and* isearch-mode-end-hook. The |
| 1660 | ;; latter would be sufficient, but it seems that a separate behavior -- | 1800 | ;; latter would be sufficient, but it seems that a separate behavior -- |
| 1661 | ;; the _transient_ opening of invisible text during isearch -- is keyed to | 1801 | ;; the _transient_ opening of invisible text during isearch -- is keyed to |
| 1662 | ;; presence of the isearch-open-invisible property -- even though this | 1802 | ;; presence of the isearch-open-invisible property -- even though this |
| @@ -2116,9 +2256,11 @@ OPEN: A TOPIC that is not CLOSED, though its OFFSPRING or BODY may be." | |||
| 2116 | (defun allout-setup-mode-map () | 2256 | (defun allout-setup-mode-map () |
| 2117 | "Establish allout-mode bindings." | 2257 | "Establish allout-mode bindings." |
| 2118 | (setq-default allout-mode-map | 2258 | (setq-default allout-mode-map |
| 2119 | (produce-allout-mode-map allout-keybindings-list)) | 2259 | (produce-allout-mode-map |
| 2260 | (allout-mode-map-adjustments allout-keybindings-list))) | ||
| 2120 | (setq allout-mode-map | 2261 | (setq allout-mode-map |
| 2121 | (produce-allout-mode-map allout-keybindings-list)) | 2262 | (produce-allout-mode-map |
| 2263 | (allout-mode-map-adjustments allout-keybindings-list))) | ||
| 2122 | (substitute-key-definition 'beginning-of-line | 2264 | (substitute-key-definition 'beginning-of-line |
| 2123 | 'allout-beginning-of-line | 2265 | 'allout-beginning-of-line |
| 2124 | allout-mode-map global-map) | 2266 | allout-mode-map global-map) |
| @@ -2153,7 +2295,7 @@ OPEN: A TOPIC that is not CLOSED, though its OFFSPRING or BODY may be." | |||
| 2153 | ;;;_ - Position Assessment | 2295 | ;;;_ - Position Assessment |
| 2154 | ;;;_ > allout-hidden-p (&optional pos) | 2296 | ;;;_ > allout-hidden-p (&optional pos) |
| 2155 | (defsubst allout-hidden-p (&optional pos) | 2297 | (defsubst allout-hidden-p (&optional pos) |
| 2156 | "Non-nil if the character after point is invisible." | 2298 | "Non-nil if the character after point was made invisible by allout." |
| 2157 | (eq (get-char-property (or pos (point)) 'invisible) 'allout)) | 2299 | (eq (get-char-property (or pos (point)) 'invisible) 'allout)) |
| 2158 | 2300 | ||
| 2159 | ;;;_ > allout-overlay-insert-in-front-handler (ol after beg end | 2301 | ;;;_ > allout-overlay-insert-in-front-handler (ol after beg end |
| @@ -2162,8 +2304,8 @@ OPEN: A TOPIC that is not CLOSED, though its OFFSPRING or BODY may be." | |||
| 2162 | &optional prelen) | 2304 | &optional prelen) |
| 2163 | "Shift the overlay so stuff inserted in front of it is excluded." | 2305 | "Shift the overlay so stuff inserted in front of it is excluded." |
| 2164 | (if after | 2306 | (if after |
| 2165 | ;; XXX Shouldn't moving the overlay should be unnecessary, if overlay | 2307 | ;; ??? Shouldn't moving the overlay should be unnecessary, if overlay |
| 2166 | ;; front-advance on the overlay worked as it should? | 2308 | ;; front-advance on the overlay worked as expected? |
| 2167 | (move-overlay ol (1+ beg) (overlay-end ol)))) | 2309 | (move-overlay ol (1+ beg) (overlay-end ol)))) |
| 2168 | ;;;_ > allout-overlay-interior-modification-handler (ol after beg end | 2310 | ;;;_ > allout-overlay-interior-modification-handler (ol after beg end |
| 2169 | ;;; &optional prelen) | 2311 | ;;; &optional prelen) |
| @@ -2225,8 +2367,9 @@ See `allout-overlay-interior-modification-handler' for details." | |||
| 2225 | (save-excursion | 2367 | (save-excursion |
| 2226 | (goto-char beg) | 2368 | (goto-char beg) |
| 2227 | (let ((overlay (allout-get-invisibility-overlay))) | 2369 | (let ((overlay (allout-get-invisibility-overlay))) |
| 2228 | (allout-overlay-interior-modification-handler | 2370 | (if overlay |
| 2229 | overlay nil beg end nil))))) | 2371 | (allout-overlay-interior-modification-handler |
| 2372 | overlay nil beg end nil)))))) | ||
| 2230 | ;;;_ > allout-isearch-end-handler (&optional overlay) | 2373 | ;;;_ > allout-isearch-end-handler (&optional overlay) |
| 2231 | (defun allout-isearch-end-handler (&optional overlay) | 2374 | (defun allout-isearch-end-handler (&optional overlay) |
| 2232 | "Reconcile allout outline exposure on arriving in hidden text after isearch. | 2375 | "Reconcile allout outline exposure on arriving in hidden text after isearch. |
| @@ -2508,7 +2651,7 @@ Outermost is first." | |||
| 2508 | ;;;_ > allout-end-of-current-line () | 2651 | ;;;_ > allout-end-of-current-line () |
| 2509 | (defun allout-end-of-current-line () | 2652 | (defun allout-end-of-current-line () |
| 2510 | "Move to the end of line, past concealed text if any." | 2653 | "Move to the end of line, past concealed text if any." |
| 2511 | ;; XXX This is for symmetry with `allout-beginning-of-current-line' -- | 2654 | ;; This is for symmetry with `allout-beginning-of-current-line' -- |
| 2512 | ;; `move-end-of-line' doesn't suffer the same problem as | 2655 | ;; `move-end-of-line' doesn't suffer the same problem as |
| 2513 | ;; `move-beginning-of-line'. | 2656 | ;; `move-beginning-of-line'. |
| 2514 | (let ((inhibit-field-text-motion t)) | 2657 | (let ((inhibit-field-text-motion t)) |
| @@ -2527,7 +2670,7 @@ Outermost is first." | |||
| 2527 | (progn | 2670 | (progn |
| 2528 | (if (and (not (bolp)) | 2671 | (if (and (not (bolp)) |
| 2529 | (allout-hidden-p (1- (point)))) | 2672 | (allout-hidden-p (1- (point)))) |
| 2530 | (goto-char (previous-single-char-property-change | 2673 | (goto-char (allout-previous-single-char-property-change |
| 2531 | (1- (point)) 'invisible))) | 2674 | (1- (point)) 'invisible))) |
| 2532 | (move-beginning-of-line 1)) | 2675 | (move-beginning-of-line 1)) |
| 2533 | (allout-depth) | 2676 | (allout-depth) |
| @@ -2573,9 +2716,20 @@ Outermost is first." | |||
| 2573 | (allout-back-to-current-heading) | 2716 | (allout-back-to-current-heading) |
| 2574 | (allout-end-of-current-line)) | 2717 | (allout-end-of-current-line)) |
| 2575 | (t | 2718 | (t |
| 2576 | (if (not (and transient-mark-mode mark-active)) | 2719 | (if (not (allout-mark-active-p)) |
| 2577 | (push-mark)) | 2720 | (push-mark)) |
| 2578 | (allout-end-of-entry)))))) | 2721 | (allout-end-of-entry)))))) |
| 2722 | ;;;_ > allout-mark-active-p () | ||
| 2723 | (defun allout-mark-active-p () | ||
| 2724 | "True if the mark is currently or always active." | ||
| 2725 | ;; `(cond (boundp...))' (or `(if ...)') invokes special byte-compiler | ||
| 2726 | ;; provisions, at least in fsf emacs to prevent warnings about lack of, | ||
| 2727 | ;; eg, region-active-p. | ||
| 2728 | (cond ((boundp 'mark-active) | ||
| 2729 | mark-active) | ||
| 2730 | ((fboundp 'region-active-p) | ||
| 2731 | (region-active-p)) | ||
| 2732 | (t))) | ||
| 2579 | ;;;_ > allout-next-heading () | 2733 | ;;;_ > allout-next-heading () |
| 2580 | (defsubst allout-next-heading () | 2734 | (defsubst allout-next-heading () |
| 2581 | "Move to the heading for the topic (possibly invisible) after this one. | 2735 | "Move to the heading for the topic (possibly invisible) after this one. |
| @@ -2888,8 +3042,8 @@ otherwise skip white space between bullet and ensuing text." | |||
| 2888 | (if (not (allout-current-depth)) | 3042 | (if (not (allout-current-depth)) |
| 2889 | nil | 3043 | nil |
| 2890 | (1- allout-recent-prefix-end))) | 3044 | (1- allout-recent-prefix-end))) |
| 2891 | ;;;_ > allout-back-to-current-heading () | 3045 | ;;;_ > allout-back-to-current-heading (&optional interactive) |
| 2892 | (defun allout-back-to-current-heading () | 3046 | (defun allout-back-to-current-heading (&optional interactive) |
| 2893 | "Move to heading line of current topic, or beginning if not in a topic. | 3047 | "Move to heading line of current topic, or beginning if not in a topic. |
| 2894 | 3048 | ||
| 2895 | If interactive, we position at the end of the prefix. | 3049 | If interactive, we position at the end of the prefix. |
| @@ -2897,11 +3051,13 @@ If interactive, we position at the end of the prefix. | |||
| 2897 | Return value of resulting point, unless we started outside | 3051 | Return value of resulting point, unless we started outside |
| 2898 | of (before any) topics, in which case we return nil." | 3052 | of (before any) topics, in which case we return nil." |
| 2899 | 3053 | ||
| 3054 | (interactive "p") | ||
| 3055 | |||
| 2900 | (allout-beginning-of-current-line) | 3056 | (allout-beginning-of-current-line) |
| 2901 | (let ((bol-point (point))) | 3057 | (let ((bol-point (point))) |
| 2902 | (if (allout-goto-prefix-doublechecked) | 3058 | (if (allout-goto-prefix-doublechecked) |
| 2903 | (if (<= (point) bol-point) | 3059 | (if (<= (point) bol-point) |
| 2904 | (if (called-interactively-p 'interactive) | 3060 | (if interactive |
| 2905 | (allout-end-of-prefix) | 3061 | (allout-end-of-prefix) |
| 2906 | (point)) | 3062 | (point)) |
| 2907 | (goto-char (point-min)) | 3063 | (goto-char (point-min)) |
| @@ -2955,20 +3111,20 @@ excluded as delimiting whitespace between topics. | |||
| 2955 | Returns the value of point." | 3111 | Returns the value of point." |
| 2956 | (interactive) | 3112 | (interactive) |
| 2957 | (allout-end-of-subtree t include-trailing-blank)) | 3113 | (allout-end-of-subtree t include-trailing-blank)) |
| 2958 | ;;;_ > allout-beginning-of-current-entry () | 3114 | ;;;_ > allout-beginning-of-current-entry (&optional interactive) |
| 2959 | (defun allout-beginning-of-current-entry () | 3115 | (defun allout-beginning-of-current-entry (&optional interactive) |
| 2960 | "When not already there, position point at beginning of current topic header. | 3116 | "When not already there, position point at beginning of current topic header. |
| 2961 | 3117 | ||
| 2962 | If already there, move cursor to bullet for hot-spot operation. | 3118 | If already there, move cursor to bullet for hot-spot operation. |
| 2963 | \(See `allout-mode' doc string for details of hot-spot operation.)" | 3119 | \(See `allout-mode' doc string for details of hot-spot operation.)" |
| 2964 | (interactive) | 3120 | (interactive "p") |
| 2965 | (let ((start-point (point))) | 3121 | (let ((start-point (point))) |
| 2966 | (move-beginning-of-line 1) | 3122 | (move-beginning-of-line 1) |
| 2967 | (if (< 0 (allout-current-depth)) | 3123 | (if (< 0 (allout-current-depth)) |
| 2968 | (goto-char allout-recent-prefix-end) | 3124 | (goto-char allout-recent-prefix-end) |
| 2969 | (goto-char (point-min))) | 3125 | (goto-char (point-min))) |
| 2970 | (allout-end-of-prefix) | 3126 | (allout-end-of-prefix) |
| 2971 | (if (and (called-interactively-p 'interactive) | 3127 | (if (and interactive |
| 2972 | (= (point) start-point)) | 3128 | (= (point) start-point)) |
| 2973 | (goto-char (allout-current-bullet-pos))))) | 3129 | (goto-char (allout-current-bullet-pos))))) |
| 2974 | ;;;_ > allout-end-of-entry (&optional inclusive) | 3130 | ;;;_ > allout-end-of-entry (&optional inclusive) |
| @@ -3018,9 +3174,9 @@ collapsed." | |||
| 3018 | (while (and (< depth allout-recent-depth) | 3174 | (while (and (< depth allout-recent-depth) |
| 3019 | (setq last-ascended (allout-ascend)))) | 3175 | (setq last-ascended (allout-ascend)))) |
| 3020 | (goto-char allout-recent-prefix-beginning) | 3176 | (goto-char allout-recent-prefix-beginning) |
| 3021 | (if (called-interactively-p 'interactive) (allout-end-of-prefix)) | 3177 | (if (allout-called-interactively-p) (allout-end-of-prefix)) |
| 3022 | (and last-ascended allout-recent-depth)))) | 3178 | (and last-ascended allout-recent-depth)))) |
| 3023 | ;;;_ > allout-ascend () | 3179 | ;;;_ > allout-ascend (&optional dont-move-if-unsuccessful) |
| 3024 | (defun allout-ascend (&optional dont-move-if-unsuccessful) | 3180 | (defun allout-ascend (&optional dont-move-if-unsuccessful) |
| 3025 | "Ascend one level, returning resulting depth if successful, nil if not. | 3181 | "Ascend one level, returning resulting depth if successful, nil if not. |
| 3026 | 3182 | ||
| @@ -3046,7 +3202,7 @@ which case point is returned to its original starting location." | |||
| 3046 | (goto-char bolevel) | 3202 | (goto-char bolevel) |
| 3047 | (allout-depth) | 3203 | (allout-depth) |
| 3048 | nil)))) | 3204 | nil)))) |
| 3049 | (if (called-interactively-p 'interactive) (allout-end-of-prefix)))) | 3205 | (if (allout-called-interactively-p) (allout-end-of-prefix)))) |
| 3050 | ;;;_ > allout-descend-to-depth (depth) | 3206 | ;;;_ > allout-descend-to-depth (depth) |
| 3051 | (defun allout-descend-to-depth (depth) | 3207 | (defun allout-descend-to-depth (depth) |
| 3052 | "Descend to depth DEPTH within current topic. | 3208 | "Descend to depth DEPTH within current topic. |
| @@ -3074,7 +3230,7 @@ Returning depth if successful, nil if not." | |||
| 3074 | (if (not (allout-ascend)) | 3230 | (if (not (allout-ascend)) |
| 3075 | (progn (goto-char start-point) | 3231 | (progn (goto-char start-point) |
| 3076 | (error "Can't ascend past outermost level")) | 3232 | (error "Can't ascend past outermost level")) |
| 3077 | (if (called-interactively-p 'interactive) (allout-end-of-prefix)) | 3233 | (if (allout-called-interactively-p) (allout-end-of-prefix)) |
| 3078 | allout-recent-prefix-beginning))) | 3234 | allout-recent-prefix-beginning))) |
| 3079 | 3235 | ||
| 3080 | ;;;_ - Linear | 3236 | ;;;_ - Linear |
| @@ -3219,7 +3375,7 @@ Presumes point is at the start of a topic prefix." | |||
| 3219 | (let ((depth (allout-depth))) | 3375 | (let ((depth (allout-depth))) |
| 3220 | (while (allout-previous-sibling depth nil)) | 3376 | (while (allout-previous-sibling depth nil)) |
| 3221 | (prog1 allout-recent-depth | 3377 | (prog1 allout-recent-depth |
| 3222 | (if (called-interactively-p 'interactive) (allout-end-of-prefix))))) | 3378 | (if (allout-called-interactively-p) (allout-end-of-prefix))))) |
| 3223 | ;;;_ > allout-next-visible-heading (arg) | 3379 | ;;;_ > allout-next-visible-heading (arg) |
| 3224 | (defun allout-next-visible-heading (arg) | 3380 | (defun allout-next-visible-heading (arg) |
| 3225 | "Move to the next ARG'th visible heading line, backward if arg is negative. | 3381 | "Move to the next ARG'th visible heading line, backward if arg is negative. |
| @@ -3272,7 +3428,7 @@ A heading line is one that starts with a `*' (or that `allout-regexp' | |||
| 3272 | matches)." | 3428 | matches)." |
| 3273 | (interactive "p") | 3429 | (interactive "p") |
| 3274 | (prog1 (allout-next-visible-heading (- arg)) | 3430 | (prog1 (allout-next-visible-heading (- arg)) |
| 3275 | (if (called-interactively-p 'interactive) (allout-end-of-prefix)))) | 3431 | (if (allout-called-interactively-p) (allout-end-of-prefix)))) |
| 3276 | ;;;_ > allout-forward-current-level (arg) | 3432 | ;;;_ > allout-forward-current-level (arg) |
| 3277 | (defun allout-forward-current-level (arg) | 3433 | (defun allout-forward-current-level (arg) |
| 3278 | "Position point at the next heading of the same level. | 3434 | "Position point at the next heading of the same level. |
| @@ -3293,7 +3449,7 @@ Returns resulting position, else nil if none found." | |||
| 3293 | (allout-previous-sibling) | 3449 | (allout-previous-sibling) |
| 3294 | (allout-next-sibling))) | 3450 | (allout-next-sibling))) |
| 3295 | (setq arg (1- arg))) | 3451 | (setq arg (1- arg))) |
| 3296 | (if (not (called-interactively-p 'interactive)) | 3452 | (if (not (allout-called-interactively-p)) |
| 3297 | nil | 3453 | nil |
| 3298 | (allout-end-of-prefix) | 3454 | (allout-end-of-prefix) |
| 3299 | (if (not (zerop arg)) | 3455 | (if (not (zerop arg)) |
| @@ -3306,7 +3462,7 @@ Returns resulting position, else nil if none found." | |||
| 3306 | (defun allout-backward-current-level (arg) | 3462 | (defun allout-backward-current-level (arg) |
| 3307 | "Inverse of `allout-forward-current-level'." | 3463 | "Inverse of `allout-forward-current-level'." |
| 3308 | (interactive "p") | 3464 | (interactive "p") |
| 3309 | (if (called-interactively-p 'interactive) | 3465 | (if (allout-called-interactively-p) |
| 3310 | (let ((current-prefix-arg (* -1 arg))) | 3466 | (let ((current-prefix-arg (* -1 arg))) |
| 3311 | (call-interactively 'allout-forward-current-level)) | 3467 | (call-interactively 'allout-forward-current-level)) |
| 3312 | (allout-forward-current-level (* -1 arg)))) | 3468 | (allout-forward-current-level (* -1 arg)))) |
| @@ -3391,8 +3547,10 @@ this-command accordingly. | |||
| 3391 | 3547 | ||
| 3392 | Returns the qualifying command, if any, else nil." | 3548 | Returns the qualifying command, if any, else nil." |
| 3393 | (interactive) | 3549 | (interactive) |
| 3394 | (let* ((key-string (if (numberp last-command-event) | 3550 | (let* ((modified (event-modifiers last-command-event)) |
| 3395 | (char-to-string last-command-event))) | 3551 | (key-string (if (numberp last-command-event) |
| 3552 | (char-to-string | ||
| 3553 | (event-basic-type last-command-event)))) | ||
| 3396 | (key-num (cond ((numberp last-command-event) last-command-event) | 3554 | (key-num (cond ((numberp last-command-event) last-command-event) |
| 3397 | ;; for XEmacs character type: | 3555 | ;; for XEmacs character type: |
| 3398 | ((and (fboundp 'characterp) | 3556 | ((and (fboundp 'characterp) |
| @@ -3406,6 +3564,7 @@ Returns the qualifying command, if any, else nil." | |||
| 3406 | 3564 | ||
| 3407 | (if (and | 3565 | (if (and |
| 3408 | ;; exclude control chars and escape: | 3566 | ;; exclude control chars and escape: |
| 3567 | (not modified) | ||
| 3409 | (<= 33 key-num) | 3568 | (<= 33 key-num) |
| 3410 | (setq mapped-binding | 3569 | (setq mapped-binding |
| 3411 | (or (and (assoc key-string allout-keybindings-list) | 3570 | (or (and (assoc key-string allout-keybindings-list) |
| @@ -3413,22 +3572,22 @@ Returns the qualifying command, if any, else nil." | |||
| 3413 | (cadr (assoc key-string allout-keybindings-list))) | 3572 | (cadr (assoc key-string allout-keybindings-list))) |
| 3414 | ;; translate as a keybinding: | 3573 | ;; translate as a keybinding: |
| 3415 | (key-binding (vconcat allout-command-prefix | 3574 | (key-binding (vconcat allout-command-prefix |
| 3416 | (char-to-string | 3575 | (vector |
| 3417 | (if (and (<= 97 key-num) ; "a" | 3576 | (if (and (<= 97 key-num) ; "a" |
| 3418 | (>= 122 key-num)) ; "z" | 3577 | (>= 122 key-num)) ; "z" |
| 3419 | (- key-num 96) key-num))) | 3578 | (- key-num 96) key-num))) |
| 3420 | t)))) | 3579 | t)))) |
| 3421 | ;; Qualified as an allout command -- do hot-spot operation. | 3580 | ;; Qualified as an allout command -- do hot-spot operation. |
| 3422 | (setq allout-post-goto-bullet t) | 3581 | (setq allout-post-goto-bullet t) |
| 3423 | ;; accept-defaults nil, or else we'll get allout-item-icon-key-handler. | 3582 | ;; accept-defaults nil, or else we get allout-item-icon-key-handler. |
| 3424 | (setq mapped-binding (key-binding (char-to-string key-num)))) | 3583 | (setq mapped-binding (key-binding (vector key-num)))) |
| 3425 | 3584 | ||
| 3426 | (while (keymapp mapped-binding) | 3585 | (while (keymapp mapped-binding) |
| 3427 | (setq mapped-binding | 3586 | (setq mapped-binding |
| 3428 | (lookup-key mapped-binding (vector (read-char))))) | 3587 | (lookup-key mapped-binding (vector (read-char))))) |
| 3429 | 3588 | ||
| 3430 | (if mapped-binding | 3589 | (when mapped-binding |
| 3431 | (setq this-command mapped-binding))))) | 3590 | (setq this-command mapped-binding))))) |
| 3432 | 3591 | ||
| 3433 | ;;;_ > allout-find-file-hook () | 3592 | ;;;_ > allout-find-file-hook () |
| 3434 | (defun allout-find-file-hook () | 3593 | (defun allout-find-file-hook () |
| @@ -3457,7 +3616,7 @@ Offer one suitable for current depth DEPTH as default." | |||
| 3457 | (setq choice (solicit-char-in-string | 3616 | (setq choice (solicit-char-in-string |
| 3458 | (format "Select bullet: %s ('%s' default): " | 3617 | (format "Select bullet: %s ('%s' default): " |
| 3459 | sans-escapes | 3618 | sans-escapes |
| 3460 | (substring-no-properties default-bullet)) | 3619 | (allout-substring-no-properties default-bullet)) |
| 3461 | sans-escapes | 3620 | sans-escapes |
| 3462 | t))) | 3621 | t))) |
| 3463 | (message "") | 3622 | (message "") |
| @@ -4455,9 +4614,9 @@ Topic exposure is marked with text-properties, to be used by | |||
| 4455 | (if (not (allout-hidden-p)) | 4614 | (if (not (allout-hidden-p)) |
| 4456 | (setq next | 4615 | (setq next |
| 4457 | (max (1+ (point)) | 4616 | (max (1+ (point)) |
| 4458 | (next-single-char-property-change (point) | 4617 | (allout-next-single-char-property-change (point) |
| 4459 | 'invisible | 4618 | 'invisible |
| 4460 | nil end)))) | 4619 | nil end)))) |
| 4461 | (if (or (not next) (eq prev next)) | 4620 | (if (or (not next) (eq prev next)) |
| 4462 | ;; still not at start of hidden area -- must not be any left. | 4621 | ;; still not at start of hidden area -- must not be any left. |
| 4463 | (setq done t) | 4622 | (setq done t) |
| @@ -4496,9 +4655,8 @@ Topic exposure is marked with text-properties, to be used by | |||
| 4496 | (while (not done) | 4655 | (while (not done) |
| 4497 | ;; at or advance to start of next annotation: | 4656 | ;; at or advance to start of next annotation: |
| 4498 | (if (not (get-text-property (point) 'allout-was-hidden)) | 4657 | (if (not (get-text-property (point) 'allout-was-hidden)) |
| 4499 | (setq next (next-single-char-property-change (point) | 4658 | (setq next (allout-next-single-char-property-change |
| 4500 | 'allout-was-hidden | 4659 | (point) 'allout-was-hidden nil end))) |
| 4501 | nil end))) | ||
| 4502 | (if (or (not next) (eq prev next)) | 4660 | (if (or (not next) (eq prev next)) |
| 4503 | ;; no more or not advancing -- must not be any left. | 4661 | ;; no more or not advancing -- must not be any left. |
| 4504 | (setq done t) | 4662 | (setq done t) |
| @@ -4508,9 +4666,8 @@ Topic exposure is marked with text-properties, to be used by | |||
| 4508 | ;; still not at start of annotation. | 4666 | ;; still not at start of annotation. |
| 4509 | (setq done t) | 4667 | (setq done t) |
| 4510 | ;; advance to just after end of this annotation: | 4668 | ;; advance to just after end of this annotation: |
| 4511 | (setq next (next-single-char-property-change (point) | 4669 | (setq next (allout-next-single-char-property-change |
| 4512 | 'allout-was-hidden | 4670 | (point) 'allout-was-hidden nil end)) |
| 4513 | nil end)) | ||
| 4514 | (overlay-put (make-overlay prev next nil 'front-advance) | 4671 | (overlay-put (make-overlay prev next nil 'front-advance) |
| 4515 | 'category 'allout-exposure-category) | 4672 | 'category 'allout-exposure-category) |
| 4516 | (allout-deannotate-hidden prev next) | 4673 | (allout-deannotate-hidden prev next) |
| @@ -4766,7 +4923,10 @@ invoked.)" | |||
| 4766 | (when (featurep 'xemacs) | 4923 | (when (featurep 'xemacs) |
| 4767 | (let ((props (symbol-plist 'allout-exposure-category))) | 4924 | (let ((props (symbol-plist 'allout-exposure-category))) |
| 4768 | (while props | 4925 | (while props |
| 4769 | (overlay-put o (pop props) (pop props))))))) | 4926 | (condition-case nil |
| 4927 | ;; as of 2008-02-27, xemacs lacks modification-hooks | ||
| 4928 | (overlay-put o (pop props) (pop props)) | ||
| 4929 | (error nil))))))) | ||
| 4770 | (run-hooks 'allout-view-change-hook) | 4930 | (run-hooks 'allout-view-change-hook) |
| 4771 | (run-hook-with-args 'allout-exposure-change-hook from to flag)) | 4931 | (run-hook-with-args 'allout-exposure-change-hook from to flag)) |
| 4772 | ;;;_ > allout-flag-current-subtree (flag) | 4932 | ;;;_ > allout-flag-current-subtree (flag) |
| @@ -4845,7 +5005,7 @@ point of non-opened subtree?)" | |||
| 4845 | (to-reveal (or (allout-chart-to-reveal chart chart-level) | 5005 | (to-reveal (or (allout-chart-to-reveal chart chart-level) |
| 4846 | ;; interactive, show discontinuous children: | 5006 | ;; interactive, show discontinuous children: |
| 4847 | (and chart | 5007 | (and chart |
| 4848 | (called-interactively-p 'interactive) | 5008 | (allout-called-interactively-p) |
| 4849 | (save-excursion | 5009 | (save-excursion |
| 4850 | (allout-back-to-current-heading) | 5010 | (allout-back-to-current-heading) |
| 4851 | (setq depth (allout-current-depth)) | 5011 | (setq depth (allout-current-depth)) |
| @@ -5672,7 +5832,8 @@ environment. Leaves point at the end of the line." | |||
| 5672 | (let ((inhibit-field-text-motion t)) | 5832 | (let ((inhibit-field-text-motion t)) |
| 5673 | (beginning-of-line) | 5833 | (beginning-of-line) |
| 5674 | (let ((beg (point)) | 5834 | (let ((beg (point)) |
| 5675 | (end (point-at-eol))) | 5835 | (end (progn (end-of-line)(point)))) |
| 5836 | (goto-char beg) | ||
| 5676 | (save-match-data | 5837 | (save-match-data |
| 5677 | (while (re-search-forward "\\\\" | 5838 | (while (re-search-forward "\\\\" |
| 5678 | ;;"\\\\\\|\\{\\|\\}\\|\\_\\|\\$\\|\\\"\\|\\&\\|\\^\\|\\-\\|\\*\\|#" | 5839 | ;;"\\\\\\|\\{\\|\\}\\|\\_\\|\\$\\|\\\"\\|\\&\\|\\^\\|\\-\\|\\*\\|#" |
| @@ -5975,7 +6136,7 @@ See `allout-toggle-current-subtree-encryption' for more details." | |||
| 5975 | ;; they're encrypted, so the coding system is set to accommodate | 6136 | ;; they're encrypted, so the coding system is set to accommodate |
| 5976 | ;; them. | 6137 | ;; them. |
| 5977 | (setq buffer-file-coding-system | 6138 | (setq buffer-file-coding-system |
| 5978 | (select-safe-coding-system subtree-beg subtree-end)) | 6139 | (allout-select-safe-coding-system subtree-beg subtree-end)) |
| 5979 | ;; if the coding system for the text being encrypted is different | 6140 | ;; if the coding system for the text being encrypted is different |
| 5980 | ;; than that prevailing, then there a real risk that the coding | 6141 | ;; than that prevailing, then there a real risk that the coding |
| 5981 | ;; system can't be noticed by emacs when the file is visited. to | 6142 | ;; system can't be noticed by emacs when the file is visited. to |
| @@ -6118,7 +6279,7 @@ Returns the resulting string, or nil if the transformation fails." | |||
| 6118 | (insert text) | 6279 | (insert text) |
| 6119 | 6280 | ||
| 6120 | ;; convey the text characteristics of the original buffer: | 6281 | ;; convey the text characteristics of the original buffer: |
| 6121 | (set-buffer-multibyte multibyte) | 6282 | (allout-set-buffer-multibyte multibyte) |
| 6122 | (when encoding | 6283 | (when encoding |
| 6123 | (set-buffer-file-coding-system encoding) | 6284 | (set-buffer-file-coding-system encoding) |
| 6124 | (if (not decrypt) | 6285 | (if (not decrypt) |
| @@ -6830,6 +6991,14 @@ If BEG is bigger than END we return 0." | |||
| 6830 | ((atom (car list)) (cons (car list) (allout-flatten (cdr list)))) | 6991 | ((atom (car list)) (cons (car list) (allout-flatten (cdr list)))) |
| 6831 | (t (append (allout-flatten (car list)) (allout-flatten (cdr list)))))) | 6992 | (t (append (allout-flatten (car list)) (allout-flatten (cdr list)))))) |
| 6832 | ;;;_ : Compatibility: | 6993 | ;;;_ : Compatibility: |
| 6994 | ;;;_ : xemacs undo-in-progress provision: | ||
| 6995 | (unless (boundp 'undo-in-progress) | ||
| 6996 | (defvar undo-in-progress nil | ||
| 6997 | "Placeholder defvar for XEmacs compatibility from allout.el.") | ||
| 6998 | (defadvice undo-more (around allout activate) | ||
| 6999 | ;; This defadvice used only in emacs that lack undo-in-progress, eg xemacs. | ||
| 7000 | (let ((undo-in-progress t)) ad-do-it))) | ||
| 7001 | |||
| 6833 | ;;;_ > allout-mark-marker to accommodate divergent emacsen: | 7002 | ;;;_ > allout-mark-marker to accommodate divergent emacsen: |
| 6834 | (defun allout-mark-marker (&optional force buffer) | 7003 | (defun allout-mark-marker (&optional force buffer) |
| 6835 | "Accommodate the different signature for `mark-marker' across Emacsen. | 7004 | "Accommodate the different signature for `mark-marker' across Emacsen. |
| @@ -6990,6 +7159,42 @@ To ignore intangibility, bind `inhibit-point-motion-hooks' to t." | |||
| 6990 | (setq arg 1) | 7159 | (setq arg 1) |
| 6991 | (setq done t))))))) | 7160 | (setq done t))))))) |
| 6992 | ) | 7161 | ) |
| 7162 | ;;;_ > allout-next-single-char-property-change -- alias unless lacking | ||
| 7163 | (defalias 'allout-next-single-char-property-change | ||
| 7164 | (if (fboundp 'next-single-char-property-change) | ||
| 7165 | 'next-single-char-property-change | ||
| 7166 | 'next-single-property-change) | ||
| 7167 | ;; No docstring because xemacs defalias doesn't support it. | ||
| 7168 | ) | ||
| 7169 | ;;;_ > allout-previous-single-char-property-change -- alias unless lacking | ||
| 7170 | (defalias 'allout-previous-single-char-property-change | ||
| 7171 | (if (fboundp 'previous-single-char-property-change) | ||
| 7172 | 'previous-single-char-property-change | ||
| 7173 | 'previous-single-property-change) | ||
| 7174 | ;; No docstring because xemacs defalias doesn't support it. | ||
| 7175 | ) | ||
| 7176 | ;;;_ > allout-set-buffer-multibyte | ||
| 7177 | ;; define as alias first, so byte compiler is happy. | ||
| 7178 | (defalias 'allout-set-buffer-multibyte 'set-buffer-multibyte) | ||
| 7179 | ;; then supplant with definition if underlying alias absent. | ||
| 7180 | (if (not (fboundp 'set-buffer-multibyte)) | ||
| 7181 | (defun allout-set-buffer-multibyte (is-multibyte) | ||
| 7182 | (setq enable-multibyte-characters is-multibyte)) | ||
| 7183 | ) | ||
| 7184 | ;;;_ > allout-select-safe-coding-system | ||
| 7185 | (defalias 'allout-select-safe-coding-system | ||
| 7186 | (if (fboundp 'select-safe-coding-system) | ||
| 7187 | 'select-safe-coding-system | ||
| 7188 | 'detect-coding-region) | ||
| 7189 | ) | ||
| 7190 | ;;;_ > allout-substring-no-properties | ||
| 7191 | ;; define as alias first, so byte compiler is happy. | ||
| 7192 | (defalias 'allout-substring-no-properties 'substring-no-properties) | ||
| 7193 | ;; then supplant with definition if underlying alias absent. | ||
| 7194 | (if (not (fboundp 'substring-no-properties)) | ||
| 7195 | (defun allout-substring-no-properties (string &optional start end) | ||
| 7196 | (substring string (or start 0) end)) | ||
| 7197 | ) | ||
| 6993 | 7198 | ||
| 6994 | ;;;_ #10 Unfinished | 7199 | ;;;_ #10 Unfinished |
| 6995 | ;;;_ > allout-bullet-isearch (&optional bullet) | 7200 | ;;;_ > allout-bullet-isearch (&optional bullet) |
| @@ -7021,7 +7226,7 @@ To ignore intangibility, bind `inhibit-point-motion-hooks' to t." | |||
| 7021 | ;;;_ > allout-tests-obliterate-variable (name) | 7226 | ;;;_ > allout-tests-obliterate-variable (name) |
| 7022 | (defun allout-tests-obliterate-variable (name) | 7227 | (defun allout-tests-obliterate-variable (name) |
| 7023 | "Completely unbind variable with NAME." | 7228 | "Completely unbind variable with NAME." |
| 7024 | (if (local-variable-p name) (kill-local-variable name)) | 7229 | (if (local-variable-p name (current-buffer)) (kill-local-variable name)) |
| 7025 | (while (boundp name) (makunbound name))) | 7230 | (while (boundp name) (makunbound name))) |
| 7026 | ;;;_ > allout-test-resumptions () | 7231 | ;;;_ > allout-test-resumptions () |
| 7027 | (defvar allout-tests-globally-unbound nil | 7232 | (defvar allout-tests-globally-unbound nil |
| @@ -7040,11 +7245,12 @@ To ignore intangibility, bind `inhibit-point-motion-hooks' to t." | |||
| 7040 | (allout-tests-obliterate-variable 'allout-tests-globally-unbound) | 7245 | (allout-tests-obliterate-variable 'allout-tests-globally-unbound) |
| 7041 | (allout-add-resumptions '(allout-tests-globally-unbound t)) | 7246 | (allout-add-resumptions '(allout-tests-globally-unbound t)) |
| 7042 | (assert (not (default-boundp 'allout-tests-globally-unbound))) | 7247 | (assert (not (default-boundp 'allout-tests-globally-unbound))) |
| 7043 | (assert (local-variable-p 'allout-tests-globally-unbound)) | 7248 | (assert (local-variable-p 'allout-tests-globally-unbound (current-buffer))) |
| 7044 | (assert (boundp 'allout-tests-globally-unbound)) | 7249 | (assert (boundp 'allout-tests-globally-unbound)) |
| 7045 | (assert (equal allout-tests-globally-unbound t)) | 7250 | (assert (equal allout-tests-globally-unbound t)) |
| 7046 | (allout-do-resumptions) | 7251 | (allout-do-resumptions) |
| 7047 | (assert (not (local-variable-p 'allout-tests-globally-unbound))) | 7252 | (assert (not (local-variable-p 'allout-tests-globally-unbound |
| 7253 | (current-buffer)))) | ||
| 7048 | (assert (not (boundp 'allout-tests-globally-unbound)))) | 7254 | (assert (not (boundp 'allout-tests-globally-unbound)))) |
| 7049 | 7255 | ||
| 7050 | ;; ensure that variable with prior global value is resumed | 7256 | ;; ensure that variable with prior global value is resumed |
| @@ -7053,10 +7259,11 @@ To ignore intangibility, bind `inhibit-point-motion-hooks' to t." | |||
| 7053 | (setq allout-tests-globally-true t) | 7259 | (setq allout-tests-globally-true t) |
| 7054 | (allout-add-resumptions '(allout-tests-globally-true nil)) | 7260 | (allout-add-resumptions '(allout-tests-globally-true nil)) |
| 7055 | (assert (equal (default-value 'allout-tests-globally-true) t)) | 7261 | (assert (equal (default-value 'allout-tests-globally-true) t)) |
| 7056 | (assert (local-variable-p 'allout-tests-globally-true)) | 7262 | (assert (local-variable-p 'allout-tests-globally-true (current-buffer))) |
| 7057 | (assert (equal allout-tests-globally-true nil)) | 7263 | (assert (equal allout-tests-globally-true nil)) |
| 7058 | (allout-do-resumptions) | 7264 | (allout-do-resumptions) |
| 7059 | (assert (not (local-variable-p 'allout-tests-globally-true))) | 7265 | (assert (not (local-variable-p 'allout-tests-globally-true |
| 7266 | (current-buffer)))) | ||
| 7060 | (assert (boundp 'allout-tests-globally-true)) | 7267 | (assert (boundp 'allout-tests-globally-true)) |
| 7061 | (assert (equal allout-tests-globally-true t))) | 7268 | (assert (equal allout-tests-globally-true t))) |
| 7062 | 7269 | ||
| @@ -7067,16 +7274,16 @@ To ignore intangibility, bind `inhibit-point-motion-hooks' to t." | |||
| 7067 | (assert (not (default-boundp 'allout-tests-locally-true)) | 7274 | (assert (not (default-boundp 'allout-tests-locally-true)) |
| 7068 | nil (concat "Test setup mistake -- variable supposed to" | 7275 | nil (concat "Test setup mistake -- variable supposed to" |
| 7069 | " not have global binding, but it does.")) | 7276 | " not have global binding, but it does.")) |
| 7070 | (assert (local-variable-p 'allout-tests-locally-true) | 7277 | (assert (local-variable-p 'allout-tests-locally-true (current-buffer)) |
| 7071 | nil (concat "Test setup mistake -- variable supposed to have" | 7278 | nil (concat "Test setup mistake -- variable supposed to have" |
| 7072 | " local binding, but it lacks one.")) | 7279 | " local binding, but it lacks one.")) |
| 7073 | (allout-add-resumptions '(allout-tests-locally-true nil)) | 7280 | (allout-add-resumptions '(allout-tests-locally-true nil)) |
| 7074 | (assert (not (default-boundp 'allout-tests-locally-true))) | 7281 | (assert (not (default-boundp 'allout-tests-locally-true))) |
| 7075 | (assert (local-variable-p 'allout-tests-locally-true)) | 7282 | (assert (local-variable-p 'allout-tests-locally-true (current-buffer))) |
| 7076 | (assert (equal allout-tests-locally-true nil)) | 7283 | (assert (equal allout-tests-locally-true nil)) |
| 7077 | (allout-do-resumptions) | 7284 | (allout-do-resumptions) |
| 7078 | (assert (boundp 'allout-tests-locally-true)) | 7285 | (assert (boundp 'allout-tests-locally-true)) |
| 7079 | (assert (local-variable-p 'allout-tests-locally-true)) | 7286 | (assert (local-variable-p 'allout-tests-locally-true (current-buffer))) |
| 7080 | (assert (equal allout-tests-locally-true t)) | 7287 | (assert (equal allout-tests-locally-true t)) |
| 7081 | (assert (not (default-boundp 'allout-tests-locally-true)))) | 7288 | (assert (not (default-boundp 'allout-tests-locally-true)))) |
| 7082 | 7289 | ||
| @@ -7095,22 +7302,24 @@ To ignore intangibility, bind `inhibit-point-motion-hooks' to t." | |||
| 7095 | '(allout-tests-locally-true 4)) | 7302 | '(allout-tests-locally-true 4)) |
| 7096 | ;; reestablish many of the basic conditions are maintained after re-add: | 7303 | ;; reestablish many of the basic conditions are maintained after re-add: |
| 7097 | (assert (not (default-boundp 'allout-tests-globally-unbound))) | 7304 | (assert (not (default-boundp 'allout-tests-globally-unbound))) |
| 7098 | (assert (local-variable-p 'allout-tests-globally-unbound)) | 7305 | (assert (local-variable-p 'allout-tests-globally-unbound (current-buffer))) |
| 7099 | (assert (equal allout-tests-globally-unbound 2)) | 7306 | (assert (equal allout-tests-globally-unbound 2)) |
| 7100 | (assert (default-boundp 'allout-tests-globally-true)) | 7307 | (assert (default-boundp 'allout-tests-globally-true)) |
| 7101 | (assert (local-variable-p 'allout-tests-globally-true)) | 7308 | (assert (local-variable-p 'allout-tests-globally-true (current-buffer))) |
| 7102 | (assert (equal allout-tests-globally-true 3)) | 7309 | (assert (equal allout-tests-globally-true 3)) |
| 7103 | (assert (not (default-boundp 'allout-tests-locally-true))) | 7310 | (assert (not (default-boundp 'allout-tests-locally-true))) |
| 7104 | (assert (local-variable-p 'allout-tests-locally-true)) | 7311 | (assert (local-variable-p 'allout-tests-locally-true (current-buffer))) |
| 7105 | (assert (equal allout-tests-locally-true 4)) | 7312 | (assert (equal allout-tests-locally-true 4)) |
| 7106 | (allout-do-resumptions) | 7313 | (allout-do-resumptions) |
| 7107 | (assert (not (local-variable-p 'allout-tests-globally-unbound))) | 7314 | (assert (not (local-variable-p 'allout-tests-globally-unbound |
| 7315 | (current-buffer)))) | ||
| 7108 | (assert (not (boundp 'allout-tests-globally-unbound))) | 7316 | (assert (not (boundp 'allout-tests-globally-unbound))) |
| 7109 | (assert (not (local-variable-p 'allout-tests-globally-true))) | 7317 | (assert (not (local-variable-p 'allout-tests-globally-true |
| 7318 | (current-buffer)))) | ||
| 7110 | (assert (boundp 'allout-tests-globally-true)) | 7319 | (assert (boundp 'allout-tests-globally-true)) |
| 7111 | (assert (equal allout-tests-globally-true t)) | 7320 | (assert (equal allout-tests-globally-true t)) |
| 7112 | (assert (boundp 'allout-tests-locally-true)) | 7321 | (assert (boundp 'allout-tests-locally-true)) |
| 7113 | (assert (local-variable-p 'allout-tests-locally-true)) | 7322 | (assert (local-variable-p 'allout-tests-locally-true (current-buffer))) |
| 7114 | (assert (equal allout-tests-locally-true t)) | 7323 | (assert (equal allout-tests-locally-true t)) |
| 7115 | (assert (not (default-boundp 'allout-tests-locally-true)))) | 7324 | (assert (not (default-boundp 'allout-tests-locally-true)))) |
| 7116 | 7325 | ||