Skip to content

Commit

Permalink
automatic snippet compilation
Browse files Browse the repository at this point in the history
  • Loading branch information
mattfidler committed Jun 29, 2012
1 parent 275ac7f commit 565dc5c
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions yasnippet.el
Expand Up @@ -401,6 +401,11 @@ the trigger key itself."
:type '(repeat function)
:group 'yasnippet)

(defcustom yas/compile-on-load-dir t
"Defines if the snippets should be compiled when loading (if they are not already compiled)."
:type 'boolean
:group 'yasnippet)

;; Only two faces, and one of them shouldn't even be used...
;;
(defface yas/field-highlight-face
Expand Down Expand Up @@ -1671,6 +1676,13 @@ Optional USE-JIT use jit-loading of snippets."
(defun yas/load-directory-1 (directory mode-sym parents &optional no-compiled-snippets)
"Recursively load snippet templates from DIRECTORY."
(unless (file-exists-p (concat directory "/" ".yas-skip"))
(when (and (not no-compiled-snippets) yas/compile-on-load-dir
(not (or
(file-exists-p (expand-file-name ".yas-compiled-snippets.el" directory))
(file-exists-p (expand-file-name ".yas-compiled-snippets.elc" directory)))))
(yas/message 3 "Compiling snippets for %s!" directory)
(yas/compile-directory directory))

(if (and (not no-compiled-snippets)
(load (expand-file-name ".yas-compiled-snippets" directory) 'noerror (<= yas/verbosity 2)))
(yas/message 2 "Loading much faster .yas-compiled-snippets from %s" directory)
Expand Down

0 comments on commit 565dc5c

Please sign in to comment.