mirror of
https://github.com/joaotavora/yasnippet.git
synced 2025-10-14 05:23:04 +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"))))
|
("'quote" . "OKquoteOK"))))
|
||||||
(yas-reload-all)
|
(yas-reload-all)
|
||||||
(emacs-lisp-mode)
|
(emacs-lisp-mode)
|
||||||
(yas-minor-mode-on)
|
(yas-minor-mode +1)
|
||||||
(let ((yas-key-syntaxes '("w" "w_")))
|
(let ((yas-key-syntaxes '("w" "w_")))
|
||||||
(let ((yas--barbaz t))
|
(let ((yas--barbaz t))
|
||||||
(yas-should-expand '(("foo-barbaz" . "foo-OKbarbazOK")
|
(yas-should-expand '(("foo-barbaz" . "foo-OKbarbazOK")
|
||||||
@ -1620,7 +1620,7 @@ add the snippets associated with the given mode."
|
|||||||
("car" . "(car )"))))
|
("car" . "(car )"))))
|
||||||
(yas-reload-all)
|
(yas-reload-all)
|
||||||
(emacs-lisp-mode)
|
(emacs-lisp-mode)
|
||||||
(yas-minor-mode-on)
|
(yas-minor-mode +1)
|
||||||
(yas-activate-extra-mode 'markdown-mode)
|
(yas-activate-extra-mode 'markdown-mode)
|
||||||
(should (eq 'markdown-mode (car yas--extra-modes)))
|
(should (eq 'markdown-mode (car yas--extra-modes)))
|
||||||
(yas-should-expand '(("_" . "_Text_ ")))
|
(yas-should-expand '(("_" . "_Text_ ")))
|
||||||
|
@ -918,9 +918,12 @@ activate snippets associated with that mode."
|
|||||||
(remove mode
|
(remove mode
|
||||||
yas--extra-modes)))
|
yas--extra-modes)))
|
||||||
|
|
||||||
|
(defun yas-temp-buffer-p (&optional buffer)
|
||||||
|
(eq (aref (buffer-name buffer) 0) ?\s))
|
||||||
|
|
||||||
(define-obsolete-variable-alias 'yas-dont-activate
|
(define-obsolete-variable-alias 'yas-dont-activate
|
||||||
'yas-dont-activate-functions "0.9.2")
|
'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.
|
"Special hook to control which buffers `yas-global-mode' affects.
|
||||||
Functions are called with no argument, and should return non-nil to prevent
|
Functions are called with no argument, and should return non-nil to prevent
|
||||||
`yas-global-mode' from enabling yasnippet in this buffer.
|
`yas-global-mode' from enabling yasnippet in this buffer.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user