diff --git a/doc/changelog.html b/doc/changelog.html index b601c7d..7ca1bf9 100644 --- a/doc/changelog.html +++ b/doc/changelog.html @@ -3,7 +3,7 @@ - + ChangeLog @@ -355,6 +355,16 @@ details. + + diff --git a/doc/define_snippet.html b/doc/define_snippet.html index a17537f..984d3db 100644 --- a/doc/define_snippet.html +++ b/doc/define_snippet.html @@ -3,7 +3,7 @@ - + Moved @@ -63,6 +63,16 @@ does not automatically redirect you

+ + diff --git a/doc/faq.html b/doc/faq.html index 45b0737..705f49c 100644 --- a/doc/faq.html +++ b/doc/faq.html @@ -3,7 +3,7 @@ - + Frequently Asked Questions @@ -132,8 +132,26 @@ latter's priority pro emacs-lisp and can solve this problem, drop a line in the discussion group.

+
+

How do I turn off the minor mode where in some buffers

+

The best way, since version 0.6.1c, is to set the default value of the +variable yas/dont-activate to a lambda function like so:

+
(set-default 'yas/dont-activate
+           #'(lambda ()
+               (and yas/root-directory
+                    (null (yas/get-snippet-tables)))))
+
+

This is also the default value starting for that version. It skips the +minor mode in buffers where it is not applicable (no snippet tables), +but only once you have setup your yas/root-directory.

+

How do I define an abbrev key containing characters not supported by the filesystem?

+
+
Note: This question applies if you're still defining snippets
+
whose key is the filename. This is behavior stil provided by +version 0.6 for backward compatibilty, but is somewhat deprecated...
+

For example, you want to define a snippet by the key < which is not a valid character for filename on Windows. This means you can't use the filename as a trigger key in this case.

@@ -153,6 +171,16 @@ valid filename, lt.yasnippet
+ + diff --git a/doc/faq.rst b/doc/faq.rst index 65e9a78..ab799ea 100644 --- a/doc/faq.rst +++ b/doc/faq.rst @@ -1,6 +1,6 @@ -========================== -Frequently Asked Questions -========================== +============================ + Frequently Asked Questions +============================ Why is there an extra newline? ============================== @@ -102,9 +102,31 @@ latter's ``priority`` property to something big. If you know emacs-lisp and can solve this problem, drop a line in the `discussion group`_. +How do I turn off the minor mode where in some buffers +====================================================== + +The best way, since version 0.6.1c, is to set the default value of the +variable ``yas/dont-activate`` to a lambda function like so: + +.. sourcecode:: lisp + + (set-default 'yas/dont-activate + #'(lambda () + (and yas/root-directory + (null (yas/get-snippet-tables))))) + +This is also the default value starting for that version. It skips the +minor mode in buffers where it is not applicable (no snippet tables), +but only once you have setup your yas/root-directory. + + How do I define an abbrev key containing characters not supported by the filesystem? ==================================================================================== +**Note**: This question applies if you're still defining snippets + whose key *is* the filename. This is behavior stil provided by + version 0.6 for backward compatibilty, but is somewhat deprecated... + For example, you want to define a snippet by the key ``<`` which is not a valid character for filename on Windows. This means you can't use the filename as a trigger key in this case. diff --git a/doc/index.html b/doc/index.html index 54edc54..182d227 100644 --- a/doc/index.html +++ b/doc/index.html @@ -3,7 +3,7 @@ - + Yet Another Snippet extension @@ -186,6 +186,16 @@ including snippets, please post to the + var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www."); + document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E")); + + diff --git a/doc/snippet-development.html b/doc/snippet-development.html index bb68132..953169d 100644 --- a/doc/snippet-development.html +++ b/doc/snippet-development.html @@ -3,7 +3,7 @@ - + Writing snippets @@ -597,6 +597,16 @@ that.

+ + diff --git a/doc/snippet-expansion.html b/doc/snippet-expansion.html index d22b25e..93c0533 100644 --- a/doc/snippet-expansion.html +++ b/doc/snippet-expansion.html @@ -415,6 +415,16 @@ Emacs's syntax rule mean.

+ + diff --git a/doc/snippet-menu.html b/doc/snippet-menu.html index c6802c3..b91f1b9 100644 --- a/doc/snippet-menu.html +++ b/doc/snippet-menu.html @@ -126,6 +126,16 @@ variables.

+ + diff --git a/doc/snippet-organization.html b/doc/snippet-organization.html index 9873066..b61c6e4 100644 --- a/doc/snippet-organization.html +++ b/doc/snippet-organization.html @@ -273,6 +273,16 @@ trigger.

+ + diff --git a/doc/template.txt b/doc/template.txt index 7ed318a..e01d73d 100644 --- a/doc/template.txt +++ b/doc/template.txt @@ -54,4 +54,14 @@ + + %(body_suffix)s diff --git a/yasnippet.el b/yasnippet.el index 95d4b08..7f7df15 100644 --- a/yasnippet.el +++ b/yasnippet.el @@ -649,27 +649,27 @@ Here's an example: ["Wrap region in exit marker" (setq yas/wrap-around-region (not yas/wrap-around-region)) - :help "If t automatically wrap the selected text in the $0 snippet exit" + :help "If non-nil automatically wrap the selected text in the $0 snippet exit" :style toggle :selected yas/wrap-around-region] ["Allow stacked expansions " (setq yas/triggers-in-field (not yas/triggers-in-field)) - :help "If t allow snippets to be triggered inside other snippet fields" + :help "If non-nil allow snippets to be triggered inside other snippet fields" :style toggle :selected yas/triggers-in-field] ["Revive snippets on undo " (setq yas/snippet-revival (not yas/snippet-revival)) - :help "If t allow snippets to become active again after undo" + :help "If non-nil allow snippets to become active again after undo" :style toggle :selected yas/snippet-revival] ["Good grace " (setq yas/good-grace (not yas/good-grace)) - :help "If t don't raise errors in bad embedded eslip in snippets" + :help "If non-nil don't raise errors in bad embedded eslip in snippets" :style toggle :selected yas/good-grace] ["Ignore filenames as triggers" (setq yas/ignore-filenames-as-triggers (not yas/ignore-filenames-as-triggers)) - :help "If t don't derive tab triggers from filenames" + :help "If non-nil don't derive tab triggers from filenames" :style toggle :selected yas/ignore-filenames-as-triggers] ) "----" @@ -737,7 +737,9 @@ Key bindings: (> (hash-table-count yas/snippet-tables) 0)) (yas/reload-all)))) -(defvar yas/dont-activate nil +(defvar yas/dont-activate #'(lambda () + (and yas/root-directory + (null (yas/get-snippet-tables)))) "If non-nil don't let `yas/minor-mode-on' active yas for this buffer. `yas/minor-mode-on' is usually called by `yas/global-mode' so @@ -752,8 +754,10 @@ behaviour.") Do this unless `yas/dont-activate' is t or the function `yas/get-snippet-tables' (which see), returns an empty list." (interactive) - (unless (or yas/dont-activate - (null (yas/get-snippet-tables))) + (unless (or (and (functionp yas/dont-activate) + (funcall yas/dont-activate)) + (and (not (functionp yas/dont-activate)) + yas/dont-activate)) (yas/minor-mode 1))) (defun yas/minor-mode-off ()