Explain about backquote expressions in doc

* doc/snippet-development.org (Embedded Emacs-lisp code): Add a subsection
explaining that backquote expressions should not modify the buffer.
This commit is contained in:
Noam Postavsky 2016-10-07 19:28:23 -04:00
parent a5e88b2fd4
commit 85a43ad8e5

View File

@ -209,7 +209,7 @@ back-quotes (=`=). The lisp forms are evaluated when the snippet is
being expanded. The evaluation is done in the same buffer as the being expanded. The evaluation is done in the same buffer as the
snippet being expanded. snippet being expanded.
Here's an example for c-mode` to calculate the header file guard Here's an example for c-mode to calculate the header file guard
dynamically: dynamically:
#+BEGIN_SRC snippet #+BEGIN_SRC snippet
@ -235,6 +235,27 @@ to "wrap" the selected region inside your recently inserted snippet.
Alternatively, you can also customize the variable Alternatively, you can also customize the variable
[[sym:yas-wrap-around-region][=yas-wrap-around-region=]] to =t= which will do this automatically. [[sym:yas-wrap-around-region][=yas-wrap-around-region=]] to =t= which will do this automatically.
*** Note: backquote expressions should not modify the buffer
Please note that the lisp forms in backquotes should *not* modify the
buffer, doing so will trigger a warning. For example, instead of
doing
#+BEGIN_SRC snippet
Timestamp: `(insert (current-time-string))`
#+END_SRC
do this:
#+BEGIN_SRC snippet
Timestamp: `(current-time-string)`
#+END_SRC
The warning may be suppressed with the following code in your init file:
#+BEGIN_SRC emacs-lisp
(add-to-list 'warning-suppress-types '(yasnippet backquote-change))
#+END_SRC
** Tab stop fields ** Tab stop fields
Tab stops are fields that you can navigate back and forth by =TAB= and Tab stops are fields that you can navigate back and forth by =TAB= and