Improve documentation for new register option

* doc/snippet-expansion.org: Add new section about
yas-wrap-around-region.
* yasnippet.el (yas-wrap-around-region): Improve docstring.
This commit is contained in:
Noam Postavsky 2016-04-26 22:37:05 -04:00
parent ccc9adc3c4
commit c1b2cb7c5e
2 changed files with 16 additions and 1 deletions

View File

@ -83,6 +83,19 @@ snippets for the major mode, prefix this command with =C-u=.
The prompting methods used are again controlled by
[[sym:yas-prompt-functions][=yas-prompt-functions=]].
*** Inserting region or register contents into snippet
It's often useful to inject already written text in the middle of a
snippet. The variable [[sym:yas-wrap-around-region][=yas-wrap-around-region=]] when to t substitute
the region contents into the =$0= placeholder of a snippet expanded by
[[#yas-insert-snippet][=yas-insert-snippet=]]. Setting it to a character value (e.g. =?0=)
will insert the contents of corresponding register.
Older (versions 0.9.1 and below) of Yasnippet, supported a setting of
=cua= that is equivalent to =?0= but only worked with =cua-mode=
turned on. This setting is still supported for backwards
compatibility, but is now entirely equivalent to =?0=.
** Snippet keybinding
See the section of the =# binding:= directive in

View File

@ -349,7 +349,9 @@ Any other non-nil value, every submenu is listed."
"What to insert for snippet's $0 field.
If set to a character, insert contents of corresponding register.
If non-nil insert region contents."
If non-nil insert region contents. This can be overridden on a
per-snippet basis. A value of `cua' is considered equivalent to
`?0' for backwards compatibility."
:type '(choice (character :tag "Insert from register")
(const t :tag "Insert region contents")
(const nil :tag "Don't insert anything")