[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] master bd30a30 04/36: yas-dont-activate is a hook
From: |
Noam Postavsky |
Subject: |
[elpa] master bd30a30 04/36: yas-dont-activate is a hook |
Date: |
Sat, 11 Jun 2016 19:21:09 +0000 (UTC) |
branch: master
commit bd30a30d88bd78c5a47b479c3bcaf3c540810541
Author: Stefan Monnier <address@hidden>
Commit: Noam Postavsky <address@hidden>
yas-dont-activate is a hook
* yasnippet.el (yas-dont-activate-functions): Rename from yas-dont-activate.
(yas-minor-mode-on): Use run-hook-with-args-until-success instead of
funcall.
---
yasnippet.el | 33 ++++++++++++++++-----------------
1 file changed, 16 insertions(+), 17 deletions(-)
diff --git a/yasnippet.el b/yasnippet.el
index a5a9690..9bdb5f9 100644
--- a/yasnippet.el
+++ b/yasnippet.el
@@ -827,21 +827,20 @@ activate snippets associated with that mode."
(remove mode
yas--extra-modes)))
-(defvar yas-dont-activate '(minibufferp)
- "If non-nil don't let `yas-global-mode' affect some buffers.
-
-If a function of zero arguments, then its result is used.
-
-If a list of functions, then all functions must return nil to
-activate yas for this buffer.
-
-In Emacsen <= 23, this variable is buffer-local. Because
+(define-obsolete-variable-alias 'yas-dont-activate
+ 'yas-dont-activate-functions "0.9.2")
+(defvar yas-dont-activate-functions (list #'minibufferp)
+ "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.
+
+In Emacsen < 24, this variable is buffer-local. Because
`yas-minor-mode-on' is called by `yas-global-mode' after
executing the buffer's major mode hook, setting this variable
there is an effective way to define exceptions to the \"global\"
activation behaviour.
-In Emacsen > 23, only the global value is used. To define
+In Emacsen >= 24, only the global value is used. To define
per-mode exceptions to the \"global\" activation behaviour, call
`yas-minor-mode' with a negative argument directily in the major
mode's hook.")
@@ -853,14 +852,14 @@ mode's hook.")
(defun yas-minor-mode-on ()
"Turn on YASnippet minor mode.
-Honour `yas-dont-activate', which see."
+Honour `yas-dont-activate-functions', which see."
(interactive)
- ;; Check `yas-dont-activate'
- (unless (cond ((functionp yas-dont-activate)
- (funcall yas-dont-activate))
- ((consp yas-dont-activate)
- (some #'funcall yas-dont-activate))
- (yas-dont-activate))
+ (unless (or
+ ;; The old behavior used for Emacs<24 was to set
+ ;; `yas-dont-activate-functions' to t buffer-locally.
+ (not (or (listp yas-dont-activate-functions)
+ (functionp yas-dont-activate-functions)))
+ (run-hook-with-args-until-success 'yas-dont-activate-functions))
(yas-minor-mode 1)))
;;;###autoload
- [elpa] master 7799aa9 09/36: Document .yas-setup.el, (continued)
- [elpa] master 7799aa9 09/36: Document .yas-setup.el, Noam Postavsky, 2016/06/11
- [elpa] master 4f2aa15 05/36: Only kill snippets for text length change, Noam Postavsky, 2016/06/11
- [elpa] master 8771082 03/36: Don't add useless kill ring entries, Noam Postavsky, 2016/06/11
- [elpa] master cc14db3 11/36: Refactor yas-next-field a bit, Noam Postavsky, 2016/06/11
- [elpa] master db4cd31 20/36: Delete active region for trigger key expansion, Noam Postavsky, 2016/06/11
- [elpa] master e37ce9e 18/36: Disable region wrapping for trigger key expansion, Noam Postavsky, 2016/06/11
- [elpa] master 6180cc4 28/36: Fix field transform application in yas-next-field, Noam Postavsky, 2016/06/11
- [elpa] master 146b161 25/36: Don't indent empty lines in snippet expansion, Noam Postavsky, 2016/06/11
- [elpa] master e9406f5 26/36: Document $> and fix escaping, Noam Postavsky, 2016/06/11
- [elpa] master 6f97316 27/36: Fix outdated and misformatted docs, Noam Postavsky, 2016/06/11
- [elpa] master bd30a30 04/36: yas-dont-activate is a hook,
Noam Postavsky <=
- [elpa] master c1b2cb7 17/36: Improve documentation for new register option, Noam Postavsky, 2016/06/11
- [elpa] master 4c6064c 01/36: Avoid potential problems with user's hooks, Noam Postavsky, 2016/06/11
- [elpa] master 5d44a9f 19/36: Revert "Disable region wrapping for trigger key expansion", Noam Postavsky, 2016/06/11
- [elpa] master beb2ba4 21/36: Fix fields following $0 + region insertion, Noam Postavsky, 2016/06/11
- [elpa] master eeb4b62 14/36: Add new tests for multi-line mirror indentation, Noam Postavsky, 2016/06/11
- [elpa] master 78fe979 22/36: Support htmlize.el in Rakefile doc target, Noam Postavsky, 2016/06/11
- [elpa] master 7f03a23 07/36: Change Emacs installation method for Travis CI, Noam Postavsky, 2016/06/11
- [elpa] master 0d79e69 30/36: Extra measures to prevent premature yas-minor-mode, Noam Postavsky, 2016/06/11
- [elpa] master 497867c 32/36: Rename yas-backport-obsolete-alias, Noam Postavsky, 2016/06/11
- [elpa] master e23a053 34/36: Avoid bug in insert-file-contents with REPLACE=t, Noam Postavsky, 2016/06/11