Less aggressive auto-compile (only recompile)

This commit is contained in:
Henrik Lissner 2015-06-24 15:47:25 +02:00
parent 5690b75c07
commit b0d0794d3f
2 changed files with 9 additions and 7 deletions

View file

@ -3,14 +3,16 @@
;; (eval-when-compile (require 'core)) ;; (eval-when-compile (require 'core))
;;;###autoload ;;;###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))) (let ((file-name (buffer-file-name)))
;; TODO Detect init.el and init-load-path.el ;; TODO Detect init.el and init-load-path.el
(--any? (f-child-of? file-name it) (and (f-exists? (f-expand (concat (f-base file-name) ".elc") (f-dirname file-name)))
(append (list narf-core-dir narf-contrib-dir) (--any? (f-child-of? file-name it)
(list (concat narf-modules-dir "lib/") (append (list narf-core-dir narf-contrib-dir)
(concat narf-core-dir "lib/")) (list (concat narf-modules-dir "lib/")
(list narf-modules-dir narf-private-dir))))) (concat narf-core-dir "lib/"))
(list narf-modules-dir narf-private-dir))))))
;;;###autoload (autoload 'narf:compile-el "defuns-compile" nil t) ;;;###autoload (autoload 'narf:compile-el "defuns-compile" nil t)
(evil-define-command narf:compile-el (&optional bang) (evil-define-command narf:compile-el (&optional bang)

View file

@ -8,7 +8,7 @@
(setq mode-name "Elisp")) (setq mode-name "Elisp"))
(defun narf-elisp-auto-compile () (defun narf-elisp-auto-compile ()
(when (narf/is-compilable-p) (when (narf/is-recompilable-p)
(narf:compile-el))) (narf:compile-el)))
(add-hook! emacs-lisp-mode (add-hook! emacs-lisp-mode