mirror of
https://github.com/joaotavora/yasnippet.git
synced 2025-10-13 13:13:03 +00:00
Use new name of python-in-string/comment in docs
* doc/snippet-expansion.org: * yasnippet.el (yas-buffer-local-condition): python.el renames python-in-string/comment to python-syntax-comment-or-string-p. Modify the documentation to reflect that. Copyright-paperwork-exempt: yes Close #725
This commit is contained in:
parent
5af9276f21
commit
7e0a0de499
@ -193,11 +193,11 @@ block or a string (e.g. in =python-mode=).
|
||||
|
||||
If you use the =# condition := directive (see
|
||||
[[./snippet-development.org][Writing Snippets]]) you could just specify
|
||||
the condition for =if= to be =(not (python-in-string/comment))=. But how
|
||||
the condition for =if= to be =(not (python-syntax-comment-or-string-p))=. But how
|
||||
about =while=, =for=, etc. ? Writing the same condition for all the
|
||||
snippets is just boring. So has a buffer local variable
|
||||
[[sym:yas-buffer-local-condition][=yas-buffer-local-condition=]]. You can set this variable to
|
||||
=(not (python-in-string/comment))= in =python-mode-hook=.
|
||||
=(not (python-syntax-comment-or-string-p))= in =python-mode-hook=.
|
||||
|
||||
Then, what if you really want some particular snippet to expand even
|
||||
inside a comment? Set [[sym:yas-buffer-local-condition][=yas-buffer-local-condition=]] like this
|
||||
@ -206,7 +206,7 @@ inside a comment? Set [[sym:yas-buffer-local-condition][=yas-buffer-local-condit
|
||||
(add-hook 'python-mode-hook
|
||||
(lambda ()
|
||||
(setq yas-buffer-local-condition
|
||||
'(if (python-in-string/comment)
|
||||
'(if (python-syntax-comment-or-string-p)
|
||||
'(require-snippet-condition . force-in-comment)
|
||||
t))))
|
||||
#+END_SRC
|
||||
|
@ -522,7 +522,7 @@ conditions.
|
||||
(add-hook \\='python-mode-hook
|
||||
(lambda ()
|
||||
(setq yas-buffer-local-condition
|
||||
\\='(if (python-in-string/comment)
|
||||
\\='(if (python-syntax-comment-or-string-p)
|
||||
\\='(require-snippet-condition . force-in-comment)
|
||||
t))))
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user