Fix #597; use SAVE-FILE to visit compiled snippets

Rename the existing FILE field to LOAD-FILE, and add a new SAVE-FILE to
yas--template struct.  Normally they will be the same, but compiled
snippets have only SAVE-FILE because they are loaded by "compiled" code.

* yasnippet.el (yas--template): Remove field file, add load-file and
  save-file.
(yas--parse-template): Update snippet-definition list in docstrings.
(yas-define-snippets): Move LOAD-FILE value to SAVE-FILE when compiling.
(yas--template-get-file): New function.
(yas--visit-snippet-file-1, yas-load-snippet-buffer,
yas-load-snippet-buffer-and-close): Use yas--template-load-file,
yas--template-save-file, or yas--template-get-file, as appropriate.
* doc/snippet-organization.org (The =.yas-compiled-snippet.el= file):
  Remove caveat that is no longer relevant.
This commit is contained in:
Noam Postavsky
2015-09-04 20:19:52 -04:00
parent cc1c758ab7
commit 215ad9bcf2
2 changed files with 44 additions and 41 deletions

View File

@@ -123,14 +123,6 @@
Alternatively, you may compile all directories in the list
=yas-snippet-dirs= with the =yas-recompile-all= function.
*Caveat.* At the moment, when you try to use the
=yas-visit-snippet-file= function to edit a compiled snippet loaded
from a =.yas-compiled-snippets.el= file, the content of the snippet
will be opened in a buffer, but it might not be a verbatim copy of
your original snippet, and =yas-load-snippet-buffer-and-close=
won't offer to save to the original snippet file. See
[[https://github.com/capitaomorte/yasnippet/issues/597][#597]].
* TODO The =.yas-skip= file
** TODO