[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] master dabc719 21/42: Don't turn on yas-minor-mode in temp buffer
From: |
Noam Postavsky |
Subject: |
[elpa] master dabc719 21/42: Don't turn on yas-minor-mode in temp buffers |
Date: |
Sun, 22 Dec 2019 17:37:59 -0500 (EST) |
branch: master
commit dabc71992158b749f7b7e745908a51a7011a117d
Author: Noam Postavsky <address@hidden>
Commit: Noam Postavsky <address@hidden>
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.
---
yasnippet-tests.el | 4 ++--
yasnippet.el | 5 ++++-
2 files changed, 6 insertions(+), 3 deletions(-)
diff --git a/yasnippet-tests.el b/yasnippet-tests.el
index 064d6c9..9434ff7 100644
--- a/yasnippet-tests.el
+++ b/yasnippet-tests.el
@@ -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_ ")))
diff --git a/yasnippet.el b/yasnippet.el
index 065e709..d457afd 100644
--- a/yasnippet.el
+++ b/yasnippet.el
@@ -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.
- [elpa] master 1e71360 06/42: Per #947: fix typo in README.md, (continued)
- [elpa] master 1e71360 06/42: Per #947: fix typo in README.md, Noam Postavsky, 2019/12/22
- [elpa] master 7a178a2 07/42: Remove spurious change of before-change-functions, Noam Postavsky, 2019/12/22
- [elpa] master 8328c38 08/42: Fix another failure of cc-mode indentation, Noam Postavsky, 2019/12/22
- [elpa] master eeb05f0 10/42: Handle field adjust of pending active fields, Noam Postavsky, 2019/12/22
- [elpa] master 8452227 13/42: Consider fundamental-mode as ultimate ancestor, Noam Postavsky, 2019/12/22
- [elpa] master fb253ac 15/42: New public function yas-maybe-expand-abbrev-key-filter, Noam Postavsky, 2019/12/22
- [elpa] master bceb65b 16/42: Make backspace/DEL clear field (#957), Noam Postavsky, 2019/12/22
- [elpa] master 3c0be40 11/42: Update FAQ, Noam Postavsky, 2019/12/22
- [elpa] master 8b25d62 20/42: * doc/snippet-development.org: Fix typos., Noam Postavsky, 2019/12/22
- [elpa] master 7612bc1 24/42: Don't check this-command in yas-not-string-or-comment-condition, Noam Postavsky, 2019/12/22
- [elpa] master dabc719 21/42: Don't turn on yas-minor-mode in temp buffers,
Noam Postavsky <=
- [elpa] master fc33b2f 28/42: Make overlay-modification protection optional, Noam Postavsky, 2019/12/22
- [elpa] master 048d030 22/42: Fix line-relative snapshotting for org src blocks, Noam Postavsky, 2019/12/22
- [elpa] master bae20af 27/42: ; * doc/faq.org: Linkify bug reference., Noam Postavsky, 2019/12/22
- [elpa] master ffc733d 09/42: ; Debug code fixes, Noam Postavsky, 2019/12/22
- [elpa] master 1d96da2 18/42: Don't call before/after change-functions twice, Noam Postavsky, 2019/12/22
- [elpa] master 6a3619b 23/42: Fix additional corner case with org source block integration, Noam Postavsky, 2019/12/22
- [elpa] master 9cedd59 25/42: Allow disabling snippet keybindings from hook, Noam Postavsky, 2019/12/22
- [elpa] master 55c448b 32/42: Remove redundant arg to yas-expand-snippet, Noam Postavsky, 2019/12/22
- [elpa] master 189f737 26/42: * doc/faq.org: Note that Flyspell problem is (now fixed) Emacs bug., Noam Postavsky, 2019/12/22
- [elpa] master ffce236 30/42: Do auto indentation only in post command hook, Noam Postavsky, 2019/12/22