Skip to content

Commit 83a0987

Browse files
committed
Refactor compile-time logic
Only compile snippets if package is being byte-compiled.
1 parent 5263254 commit 83a0987

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

doom-snippets.el

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,13 @@
2525
"snippets"
2626
(file-name-directory
2727
(cond (load-in-progress load-file-name)
28-
((and (boundp 'byte-compile-current-file) byte-compile-current-file)
28+
((bound-and-true-p byte-compile-current-file)
2929
byte-compile-current-file)
30-
(buffer-file-name))))))
30+
(buffer-file-name)))))
31+
32+
(when (bound-and-true-p byte-compile-current-file)
33+
(require 'yasnippet)
34+
(yas-compile-directory doom-snippets-dir)))
3135

3236
(defvar doom-snippets-enable-short-helpers nil
3337
"If non-nil, defines convenience aliases for doom-snippets' api.
@@ -39,10 +43,6 @@
3943
+ `%format' = `doom-snippet-format'
4044
+ `%without-trigger' = `doom-snippets-without-trigger'")
4145

42-
(eval-when-compile
43-
(require 'yasnippet)
44-
(yas-compile-directory doom-snippets-dir))
45-
4646
;;;###autoload
4747
(defun doom-snippets-remove-compiled-snippets ()
4848
"Delete all .yas-compiled-snippets.el files."

0 commit comments

Comments
 (0)