mirror of
https://github.com/joaotavora/yasnippet.git
synced 2025-10-14 05:23:04 +00:00
bugfix: yas/recompile-directory-maybe messed up sometimes
This commit is contained in:
parent
209cf81f04
commit
4713bba467
11
yasnippet.el
11
yasnippet.el
@ -1684,8 +1684,10 @@ Optional USE-JIT use jit-loading of snippets."
|
|||||||
(secure-hash 'md5 (mapconcat #'(lambda (c) (format "%s%f" (car c) (float-time (cdr c)))) files-and-mtimes " ")))
|
(secure-hash 'md5 (mapconcat #'(lambda (c) (format "%s%f" (car c) (float-time (cdr c)))) files-and-mtimes " ")))
|
||||||
|
|
||||||
(defun yas/recompile-directory-maybe (directory mode-sym)
|
(defun yas/recompile-directory-maybe (directory mode-sym)
|
||||||
(flet ((recompile () (yas/with-compilation-flets
|
(flet ((recompile ()
|
||||||
(yas/load-directory-2 directory mode-sym)))
|
(yas/with-compilation-flets
|
||||||
|
(yas/compile-directory-1 directory mode-sym))
|
||||||
|
(yas/message 2 ".yas-compiled-snippet.el out of date. Recompiling %s" directory))
|
||||||
(most-recent-mtime (mtimes) (reduce #'(lambda (t1 t2)
|
(most-recent-mtime (mtimes) (reduce #'(lambda (t1 t2)
|
||||||
(if (time-less-p t1 t2) t2 t1))
|
(if (time-less-p t1 t2) t2 t1))
|
||||||
mtimes)))
|
mtimes)))
|
||||||
@ -1700,18 +1702,19 @@ Optional USE-JIT use jit-loading of snippets."
|
|||||||
((null compiled)
|
((null compiled)
|
||||||
(recompile))
|
(recompile))
|
||||||
((let* ((files-and-mtimes (yas/compile-snippet-files-and-mtimes directory)))
|
((let* ((files-and-mtimes (yas/compile-snippet-files-and-mtimes directory)))
|
||||||
|
(and files-and-mtimes
|
||||||
(or (time-less-p (nth 5 (file-attributes compiled))
|
(or (time-less-p (nth 5 (file-attributes compiled))
|
||||||
(most-recent-mtime (mapcar #'cdr files-and-mtimes)))
|
(most-recent-mtime (mapcar #'cdr files-and-mtimes)))
|
||||||
(not (string= (yas/compile-calculate-md5 files-and-mtimes)
|
(not (string= (yas/compile-calculate-md5 files-and-mtimes)
|
||||||
(with-temp-buffer
|
(with-temp-buffer
|
||||||
(insert-file-contents compiled)
|
(insert-file-contents compiled)
|
||||||
(when (search-forward-regexp "md5:[[:space:]]\\(.*\\)" nil 'noerror)
|
(when (search-forward-regexp "md5:[[:space:]]\\(.*\\)" nil 'noerror)
|
||||||
(match-string 1)))))))
|
(match-string 1))))))))
|
||||||
(recompile))
|
(recompile))
|
||||||
(t ; do not recompile
|
(t ; do not recompile
|
||||||
))
|
))
|
||||||
(when (and compiled
|
(when (and compiled
|
||||||
(load (file-name-sans-extension compiled) 'noerror (<= yas/verbosity 2)))
|
(load (expand-file-name (file-name-sans-extension compiled)) 'noerror (<= yas/verbosity 2)))
|
||||||
(yas/message 2 "Loading much faster .yas-compiled-snippets from %s" directory)
|
(yas/message 2 "Loading much faster .yas-compiled-snippets from %s" directory)
|
||||||
t))))
|
t))))
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user