Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion yasnippet.el
Original file line number Diff line number Diff line change
Expand Up @@ -383,6 +383,10 @@ the trigger key itself."
It must be set to nil before loading yasnippet to take effect."
:type 'boolean)

(defcustom yas-default-filename-transform-function #'default
"Transform the snippet name to a filename."
:type 'function)

;; Only two faces, and one of them shouldn't even be used...
;;
(defface yas-field-highlight-face
Expand Down Expand Up @@ -2807,7 +2811,7 @@ and `kill-buffer' instead."
(yas--table-name (yas--template-table template)))))
(let ((default-directory (car (cdr (car (yas--guess-snippet-directories
(yas--template-table template))))))
(default-file-name (yas--template-name template)))
(default-file-name (funcall yas-default-filename-transform-function (yas--template-name template))))
(unless (or buffer-file-name (not default-file-name))
(setq buffer-file-name
(read-file-name "File to save snippet in: "
Expand Down