From d5b9ed971dfd9e1ed4115453727abbd1279fd43d Mon Sep 17 00:00:00 2001 From: Mao Date: Tue, 14 Jul 2020 00:34:26 +0800 Subject: [PATCH] add: mode map alist order --- eaf.el | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/eaf.el b/eaf.el index 39c71bd..df28b2e 100644 --- a/eaf.el +++ b/eaf.el @@ -162,6 +162,9 @@ Don't modify this map directly. To bind keys for all apps use (defvar-local eaf--buffer-map-alist nil "EAF buffer-local map alist.") +(defvar-local eaf--buffer-map-alist-order 1 + "Order of EAF buffer-local map alist in `emulation-mode-map-alists'.") + (define-derived-mode eaf-mode fundamental-mode "EAF" "Major mode for Emacs Application Framework buffers. @@ -182,11 +185,15 @@ been initialized." (setq-local bookmark-make-record-function #'eaf--bookmark-make-record) ;; Copy default value in case user already has bindings there - (setq-local emulation-mode-map-alists (default-value 'emulation-mode-map-alists)) + (setq-local emulation-mode-map-alists + (default-value 'emulation-mode-map-alists)) ;; Construct map alist (setq-local eaf--buffer-map-alist (list (cons t eaf-mode-map))) ;; Eanble mode map and make it the first priority - (add-to-ordered-list 'emulation-mode-map-alists 'eaf--buffer-map-alist 1) + (add-to-ordered-list + 'emulation-mode-map-alists + 'eaf--buffer-map-alist + 'eaf--buffer-map-alist-order) (add-hook 'kill-buffer-hook #'eaf--monitor-buffer-kill nil t) (add-hook 'kill-emacs-hook #'eaf--monitor-emacs-kill))