Avoid bug in insert-file-contents with REPLACE=t

* yasnippet.el (yas--load-directory-2): Call `erase-buffer' before
`insert-file-contents' instead of passing non-nil REPLACE, avoids Emacs
bug #23659.

Fixes #707.
This commit is contained in:
Noam Postavsky 2016-05-30 20:21:19 -04:00
parent 47dbe93d86
commit e23a053b00

View File

@ -1805,7 +1805,10 @@ With prefix argument USE-JIT do jit-loading of snippets."
(with-temp-buffer
(dolist (file (yas--subdirs directory 'no-subdirs-just-files))
(when (file-readable-p file)
(insert-file-contents file nil nil nil t)
;; Erase the buffer instead of passing non-nil REPLACE to
;; `insert-file-contents' (avoids Emacs bug #23659).
(erase-buffer)
(insert-file-contents file)
(push (yas--parse-template file)
snippet-defs))))
(when snippet-defs