mirror of
https://github.com/joaotavora/yasnippet.git
synced 2025-10-13 21:13:04 +00:00
let C-c C-c save existing snippets too
This commit is contained in:
parent
205b0e6970
commit
33dff9ad12
11
yasnippet.el
11
yasnippet.el
@ -2552,9 +2552,12 @@ When called interactively, prompt for the table name."
|
|||||||
(yas--table-name (yas--template-table yas--editing-template)))))
|
(yas--table-name (yas--template-table yas--editing-template)))))
|
||||||
|
|
||||||
(defun yas-load-snippet-buffer-and-close (table &optional kill)
|
(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.
|
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'.
|
The prefix argument KILL is passed to `quit-window'.
|
||||||
|
|
||||||
Don't use this from a Lisp program, call `yas-load-snippet-buffer'
|
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 "/"
|
(write-file (concat chosen "/"
|
||||||
(read-from-minibuffer (format "File name to create in %s? " chosen)
|
(read-from-minibuffer (format "File name to create in %s? " chosen)
|
||||||
default-file-name)))
|
default-file-name)))
|
||||||
(setf (yas--template-file yas--editing-template) buffer-file-name)
|
(setf (yas--template-file yas--editing-template) buffer-file-name)))))
|
||||||
(quit-window kill))))))
|
(when buffer-file-name
|
||||||
|
(save-buffer)
|
||||||
|
(quit-window kill)))
|
||||||
|
|
||||||
(defun yas-tryout-snippet (&optional debug)
|
(defun yas-tryout-snippet (&optional debug)
|
||||||
"Test current buffer's snippet template in other buffer."
|
"Test current buffer's snippet template in other buffer."
|
||||||
|
Loading…
x
Reference in New Issue
Block a user