From 1ef0091de1aa5cce64bc15a6ff11167ed5fa89dd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20T=C3=A1vora?= Date: Sun, 23 Dec 2012 20:43:23 +0000 Subject: [PATCH] Fix: YAS-RELOAD-ALL preserves user bindings on YAS-MINOR-MODE-MAP cleanup - Don't create a new keymap on every reload --- yasnippet.el | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/yasnippet.el b/yasnippet.el index 175ba13..7c8d0aa 100644 --- a/yasnippet.el +++ b/yasnippet.el @@ -1862,21 +1862,25 @@ loading." ;; `yas--editing-template' to nil, make it guess it next time around (mapc #'(lambda (buffer) (setq yas--editing-template nil)) (buffer-list)))) - ;; Empty all snippet tables, parenting info and all menu tables + ;; Empty all snippet tables and parenting info ;; (setq yas--tables (make-hash-table)) (setq yas--parents (make-hash-table)) + + ;; Before killing `yas--menu-table' use its keys to cleanup the + ;; mode menu parts of `yas--minor-mode-menu' (thus also cleaning + ;; up `yas-minor-mode-map', which points to it) + ;; + (maphash #'(lambda (menu-symbol keymap) + (define-key yas--minor-mode-menu (vector menu-symbol) nil)) + yas--menu-table) + ;; Now empty `yas--menu-table' as well (setq yas--menu-table (make-hash-table)) ;; Cancel all pending 'yas--scheduled-jit-loads' ;; (setq yas--scheduled-jit-loads (make-hash-table)) - ;; Init the `yas-minor-mode-map', taking care not to break the - ;; menu.... - ;; - (setcdr yas-minor-mode-map (cdr (yas--init-minor-keymap))) - ;; Reload the directories listed in `yas-snippet-dirs' or prompt ;; the user to select one. ;;