]> code.delx.au - gnu-emacs-elpa/commitdiff
Fix: YAS-RELOAD-ALL preserves user bindings on YAS-MINOR-MODE-MAP cleanup
authorJoão Távora <joaotavora@gmail.com>
Sun, 23 Dec 2012 20:43:23 +0000 (20:43 +0000)
committerJoão Távora <joaotavora@gmail.com>
Sun, 23 Dec 2012 20:43:23 +0000 (20:43 +0000)
- Don't create a new keymap on every reload

yasnippet.el

index 175ba134bcae016961e38dd183f6f5d7afef879a..7c8d0aae86e78e001c93b4a3b319a5e02661dfe0 100644 (file)
@@ -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.
       ;;