Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Define yas--direct-%s var for extra modes #1111

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions yasnippet.el
Original file line number Diff line number Diff line change
Expand Up @@ -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."
Expand All @@ -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
Expand Down