Fix: YAS-RELOAD-ALL preserves user bindings on YAS-MINOR-MODE-MAP cleanup

- Don't create a new keymap on every reload
This commit is contained in:
João Távora 2012-12-23 20:43:23 +00:00
parent 9b31880ed1
commit 1ef0091de1

View 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.
;;