mirror of
https://github.com/joaotavora/yasnippet.git
synced 2025-10-13 13:13:03 +00:00
Don't turn on yas-minor-mode in temp buffers
Generally, the user won't be interacting with, or creating snippets in temporary buffers. * yasnippet.el (yas-temp-buffer-p): New function. (yas-dont-activate-functions): Add it to default value. * yasnippet-tests.el (complicated-yas-key-syntaxes) (test-yas-activate-extra-modes): Call yas-minor-mode instead of yas-minor-mode-on, to ensure activation.
This commit is contained in:
parent
8b25d627a4
commit
dabc719921
@ -998,7 +998,7 @@ hello ${1:$(when (stringp yas-text) (funcall func yas-text))} foo${1:$$(concat \
|
||||
("'quote" . "OKquoteOK"))))
|
||||
(yas-reload-all)
|
||||
(emacs-lisp-mode)
|
||||
(yas-minor-mode-on)
|
||||
(yas-minor-mode +1)
|
||||
(let ((yas-key-syntaxes '("w" "w_")))
|
||||
(let ((yas--barbaz t))
|
||||
(yas-should-expand '(("foo-barbaz" . "foo-OKbarbazOK")
|
||||
@ -1620,7 +1620,7 @@ add the snippets associated with the given mode."
|
||||
("car" . "(car )"))))
|
||||
(yas-reload-all)
|
||||
(emacs-lisp-mode)
|
||||
(yas-minor-mode-on)
|
||||
(yas-minor-mode +1)
|
||||
(yas-activate-extra-mode 'markdown-mode)
|
||||
(should (eq 'markdown-mode (car yas--extra-modes)))
|
||||
(yas-should-expand '(("_" . "_Text_ ")))
|
||||
|
@ -918,9 +918,12 @@ activate snippets associated with that mode."
|
||||
(remove mode
|
||||
yas--extra-modes)))
|
||||
|
||||
(defun yas-temp-buffer-p (&optional buffer)
|
||||
(eq (aref (buffer-name buffer) 0) ?\s))
|
||||
|
||||
(define-obsolete-variable-alias 'yas-dont-activate
|
||||
'yas-dont-activate-functions "0.9.2")
|
||||
(defvar yas-dont-activate-functions (list #'minibufferp)
|
||||
(defvar yas-dont-activate-functions (list #'minibufferp #'yas-temp-buffer-p)
|
||||
"Special hook to control which buffers `yas-global-mode' affects.
|
||||
Functions are called with no argument, and should return non-nil to prevent
|
||||
`yas-global-mode' from enabling yasnippet in this buffer.
|
||||
|
Loading…
x
Reference in New Issue
Block a user