diff --git a/core/lib/defuns-compile.el b/core/lib/defuns-compile.el index a1f20224a..53d3d4cd0 100644 --- a/core/lib/defuns-compile.el +++ b/core/lib/defuns-compile.el @@ -3,14 +3,16 @@ ;; (eval-when-compile (require 'core)) ;;;###autoload -(defun narf/is-compilable-p () +(defun narf/is-recompilable-p () + "Does an .elc file exist and is this file in the .emacs.d folder?" (let ((file-name (buffer-file-name))) ;; TODO Detect init.el and init-load-path.el - (--any? (f-child-of? file-name it) - (append (list narf-core-dir narf-contrib-dir) - (list (concat narf-modules-dir "lib/") - (concat narf-core-dir "lib/")) - (list narf-modules-dir narf-private-dir))))) + (and (f-exists? (f-expand (concat (f-base file-name) ".elc") (f-dirname file-name))) + (--any? (f-child-of? file-name it) + (append (list narf-core-dir narf-contrib-dir) + (list (concat narf-modules-dir "lib/") + (concat narf-core-dir "lib/")) + (list narf-modules-dir narf-private-dir)))))) ;;;###autoload (autoload 'narf:compile-el "defuns-compile" nil t) (evil-define-command narf:compile-el (&optional bang) diff --git a/modules/module-elisp.el b/modules/module-elisp.el index a52179743..9bb1e8eda 100644 --- a/modules/module-elisp.el +++ b/modules/module-elisp.el @@ -8,7 +8,7 @@ (setq mode-name "Elisp")) (defun narf-elisp-auto-compile () - (when (narf/is-compilable-p) + (when (narf/is-recompilable-p) (narf:compile-el))) (add-hook! emacs-lisp-mode