diff --git a/yasnippet.el b/yasnippet.el index 78ef38ac..86834d63 100644 --- a/yasnippet.el +++ b/yasnippet.el @@ -912,7 +912,7 @@ Key bindings: (remove 'yas--direct-keymaps emulation-mode-map-alists))))) (defun yas-activate-extra-mode (mode) - "Activates the snippets for the given `mode' in the buffer. + "Activates the snippets for the given `MODE' in the buffer. The function can be called in the hook of a minor mode to activate snippets associated with that mode." @@ -929,10 +929,13 @@ activate snippets associated with that mode." (intern symbol))))) (when mode (add-to-list (make-local-variable 'yas--extra-modes) mode) + (let ((name (intern (format "yas--direct-%s" mode)))) + (set-default name nil) + (set (make-local-variable name) t)) (yas--load-pending-jits))) (defun yas-deactivate-extra-mode (mode) - "Deactivates the snippets for the given `mode' in the buffer." + "Deactivates the snippets for the given `MODE' in the buffer." (interactive (list (intern (completing-read