mirror of
https://github.com/joaotavora/yasnippet.git
synced 2026-02-04 06:32:24 +00:00
* yasnippet.el (yas-buffer-local-condition): Accept functions
(yas-not-string-or-comment-condition): Make it a function. (yas--funcall-condition): Rename from `yas--funcall-condition`, change its calling convention. (yas--template-can-expand-p, yas--describe-pretty-table): Adjust accordingly. (yas--require-template-specific-condition-p): Add support for functions in `yas-buffer-local-condition`. * doc/snippet-expansion.org (The condition system <<condition-system>>): Adjust example to avoid quoted code.
This commit is contained in:
@@ -210,11 +210,12 @@ inside a comment? Set [[sym:yas-buffer-local-condition][=yas-buffer-local-condi
|
||||
|
||||
#+BEGIN_SRC emacs-lisp
|
||||
(add-hook 'python-mode-hook
|
||||
(lambda ()
|
||||
(setq yas-buffer-local-condition
|
||||
'(if (python-syntax-comment-or-string-p)
|
||||
'(require-snippet-condition . force-in-comment)
|
||||
t))))
|
||||
(lambda ()
|
||||
(setq yas-buffer-local-condition
|
||||
(lambda ()
|
||||
(if (python-syntax-comment-or-string-p)
|
||||
'(require-snippet-condition . force-in-comment)
|
||||
t)))))
|
||||
#+END_SRC
|
||||
|
||||
... and for a snippet that you want to expand in comments, specify a
|
||||
|
||||
Reference in New Issue
Block a user