aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKen Manheimer2011-01-20 13:13:30 -0500
committerKen Manheimer2011-01-20 13:13:30 -0500
commitd3e51865cd5f7a691f8eeafa670a225efe0e7a40 (patch)
treeabe847646c35598ef4dd6a4a1d10d7a59b4f3f13
parentdbfb414e49a879b5d9086f54b67d02e11e445ec2 (diff)
downloademacs-d3e51865cd5f7a691f8eeafa670a225efe0e7a40.tar.gz
emacs-d3e51865cd5f7a691f8eeafa670a225efe0e7a40.zip
allout.el: Summary - migrate to defining allout mode using
define-minor-mode instead of defun. Significantly clean-up internal keymap provisions, refactoring a bit and removing a lot of accumulated cruft. allout-mode-map is now a keymap by virtue of being an defalias to allout-mode-map-value, which contains the actual keymap structure. (allout-mode): Use define-minor-mode rather than defun. Remove now-unnecessary minor-mode setup activities from the body. Specify :keymap as allout-mode-map so the minor-mode-map-alist entry will be '(allout-mode . allout-mode-map) - see allout-mode-map-value, below. Adjust docstring to track changes. (allout-minor-mode): Remove this defalias, now that we're using define-minor-mode. (allout-mode-map): Set value to be 'allout-mode-map. The actual keymap is allout-mode-map-value, via defalias. (allout-mode-map-value): The variable holding the actual mode keymap structure, by virtue of defalias from allout-mode-map. (allout-compose-and-institute-keymap): Renamed from allout-bind-keys, and including the binding-composition functionality of the former produce-allout-mode-map and allout-setup-mode-map. (allout-institute-keymap): Take over the "setup" part of the former allout-setup-mode-map. Reassign allout-mode-map-value value and update the defalias. (allout-command-prefix) (allout-prefixed-keybindings) (allout-unprefixed-keybindings): Use allout-compose-and-institute-keymap to process the bindings. (allout-unprefixed-keybindings): Remove extraneous '?' question marks. (allout-prefixed-keybindings): Elide binding to (prefixed) \C-h - user can customize if they want to use that binding. Bind allout-copy-topic-as-kill to (prefixed) \M-k. Bind allout-up-current-level to (prefixed) \C-u. (I think i mistakenly elided that, previously, instead of the one for \C-h.) (allout-hotspot-key-handler): Remove attempt to resolve the key through the literal key-string lookup on allout-keybindings-list. That probably hasn't worked for a Long Time, and removal of allout-keybindings-list further simplifies the keybindings situation. (allout-pre-command-business): Use allout-mode-map-value instead of allout-mode-map. (allout-preempt-trailing-ctrl-h): Remove. The user can customize the bindings if they want to use a keybinding having a trailing \C-h. No deprecation needed since this feature was never in a release. (allout-keybindings-list): Remove. It's not been useful for a while. (See allout-hotspot-key-handler changes, above.) (produce-allout-mode-map): Remove. Consolidate into allout-compose-and-institute-keymap. (allout-mode-map-adjustments): Remove. No longer necessary with removal of allout-preempt-trailing-ctrl-h. (allout-setup-mode-map): Remove. Consolidate into allout-compose-and-institute-keymap and allout-institute-keymap.
-rw-r--r--lisp/ChangeLog58
-rw-r--r--lisp/allout.el301
2 files changed, 158 insertions, 201 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index c27b123d767..e928e5f3f26 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,61 @@
12011-01-20 Ken Manheimer <ken.manheimer@gmail.com>
2
3 * allout.el: Summary - migrate to defining allout mode using
4 define-minor-mode instead of defun. Significantly clean-up
5 internal keymap provisions, refactoring and, in the process,
6 removing a lot of accumulated cruft.
7
8 allout-mode-map is now a keymap by virtue of being a defalias to
9 allout-mode-map-value, which contains the actual keymap structure.
10
11 (allout-mode): Use define-minor-mode rather than defun. Remove
12 now-unnecessary minor-mode setup activities from the body.
13 Specify :keymap as allout-mode-map so the minor-mode-map-alist
14 entry will be '(allout-mode . allout-mode-map) - see
15 allout-mode-map-value, below. Adjust docstring to track changes.
16 (allout-minor-mode): Remove this defalias, now that we're using
17 define-minor-mode.
18 (allout-mode-map): Set value to be 'allout-mode-map. The actual
19 keymap is allout-mode-map-value, via defalias.
20 (allout-mode-map-value): The variable holding the actual mode
21 keymap structure, by virtue of defalias from allout-mode-map.
22 (allout-compose-and-institute-keymap): Renamed from
23 allout-bind-keys, and including the binding-composition
24 functionality of the former produce-allout-mode-map and
25 allout-setup-mode-map.
26 (allout-institute-keymap): Take over the "setup" part of the former
27 allout-setup-mode-map. Reassign allout-mode-map-value value and
28 update the defalias.
29 (allout-command-prefix) (allout-prefixed-keybindings)
30 (allout-unprefixed-keybindings): Use
31 allout-compose-and-institute-keymap to process the bindings.
32 (allout-unprefixed-keybindings): Remove extraneous '?' question
33 marks.
34 (allout-prefixed-keybindings): Elide binding to (prefixed) \C-h -
35 user can customize if they want to use that binding. Bind
36 allout-copy-topic-as-kill to (prefixed) \M-k. Bind
37 allout-up-current-level to (prefixed) \C-u. (I think i mistakenly
38 elided that, previously, instead of the one for \C-h.)
39 (allout-hotspot-key-handler): Remove attempt to resolve the key
40 through the literal key-string lookup on allout-keybindings-list.
41 That probably hasn't worked for a Long Time, and removal of
42 allout-keybindings-list further simplifies the keybindings
43 situation.
44 (allout-pre-command-business): Use allout-mode-map-value instead
45 of allout-mode-map.
46 (allout-preempt-trailing-ctrl-h): Remove. The user can customize
47 the bindings if they want to use a keybinding having a trailing
48 \C-h. No deprecation needed since this feature was never in a
49 release.
50 (allout-keybindings-list): Remove. It's not been useful for a
51 while. (See allout-hotspot-key-handler changes, above.)
52 (produce-allout-mode-map): Remove. Consolidate into
53 allout-compose-and-institute-keymap.
54 (allout-mode-map-adjustments): Remove. No longer necessary with
55 removal of allout-preempt-trailing-ctrl-h.
56 (allout-setup-mode-map): Remove. Consolidate into
57 allout-compose-and-institute-keymap and allout-institute-keymap.
58
12011-01-20 Glenn Morris <rgm@gnu.org> 592011-01-20 Glenn Morris <rgm@gnu.org>
2 60
3 * vc/vc-svn.el (vc-svn-after-dir-status): Tweak previous change. 61 * vc/vc-svn.el (vc-svn-after-dir-status): Tweak previous change.
diff --git a/lisp/allout.el b/lisp/allout.el
index 63af7457d93..49a7454b1e0 100644
--- a/lisp/allout.el
+++ b/lisp/allout.el
@@ -108,23 +108,39 @@
108;;;_ + Layout, Mode, and Topic Header Configuration 108;;;_ + Layout, Mode, and Topic Header Configuration
109 109
110(defvar allout-command-prefix) ; defined below 110(defvar allout-command-prefix) ; defined below
111(defvar allout-mode-map)
112 111
113;;;_ > allout-keybindings incidentals: 112;;;_ > allout-keybindings incidentals:
114;;;_ > allout-bind-keys &optional varname value 113;;;_ : internal key binding stuff - in this section for load-order.
115(defun allout-bind-keys (&optional varname value) 114;;;_ = allout-mode-map
116 "Rebuild the `allout-mode-map' according to the keybinding specs. 115(defvar allout-mode-map 'allout-mode-map
117 116 "Keybindings place-holder for (allout) outline minor mode.
118Useful standalone, to init the map, or in customizing the 117
118Do NOT set the value of this variable. Instead, customize
119`allout-command-prefix', `allout-prefixed-keybindings', and
120`allout-unprefixed-keybindings'.")
121;;;_ = allout-mode-map-value
122(defvar allout-mode-map-value nil
123 "Keymap for allout outline minor mode.
124
125Do NOT set the value of this variable. Instead, customize
126`allout-command-prefix', `allout-prefixed-keybindings', and
127`allout-unprefixed-keybindings'.")
128;;;_ = make allout-mode-map-value an alias for allout-mode-map:
129;; this needs to be revised when the value is changed, sigh.
130(defalias 'allout-mode-map allout-mode-map-value)
131;;;_ > allout-compose-and-institute-keymap (&optional varname value)
132(defun allout-compose-and-institute-keymap (&optional varname value)
133 "Create the allout keymap according to the keybinding specs, and set it.
134
135Useful standalone or to effect customizations of the
119respective allout-mode keybinding variables, `allout-command-prefix', 136respective allout-mode keybinding variables, `allout-command-prefix',
120`allout-prefixed-keybindings', and `allout-unprefixed-keybindings'" 137`allout-prefixed-keybindings', and `allout-unprefixed-keybindings'"
121 ;; Set the customization variable, if any: 138 ;; Set the customization variable, if any:
122 (when varname 139 (when varname
123 (set-default varname value)) 140 (set-default varname value))
124 (let ((map (make-sparse-keymap)) 141 (let ((map (make-sparse-keymap)))
125 key)
126 (when (boundp 'allout-prefixed-keybindings) 142 (when (boundp 'allout-prefixed-keybindings)
127 ;; Be tolerant of the moments when the variables are first being defined. 143 ;; tolerate first definitions of the variables:
128 (dolist (entry allout-prefixed-keybindings) 144 (dolist (entry allout-prefixed-keybindings)
129 (define-key map 145 (define-key map
130 ;; XXX vector vs non-vector key descriptions? 146 ;; XXX vector vs non-vector key descriptions?
@@ -134,9 +150,33 @@ respective allout-mode keybinding variables, `allout-command-prefix',
134 (when (boundp 'allout-unprefixed-keybindings) 150 (when (boundp 'allout-unprefixed-keybindings)
135 (dolist (entry allout-unprefixed-keybindings) 151 (dolist (entry allout-unprefixed-keybindings)
136 (define-key map (car (read-from-string (car entry))) (cadr entry)))) 152 (define-key map (car (read-from-string (car entry))) (cadr entry))))
137 (setq allout-mode-map map) 153 (substitute-key-definition 'beginning-of-line 'allout-beginning-of-line
138 map 154 map global-map)
139 )) 155 (substitute-key-definition 'move-beginning-of-line 'allout-beginning-of-line
156 map global-map)
157 (substitute-key-definition 'end-of-line 'allout-end-of-line
158 map global-map)
159 (substitute-key-definition 'move-end-of-line 'allout-end-of-line
160 map global-map)
161 (allout-institute-keymap map)))
162;;;_ > allout-institute-keymap (map)
163(defun allout-institute-keymap (map)
164 "Associate allout-mode bindings with allout as a minor mode."
165 ;; Architecture:
166 ;; allout-mode-map var is a keymap by virtue of being a defalias for
167 ;; allout-mode-map-value, which has the actual keymap value.
168 ;; allout-mode-map's symbol value is just 'allout-mode-map, so it can be
169 ;; used in minor-mode-map-alist to indirect to the actual
170 ;; allout-mode-map-var value, which can be adjusted and reassigned.
171
172 (setq allout-mode-map-value map)
173 ;; The defalias reexecution is necessary when allout-mode-map-value is
174 ;; changing from nil, and it doesn't hurt to do it every time, so:
175 (defalias 'allout-mode-map allout-mode-map-value))
176;;;_ * intialize the mode map:
177;; ensure that allout-mode-map has some setting even if allout-mode hasn't
178;; been invoked:
179(allout-compose-and-institute-keymap)
140;;;_ = allout-command-prefix 180;;;_ = allout-command-prefix
141(defcustom allout-command-prefix "\C-c " 181(defcustom allout-command-prefix "\C-c "
142 "Key sequence to be used as prefix for outline mode command key bindings. 182 "Key sequence to be used as prefix for outline mode command key bindings.
@@ -145,7 +185,7 @@ Default is '\C-c<space>'; just '\C-c' is more short-and-sweet, if you're
145willing to let allout use a bunch of \C-c keybindings." 185willing to let allout use a bunch of \C-c keybindings."
146 :type 'string 186 :type 'string
147 :group 'allout-keybindings 187 :group 'allout-keybindings
148 :set 'allout-bind-keys) 188 :set 'allout-compose-and-institute-keymap)
149;;;_ = allout-keybindings-binding 189;;;_ = allout-keybindings-binding
150(define-widget 'allout-keybindings-binding 'lazy 190(define-widget 'allout-keybindings-binding 'lazy
151 "Structure of allout keybindings customization items." 191 "Structure of allout keybindings customization items."
@@ -157,7 +197,7 @@ willing to let allout use a bunch of \C-c keybindings."
157(defcustom allout-prefixed-keybindings 197(defcustom allout-prefixed-keybindings
158 '(("[(control ?n)]" allout-next-visible-heading) 198 '(("[(control ?n)]" allout-next-visible-heading)
159 ("[(control ?p)]" allout-previous-visible-heading) 199 ("[(control ?p)]" allout-previous-visible-heading)
160;; ("[(control ?u)]" allout-up-current-level) 200 ("[(control ?u)]" allout-up-current-level)
161 ("[(control ?f)]" allout-forward-current-level) 201 ("[(control ?f)]" allout-forward-current-level)
162 ("[(control ?b)]" allout-backward-current-level) 202 ("[(control ?b)]" allout-backward-current-level)
163 ("[(control ?a)]" allout-beginning-of-current-entry) 203 ("[(control ?a)]" allout-beginning-of-current-entry)
@@ -166,7 +206,8 @@ willing to let allout use a bunch of \C-c keybindings."
166 ("[(control ?i)]" allout-show-children) 206 ("[(control ?i)]" allout-show-children)
167 ("[(control ?s)]" allout-show-current-subtree) 207 ("[(control ?s)]" allout-show-current-subtree)
168 ("[(control ?t)]" allout-toggle-current-subtree-exposure) 208 ("[(control ?t)]" allout-toggle-current-subtree-exposure)
169 ("[(control ?h)]" allout-hide-current-subtree) 209;; Let user customize if they want to preempt describe-prefix-bindings ^h use.
210;; ("[(control ?h)]" allout-hide-current-subtree)
170 ("[?h]" allout-hide-current-subtree) 211 ("[?h]" allout-hide-current-subtree)
171 ("[(control ?o)]" allout-show-current-entry) 212 ("[(control ?o)]" allout-show-current-entry)
172 ("[?!]" allout-show-all) 213 ("[?!]" allout-show-all)
@@ -181,7 +222,7 @@ willing to let allout use a bunch of \C-c keybindings."
181 ("[?*]" allout-rebullet-current-heading) 222 ("[?*]" allout-rebullet-current-heading)
182 ("[?']" allout-number-siblings) 223 ("[?']" allout-number-siblings)
183 ("[(control ?k)]" allout-kill-topic) 224 ("[(control ?k)]" allout-kill-topic)
184 ("[??]" allout-copy-topic-as-kill) 225 ("[(meta ?k)]" allout-copy-topic-as-kill)
185 ("[?@]" allout-resolve-xref) 226 ("[?@]" allout-resolve-xref)
186 ("[?=?c]" allout-copy-exposed-to-buffer) 227 ("[?=?c]" allout-copy-exposed-to-buffer)
187 ("[?=?i]" allout-indented-exposed-to-buffer) 228 ("[?=?i]" allout-indented-exposed-to-buffer)
@@ -205,14 +246,14 @@ multiple functions will not work - the last binding for a key
205prevails." 246prevails."
206 :type 'allout-keybindings-binding 247 :type 'allout-keybindings-binding
207 :group 'allout-keybindings 248 :group 'allout-keybindings
208 :set 'allout-bind-keys 249 :set 'allout-compose-and-institute-keymap
209 ) 250 )
210;;;_ = allout-unprefixed-keybindings 251;;;_ = allout-unprefixed-keybindings
211(defcustom allout-unprefixed-keybindings 252(defcustom allout-unprefixed-keybindings
212 '(("[(control ?k)]" allout-kill-line) 253 '(("[(control ?k)]" allout-kill-line)
213 ("[??(meta ?k)]" allout-copy-line-as-kill) 254 ("[(meta ?k)]" allout-copy-line-as-kill)
214 ("[(control ?y)]" allout-yank) 255 ("[(control ?y)]" allout-yank)
215 ("[??(meta ?y)]" allout-yank-pop) 256 ("[(meta ?y)]" allout-yank-pop)
216 ) 257 )
217 "Allout-mode functions bound to keys without any added prefix. 258 "Allout-mode functions bound to keys without any added prefix.
218 259
@@ -228,68 +269,9 @@ Use vector format for the keys:
228See the existing keys for examples." 269See the existing keys for examples."
229 :type 'allout-keybindings-binding 270 :type 'allout-keybindings-binding
230 :group 'allout-keybindings 271 :group 'allout-keybindings
231 :set 'allout-bind-keys 272 :set 'allout-compose-and-institute-keymap
232 ) 273 )
233 274
234;;;_ = allout-preempt-trailing-ctrl-h
235(defcustom allout-preempt-trailing-ctrl-h nil
236 "Use <prefix>-\C-h, instead of leaving it for describe-prefix-bindings?"
237 :type 'boolean
238 :group 'allout)
239
240;;;_ = allout-keybindings-list
241;;; You have to reactivate allout-mode to change this var's current setting.
242(defvar allout-keybindings-list ()
243 "*List of `allout-mode' key / function bindings, for `allout-mode-map'.
244String or vector key will be prefaced with `allout-command-prefix',
245unless optional third, non-nil element is present.")
246(setq allout-keybindings-list
247 '(
248 ; Motion commands:
249 ("\C-n" allout-next-visible-heading)
250 ("\C-p" allout-previous-visible-heading)
251 ("\C-u" allout-up-current-level)
252 ("\C-f" allout-forward-current-level)
253 ("\C-b" allout-backward-current-level)
254 ("\C-a" allout-beginning-of-current-entry)
255 ("\C-e" allout-end-of-entry)
256 ; Exposure commands:
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
259 ("\C-s" allout-show-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)
264 ("\C-t" allout-toggle-current-subtree-exposure)
265 ("h" allout-hide-current-subtree)
266 ("\C-o" allout-show-current-entry)
267 ("!" allout-show-all)
268 ("x" allout-toggle-current-subtree-encryption)
269 ; Alteration commands:
270 (" " allout-open-sibtopic)
271 ("." allout-open-subtopic)
272 ("," allout-open-supertopic)
273 ("'" allout-shift-in)
274 (">" allout-shift-in)
275 ("<" allout-shift-out)
276 ("\C-m" allout-rebullet-topic)
277 ("*" allout-rebullet-current-heading)
278 ("#" allout-number-siblings)
279 ("\C-k" allout-kill-line t)
280 ([?\M-k] allout-copy-line-as-kill t)
281 ("\C-y" allout-yank t)
282 ([?\M-y] allout-yank-pop t)
283 ("\C-k" allout-kill-topic)
284 ([?\M-k] allout-copy-topic-as-kill)
285 ; Miscellaneous commands:
286 ;([?\C-\ ] allout-mark-topic)
287 ("@" allout-resolve-xref)
288 ("=c" allout-copy-exposed-to-buffer)
289 ("=i" allout-indented-exposed-to-buffer)
290 ("=t" allout-latexify-exposed)
291 ("=p" allout-flatten-exposed-to-buffer)))
292
293;;;_ = allout-auto-activation 275;;;_ = allout-auto-activation
294(defcustom allout-auto-activation nil 276(defcustom allout-auto-activation nil
295 "Regulates auto-activation modality of allout outlines -- see `allout-init'. 277 "Regulates auto-activation modality of allout outlines -- see `allout-init'.
@@ -1239,36 +1221,6 @@ Also refresh various data structures that hinge on the regexp."
1239 "[^" allout-primary-bullet "]")) 1221 "[^" allout-primary-bullet "]"))
1240 "\\)" 1222 "\\)"
1241 )))) 1223 ))))
1242;;;_ : Key bindings
1243;;;_ = allout-mode-map
1244(defvar allout-mode-map nil "Keybindings for (allout) outline minor mode.")
1245;;;_ > produce-allout-mode-map (keymap-alist &optional base-map)
1246(defun produce-allout-mode-map (keymap-list &optional base-map)
1247 "Produce keymap for use as `allout-mode-map', from KEYMAP-LIST.
1248
1249Built on top of optional BASE-MAP, or empty sparse map if none specified.
1250See doc string for `allout-keybindings-list' for format of binding list."
1251 (let ((map (or base-map (make-sparse-keymap)))
1252 (pref (list allout-command-prefix)))
1253 (mapc (function
1254 (lambda (cell)
1255 (let ((add-pref (null (cdr (cdr cell))))
1256 (key-suff (list (car cell))))
1257 (apply 'define-key
1258 (list map
1259 (apply 'vconcat (if add-pref
1260 (append pref key-suff)
1261 key-suff))
1262 (car (cdr cell)))))))
1263 keymap-list)
1264 map))
1265;;;_ > allout-mode-map-adjustments (base-map)
1266(defun allout-mode-map-adjustments (base-map)
1267 "Do conditional additions to specified base-map, like inclusion of \\C-h."
1268 (if allout-preempt-trailing-ctrl-h
1269 (cons '("\C-h" allout-hide-current-subtree) base-map)
1270 base-map)
1271 )
1272;;;_ : Menu bar 1224;;;_ : Menu bar
1273(defvar allout-mode-exposure-menu) 1225(defvar allout-mode-exposure-menu)
1274(defvar allout-mode-editing-menu) 1226(defvar allout-mode-editing-menu)
@@ -1277,7 +1229,7 @@ See doc string for `allout-keybindings-list' for format of binding list."
1277(defun produce-allout-mode-menubar-entries () 1229(defun produce-allout-mode-menubar-entries ()
1278 (require 'easymenu) 1230 (require 'easymenu)
1279 (easy-menu-define allout-mode-exposure-menu 1231 (easy-menu-define allout-mode-exposure-menu
1280 allout-mode-map 1232 allout-mode-map-value
1281 "Allout outline exposure menu." 1233 "Allout outline exposure menu."
1282 '("Exposure" 1234 '("Exposure"
1283 ["Show Entry" allout-show-current-entry t] 1235 ["Show Entry" allout-show-current-entry t]
@@ -1288,7 +1240,7 @@ See doc string for `allout-keybindings-list' for format of binding list."
1288 "----" 1240 "----"
1289 ["Show All" allout-show-all t])) 1241 ["Show All" allout-show-all t]))
1290 (easy-menu-define allout-mode-editing-menu 1242 (easy-menu-define allout-mode-editing-menu
1291 allout-mode-map 1243 allout-mode-map-value
1292 "Allout outline editing menu." 1244 "Allout outline editing menu."
1293 '("Headings" 1245 '("Headings"
1294 ["Open Sibling" allout-open-sibtopic t] 1246 ["Open Sibling" allout-open-sibtopic t]
@@ -1305,7 +1257,7 @@ See doc string for `allout-keybindings-list' for format of binding list."
1305 allout-toggle-current-subtree-encryption 1257 allout-toggle-current-subtree-encryption
1306 (> (allout-current-depth) 1)])) 1258 (> (allout-current-depth) 1)]))
1307 (easy-menu-define allout-mode-navigation-menu 1259 (easy-menu-define allout-mode-navigation-menu
1308 allout-mode-map 1260 allout-mode-map-value
1309 "Allout outline navigation menu." 1261 "Allout outline navigation menu."
1310 '("Navigation" 1262 '("Navigation"
1311 ["Next Visible Heading" allout-next-visible-heading t] 1263 ["Next Visible Heading" allout-next-visible-heading t]
@@ -1322,7 +1274,7 @@ See doc string for `allout-keybindings-list' for format of binding list."
1322 ["End of Entry" allout-end-of-entry t] 1274 ["End of Entry" allout-end-of-entry t]
1323 ["End of Subtree" allout-end-of-current-subtree t])) 1275 ["End of Subtree" allout-end-of-current-subtree t]))
1324 (easy-menu-define allout-mode-misc-menu 1276 (easy-menu-define allout-mode-misc-menu
1325 allout-mode-map 1277 allout-mode-map-value
1326 "Allout outlines miscellaneous bindings." 1278 "Allout outlines miscellaneous bindings."
1327 '("Misc" 1279 '("Misc"
1328 ["Version" allout-version t] 1280 ["Version" allout-version t]
@@ -1776,19 +1728,16 @@ the following two lines in your Emacs init file:
1776 '(allout-overlay-insert-in-front-handler))) 1728 '(allout-overlay-insert-in-front-handler)))
1777 (put 'allout-exposure-category 'modification-hooks 1729 (put 'allout-exposure-category 'modification-hooks
1778 '(allout-overlay-interior-modification-handler))) 1730 '(allout-overlay-interior-modification-handler)))
1779;;;_ > allout-mode (&optional force) 1731;;;_ > define-minor-mode allout-mode
1780;;;_ : Defun: 1732;;;_ : Defun:
1781;;;###autoload 1733;;;###autoload
1782(defun allout-mode (&optional force) 1734(define-minor-mode allout-mode
1783;;;_ . Doc string: 1735;;;_ . Doc string:
1784 "Toggle minor mode for controlling exposure and editing of text outlines. 1736 "Toggle minor mode for controlling exposure and editing of text outlines.
1785\\<allout-mode-map> 1737\\<allout-mode-map-value>
1786 1738
1787Allout outline mode always runs as a minor mode. 1739Allout outline mode always runs as a minor mode.
1788 1740
1789Optional FORCE non-nil, or command with no universal argument,
1790means force activation.
1791
1792Allout outline mode provides extensive outline oriented 1741Allout outline mode provides extensive outline oriented
1793formatting and manipulation. It enables structural editing of 1742formatting and manipulation. It enables structural editing of
1794outlines, as well as navigation and exposure. It also is 1743outlines, as well as navigation and exposure. It also is
@@ -1816,14 +1765,16 @@ features, and see the docstring of the function `allout-init' for
1816instructions on priming your emacs session for automatic 1765instructions on priming your emacs session for automatic
1817activation of `allout-mode'. 1766activation of `allout-mode'.
1818 1767
1819The bindings are dictated by the customizable `allout-keybindings-list' 1768The bindings are those listed in `allout-prefixed-keybindings'
1820variable. We recommend customizing `allout-command-prefix' to use just 1769and `allout-unprefixed-keybindings'. We recommend customizing
1821`\\C-c' as the command prefix, if the allout bindings don't conflict with 1770`allout-command-prefix' to use just `\\C-c' as the command
1822any personal bindings you have on \\C-c. In any case, outline structure 1771prefix, if the allout bindings don't conflict with any personal
1823navigation and authoring is simplified by positioning the cursor on an 1772bindings you have on \\C-c. In any case, outline structure
1824item's bullet character, the \"hot-spot\" -- then you can invoke allout 1773navigation and authoring is simplified by positioning the cursor
1825commands with just the un-prefixed, un-control-shifted command letters. 1774on an item's bullet character, the \"hot-spot\" -- then you can
1826This is described further in the HOT-SPOT Operation section. 1775invoke allout commands with just the un-prefixed,
1776un-control-shifted command letters. This is described further in
1777the HOT-SPOT Operation section.
1827 1778
1828 Exposure Control: 1779 Exposure Control:
1829 ---------------- 1780 ----------------
@@ -2043,7 +1994,8 @@ CONCEALED:
2043CLOSED: A TOPIC whose immediate OFFSPRING and body-text is CONCEALED. 1994CLOSED: A TOPIC whose immediate OFFSPRING and body-text is CONCEALED.
2044OPEN: A TOPIC that is not CLOSED, though its OFFSPRING or BODY may be." 1995OPEN: A TOPIC that is not CLOSED, though its OFFSPRING or BODY may be."
2045;;;_ . Code 1996;;;_ . Code
2046 (interactive "P") 1997 :lighter " Allout"
1998 :keymap 'allout-mode-map
2047 1999
2048 (let ((write-file-hook-var-name (cond ((boundp 'write-file-functions) 2000 (let ((write-file-hook-var-name (cond ((boundp 'write-file-functions)
2049 'write-file-functions) 2001 'write-file-functions)
@@ -2054,7 +2006,7 @@ OPEN: A TOPIC that is not CLOSED, though its OFFSPRING or BODY may be."
2054 allout-layout 2006 allout-layout
2055 allout-default-layout))) 2007 allout-default-layout)))
2056 2008
2057 (if (and (allout-mode-p) (not force)) 2009 (if (not (allout-mode-p))
2058 (progn 2010 (progn
2059 ;; Deactivation: 2011 ;; Deactivation:
2060 2012
@@ -2069,18 +2021,14 @@ OPEN: A TOPIC that is not CLOSED, though its OFFSPRING or BODY may be."
2069 (remove-hook 'post-command-hook 'allout-post-command-business t) 2021 (remove-hook 'post-command-hook 'allout-post-command-business t)
2070 (remove-hook 'before-change-functions 'allout-before-change-handler t) 2022 (remove-hook 'before-change-functions 'allout-before-change-handler t)
2071 (remove-hook 'isearch-mode-end-hook 'allout-isearch-end-handler t) 2023 (remove-hook 'isearch-mode-end-hook 'allout-isearch-end-handler t)
2072 (remove-hook write-file-hook-var-name 'allout-write-file-hook-handler 2024 (remove-hook write-file-hook-var-name
2073 t) 2025 'allout-write-file-hook-handler t)
2074 (remove-hook 'auto-save-hook 'allout-auto-save-hook-handler t) 2026 (remove-hook 'auto-save-hook 'allout-auto-save-hook-handler t)
2075 2027
2076 (remove-overlays (point-min) (point-max) 2028 (remove-overlays (point-min) (point-max)
2077 'category 'allout-exposure-category) 2029 'category 'allout-exposure-category))
2078
2079 (setq allout-mode nil)
2080 (run-hooks 'allout-mode-deactivate-hook)
2081 (run-hooks 'allout-mode-off-hook))
2082 2030
2083 ;; Activation: 2031 ;; Activating:
2084 (if allout-old-style-prefixes 2032 (if allout-old-style-prefixes
2085 ;; Inhibit all the fancy formatting: 2033 ;; Inhibit all the fancy formatting:
2086 (allout-add-resumptions '(allout-primary-bullet "*"))) 2034 (allout-add-resumptions '(allout-primary-bullet "*")))
@@ -2098,17 +2046,9 @@ OPEN: A TOPIC that is not CLOSED, though its OFFSPRING or BODY may be."
2098 allout-bob-regexp 2046 allout-bob-regexp
2099 extend)) 2047 extend))
2100 2048
2101 ;; Produce map from current version of allout-keybindings-list: 2049 (allout-compose-and-institute-keymap)
2102 (allout-setup-mode-map)
2103 (produce-allout-mode-menubar-entries) 2050 (produce-allout-mode-menubar-entries)
2104 2051
2105 ;; Include on minor-mode-map-alist, if not already there:
2106 (if (not (member '(allout-mode . allout-mode-map)
2107 minor-mode-map-alist))
2108 (setq minor-mode-map-alist
2109 (cons '(allout-mode . allout-mode-map)
2110 minor-mode-map-alist)))
2111
2112 (add-to-invisibility-spec '(allout . t)) 2052 (add-to-invisibility-spec '(allout . t))
2113 2053
2114 (allout-add-resumptions '(line-move-ignore-invisible t)) 2054 (allout-add-resumptions '(line-move-ignore-invisible t))
@@ -2142,13 +2082,7 @@ OPEN: A TOPIC that is not CLOSED, though its OFFSPRING or BODY may be."
2142 ;; allout-auto-fill will use the stashed values and so forth. 2082 ;; allout-auto-fill will use the stashed values and so forth.
2143 (allout-add-resumptions '(auto-fill-function allout-auto-fill))) 2083 (allout-add-resumptions '(auto-fill-function allout-auto-fill)))
2144 2084
2145 (or (assq 'allout-mode minor-mode-alist)
2146 (setq minor-mode-alist
2147 (cons '(allout-mode " Allout") minor-mode-alist)))
2148
2149 (allout-setup-menubar) 2085 (allout-setup-menubar)
2150 (setq allout-mode t)
2151 (run-hooks 'allout-mode-hook)
2152 2086
2153 ;; Do auto layout if warranted: 2087 ;; Do auto layout if warranted:
2154 (when (and allout-layout 2088 (when (and allout-layout
@@ -2182,36 +2116,6 @@ OPEN: A TOPIC that is not CLOSED, though its OFFSPRING or BODY may be."
2182 ) ; define-minor-mode 2116 ) ; define-minor-mode
2183;;;_ > allout-minor-mode alias 2117;;;_ > allout-minor-mode alias
2184(defalias 'allout-minor-mode 'allout-mode) 2118(defalias 'allout-minor-mode 'allout-mode)
2185;;;_ > allout-setup-mode-map ())
2186(defun allout-setup-mode-map ()
2187 "Establish allout-mode bindings."
2188 (setq-default allout-mode-map
2189 (produce-allout-mode-map
2190 (allout-mode-map-adjustments allout-keybindings-list)))
2191 (setq allout-mode-map
2192 (produce-allout-mode-map
2193 (allout-mode-map-adjustments allout-keybindings-list)))
2194 (substitute-key-definition 'beginning-of-line
2195 'allout-beginning-of-line
2196 allout-mode-map global-map)
2197 (substitute-key-definition 'move-beginning-of-line
2198 'allout-beginning-of-line
2199 allout-mode-map global-map)
2200 (substitute-key-definition 'end-of-line
2201 'allout-end-of-line
2202 allout-mode-map global-map)
2203 (substitute-key-definition 'move-end-of-line
2204 'allout-end-of-line
2205 allout-mode-map global-map)
2206 (fset 'allout-mode-map allout-mode-map))
2207
2208;; ensure that allout-mode-map has some setting even if allout-mode hasn't
2209;; been invoked:
2210(allout-setup-mode-map)
2211
2212;;;_ > allout-minor-mode
2213(defalias 'allout-minor-mode 'allout-mode)
2214
2215;;;_ > allout-unload-function 2119;;;_ > allout-unload-function
2216(defun allout-unload-function () 2120(defun allout-unload-function ()
2217 "Unload the allout outline library." 2121 "Unload the allout outline library."
@@ -3425,7 +3329,7 @@ When set, tells post-processing to reposition on topic bullet, and
3425then unset it. Set by `allout-pre-command-business' when implementing 3329then unset it. Set by `allout-pre-command-business' when implementing
3426hot-spot operation, where literal characters typed over a topic bullet 3330hot-spot operation, where literal characters typed over a topic bullet
3427are mapped to the command of the corresponding control-key on the 3331are mapped to the command of the corresponding control-key on the
3428`allout-mode-map'.") 3332`allout-mode-map-value'.")
3429(make-variable-buffer-local 'allout-post-goto-bullet) 3333(make-variable-buffer-local 'allout-post-goto-bullet)
3430;;;_ = allout-command-counter 3334;;;_ = allout-command-counter
3431(defvar allout-command-counter 0 3335(defvar allout-command-counter 0
@@ -3464,11 +3368,12 @@ coordinating with allout activity.")
3464Among other things, implements special behavior when the cursor is on the 3368Among other things, implements special behavior when the cursor is on the
3465topic bullet character. 3369topic bullet character.
3466 3370
3467When the cursor is on the bullet character, self-insert characters are 3371When the cursor is on the bullet character, self-insert
3468reinterpreted as the corresponding control-character in the 3372characters are reinterpreted as the corresponding
3469`allout-mode-map'. The `allout-mode' `post-command-hook' insures that 3373control-character in the `allout-mode-map-value'. The
3470the cursor which has moved as a result of such reinterpretation is 3374`allout-mode' `post-command-hook' insures that the cursor which
3471positioned on the bullet character of the destination topic. 3375has moved as a result of such reinterpretation is positioned on
3376the bullet character of the destination topic.
3472 3377
3473The upshot is that you can get easy, single (ie, unmodified) key 3378The upshot is that you can get easy, single (ie, unmodified) key
3474outline maneuvering operations by positioning the cursor on the bullet 3379outline maneuvering operations by positioning the cursor on the bullet
@@ -3495,9 +3400,6 @@ this-command accordingly.
3495Returns the qualifying command, if any, else nil." 3400Returns the qualifying command, if any, else nil."
3496 (interactive) 3401 (interactive)
3497 (let* ((modified (event-modifiers last-command-event)) 3402 (let* ((modified (event-modifiers last-command-event))
3498 (key-string (if (numberp last-command-event)
3499 (char-to-string
3500 (event-basic-type last-command-event))))
3501 (key-num (cond ((numberp last-command-event) last-command-event) 3403 (key-num (cond ((numberp last-command-event) last-command-event)
3502 ;; for XEmacs character type: 3404 ;; for XEmacs character type:
3503 ((and (fboundp 'characterp) 3405 ((and (fboundp 'characterp)
@@ -3514,16 +3416,13 @@ Returns the qualifying command, if any, else nil."
3514 (not modified) 3416 (not modified)
3515 (<= 33 key-num) 3417 (<= 33 key-num)
3516 (setq mapped-binding 3418 (setq mapped-binding
3517 (or (and (assoc key-string allout-keybindings-list) 3419 ;; translate as a keybinding:
3518 ;; translate literal membership on list: 3420 (key-binding (vconcat allout-command-prefix
3519 (cadr (assoc key-string allout-keybindings-list))) 3421 (vector
3520 ;; translate as a keybinding: 3422 (if (and (<= 97 key-num) ; "a"
3521 (key-binding (vconcat allout-command-prefix 3423 (>= 122 key-num)) ; "z"
3522 (vector 3424 (- key-num 96) key-num)))
3523 (if (and (<= 97 key-num) ; "a" 3425 t)))
3524 (>= 122 key-num)) ; "z"
3525 (- key-num 96) key-num)))
3526 t))))
3527 ;; Qualified as an allout command -- do hot-spot operation. 3426 ;; Qualified as an allout command -- do hot-spot operation.
3528 (setq allout-post-goto-bullet t) 3427 (setq allout-post-goto-bullet t)
3529 ;; accept-defaults nil, or else we get allout-item-icon-key-handler. 3428 ;; accept-defaults nil, or else we get allout-item-icon-key-handler.