branch: master commit 33dff9ad12ae166a49377a093bf080dc247e1578 Author: Noam Postavsky <npost...@users.sourceforge.net> Commit: Noam Postavsky <npost...@users.sourceforge.net>
let C-c C-c save existing snippets too --- yasnippet.el | 11 ++++++++--- 1 files changed, 8 insertions(+), 3 deletions(-) diff --git a/yasnippet.el b/yasnippet.el index 19c6a5a..255b5e4 100644 --- a/yasnippet.el +++ b/yasnippet.el @@ -2552,9 +2552,12 @@ When called interactively, prompt for the table name." (yas--table-name (yas--template-table yas--editing-template))))) (defun yas-load-snippet-buffer-and-close (table &optional kill) - "Load the snippet with `yas-load-snippet-buffer', offer to + "Load the snippet with `yas-load-snippet-buffer', possibly save, then `quit-window' if saved. +If the snippet is new, ask the user whether (and where) to save +it. If the snippet already has a file, just save it. + The prefix argument KILL is passed to `quit-window'. Don't use this from a Lisp program, call `yas-load-snippet-buffer' @@ -2583,8 +2586,10 @@ and `kill-buffer' instead." (write-file (concat chosen "/" (read-from-minibuffer (format "File name to create in %s? " chosen) default-file-name))) - (setf (yas--template-file yas--editing-template) buffer-file-name) - (quit-window kill)))))) + (setf (yas--template-file yas--editing-template) buffer-file-name))))) + (when buffer-file-name + (save-buffer) + (quit-window kill))) (defun yas-tryout-snippet (&optional debug) "Test current buffer's snippet template in other buffer."