branch: master commit 85a43ad8e5981b75945a87df162e210bea8947dc Author: Noam Postavsky <npost...@users.sourceforge.net> Commit: Noam Postavsky <npost...@users.sourceforge.net>
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. --- doc/snippet-development.org | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/doc/snippet-development.org b/doc/snippet-development.org index 4fd293d..ffe648c 100644 --- a/doc/snippet-development.org +++ b/doc/snippet-development.org @@ -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 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: #+BEGIN_SRC snippet @@ -235,6 +235,27 @@ to "wrap" the selected region inside your recently inserted snippet. Alternatively, you can also customize the variable [[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 stops are fields that you can navigate back and forth by =TAB= and