9

When I use yasnippet, I keep getting this error:

Warning (yasnippet): `foo-snippet' modified buffer in a backquote expression.
To hide this warning, add (yasnippet backquote-change) to `warning-suppress-types'.

I added this line to my config:

(setq warning-suppress-types (quote ((\(yasnippet\ backquote-change\))))) 

But it doesn't seem to have worked.

incandescentman
  • 4,111
  • 16
  • 53

2 Answers2

13

warning-suppress-types is a list defined in the warnings package. You first need to load this package with:

(require 'warnings)

and after this, add the warning using add-to-list:

(add-to-list 'warning-suppress-types '(yasnippet backquote-change))
Mark
  • 828
  • 10
  • 15
Gastove
  • 1,511
  • 9
  • 15
  • 1
    I added that line but I'm getting an error: http://dixit.ca/stackexchange/backquote.html – incandescentman Jul 11 '16 at 19:42
  • 1
    This is the error I get: `Debugger entered--Lisp error: (void-variable warning-suppress-types) (member (quote (yasnippet backquote-change))` – incandescentman Jul 12 '16 at 04:20
  • What version of emacs are you on? – Gastove Jul 13 '16 at 16:46
  • GNU Emacs 24.5.1 (x86_64-apple-darwin15.5.0, Carbon Version 157 AppKit 1404.47) – incandescentman Jul 13 '16 at 21:47
  • 2
    Apologies, I have no idea what's causing that for you -- that variable _should_ be baked in to Emacs after 22.1, by my understanding. What do you get if you remove that erroring line, start Emacs, and do `M-x describe-variable warning-suppress-types `? – Gastove Jul 15 '16 at 17:00
  • 1
    I think this should be wrapped in `(eval-after-load 'warnings ...)`, or needs a `(require 'warnings)` first. – npostavs Jun 14 '17 at 17:50
2

Alternate answer is to fix foo-snippet so that it no longer modifies the buffer in backquote expression. See https://emacs.stackexchange.com/a/24062/5296 for some examples.

Also note that there was a bug causing yasnippet to issue this warning even when other buffers were being modified, so make sure you have the latest yasnippet (or else the current stable release (0.10) which doesn't have this warning at all). See https://github.com/joaotavora/yasnippet/issues/716

npostavs
  • 9,033
  • 1
  • 21
  • 53