aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKen Manheimer2020-07-07 10:32:03 -0400
committerKen Manheimer2020-07-20 14:30:40 -0400
commit82742e295d2907bb2f56090296f7a128f1f3d6aa (patch)
tree3f28fdb02b4b2b15448bc09c248e54a007cb0c47
parent2035ecca578f3cbcc96c314e16e21be51ddea98d (diff)
downloademacs-82742e295d2907bb2f56090296f7a128f1f3d6aa.tar.gz
emacs-82742e295d2907bb2f56090296f7a128f1f3d6aa.zip
Backport: Resolve missing button-region keymap bindings.
* lisp/allout-widgets.el (allout-item-icon-keymap, allout-item-body-keymap, allout-cue-span-keymap, allout-widgets-mode): Inherit from both (current-local-map) and (current-global-map). This provides for missing global bindings when inheriting from just (current-local-map), eg Esc-<. (cherry picked from commit dd7c191291c8eb1afeac0f1512745491c5c7a317)
-rw-r--r--lisp/allout-widgets.el37
1 files changed, 22 insertions, 15 deletions
diff --git a/lisp/allout-widgets.el b/lisp/allout-widgets.el
index 64f2ba500d9..5460551106b 100644
--- a/lisp/allout-widgets.el
+++ b/lisp/allout-widgets.el
@@ -415,15 +415,17 @@ not altered with an escape sequence.")
415;;;_ , Widget element formatting 415;;;_ , Widget element formatting
416;;;_ = allout-item-icon-keymap 416;;;_ = allout-item-icon-keymap
417(defvar allout-item-icon-keymap 417(defvar allout-item-icon-keymap
418 (let ((km (make-sparse-keymap))) 418 (let ((km (make-sparse-keymap))
419 (as-parent (if (current-local-map)
420 (make-composed-keymap (current-local-map)
421 (current-global-map))
422 (current-global-map))))
423 ;; The keymap parent is reset on the each local var when mode starts.
424 (set-keymap-parent km as-parent)
419 (dolist (digit '("0" "1" "2" "3" 425 (dolist (digit '("0" "1" "2" "3"
420 "4" "5" "6" "7" "8" "9")) 426 "4" "5" "6" "7" "8" "9"))
421 (define-key km digit 'digit-argument)) 427 (define-key km digit 'digit-argument))
422 (define-key km "-" 'negative-argument) 428 (define-key km "-" 'negative-argument)
423;; (define-key km [(return)] 'allout-tree-expand-command)
424;; (define-key km [(meta return)] 'allout-toggle-torso-command)
425;; (define-key km [(down-mouse-1)] 'allout-item-button-click)
426;; (define-key km [(down-mouse-2)] 'allout-toggle-torso-event-command)
427 ;; Override underlying mouse-1 and mouse-2 bindings in icon territory: 429 ;; Override underlying mouse-1 and mouse-2 bindings in icon territory:
428 (define-key km [(mouse-1)] (lambda () (interactive) nil)) 430 (define-key km [(mouse-1)] (lambda () (interactive) nil))
429 (define-key km [(mouse-2)] (lambda () (interactive) nil)) 431 (define-key km [(mouse-2)] (lambda () (interactive) nil))
@@ -433,17 +435,16 @@ not altered with an escape sequence.")
433 435
434 km) 436 km)
435 "General tree-node key bindings.") 437 "General tree-node key bindings.")
438(make-variable-buffer-local 'allout-item-icon-keymap)
436;;;_ = allout-item-body-keymap 439;;;_ = allout-item-body-keymap
437(defvar allout-item-body-keymap 440(defvar allout-item-body-keymap
438 (let ((km (make-sparse-keymap)) 441 (let ((km (make-sparse-keymap))
439 (local-map (current-local-map))) 442 (as-parent (if (current-local-map)
440;; (define-key km [(control return)] 'allout-tree-expand-command) 443 (make-composed-keymap (current-local-map)
441;; (define-key km [(meta return)] 'allout-toggle-torso-command) 444 (current-global-map))
442 ;; XXX We need to reset this per buffer's mode; we do so in 445 (current-global-map))))
443 ;; allout-widgets-mode. 446 ;; The keymap parent is reset on the each local var when mode starts.
444 (if local-map 447 (set-keymap-parent km as-parent)
445 (set-keymap-parent km local-map))
446
447 km) 448 km)
448 "General key bindings for the text content of outline items.") 449 "General key bindings for the text content of outline items.")
449(make-variable-buffer-local 'allout-item-body-keymap) 450(make-variable-buffer-local 'allout-item-body-keymap)
@@ -456,6 +457,7 @@ not altered with an escape sequence.")
456 (set-keymap-parent km allout-item-icon-keymap) 457 (set-keymap-parent km allout-item-icon-keymap)
457 km) 458 km)
458 "Keymap used in the item cue area - the space between the icon and headline.") 459 "Keymap used in the item cue area - the space between the icon and headline.")
460(make-variable-buffer-local 'allout-cue-span-keymap)
459;;;_ = allout-escapes-category 461;;;_ = allout-escapes-category
460(defvar allout-escapes-category nil 462(defvar allout-escapes-category nil
461 "Symbol for category of text property used to hide escapes of prefix-like 463 "Symbol for category of text property used to hide escapes of prefix-like
@@ -566,8 +568,13 @@ outline hot-spot navigation (see `allout-mode')."
566 (add-to-invisibility-spec '(allout-torso . t)) 568 (add-to-invisibility-spec '(allout-torso . t))
567 (add-to-invisibility-spec 'allout-escapes) 569 (add-to-invisibility-spec 'allout-escapes)
568 570
569 (if (current-local-map) 571 (let ((as-parent (if (current-local-map)
570 (set-keymap-parent allout-item-body-keymap (current-local-map))) 572 (make-composed-keymap (current-local-map)
573 (current-global-map))
574 (current-global-map))))
575 (set-keymap-parent allout-item-body-keymap as-parent)
576 ;; allout-cue-span-keymap uses allout-item-icon-keymap as parent.
577 (set-keymap-parent allout-item-icon-keymap as-parent))
571 578
572 (add-hook 'allout-exposure-change-functions 579 (add-hook 'allout-exposure-change-functions
573 'allout-widgets-exposure-change-recorder nil 'local) 580 'allout-widgets-exposure-change-recorder nil 'local)