-
-
Notifications
You must be signed in to change notification settings - Fork 36
Automatic Rebuilding of Packages on Restart
By default, elpaca clones package repositories to [user-emacs-directory]/[elpaca-directory]/[elpaca-repos-directory]
.
A common value for this path is ~/.emacs/elpaca/repos
. Built packages are then elpaca-builds-directory
which is very commonly ~/.emacs/elpaca/builds
.
A common development practice for emacs packages might be to work directly in a repository in ~/.emacs/elpaca/repos
. Changes to that source code, however, will not take effect until M-x elpaca-rebuild
is called for that package. This can be an annoying thing to remember to do for every source code change you test.
A workaround for this is shown in a comment in issue 368.
To summarize:
Declare the function
(defun +elpaca/build-if-new (e)
(setf (elpaca<-build-steps e)
(if-let ((default-directory (elpaca<-build-dir e))
(main (ignore-errors (elpaca--main-file e)))
(compiled (expand-file-name (concat (file-name-base main) ".elc")))
((file-newer-than-file-p main compiled)))
(progn (elpaca--signal e "Rebuilding due to source changes")
(cl-set-difference elpaca-build-steps
'(elpaca--clone elpaca--configure-remotes elpaca--checkout-ref)))
(elpaca--build-steps nil (file-exists-p (elpaca<-build-dir e))
(file-exists-p (elpaca<-repo-dir e)))))
(elpaca--continue-build e))
and then
(elpaca (doct :host github :repo "progfolio/doct" :build (+elpaca/build-if-new)))
will install progfolio/doct
, but then if you manually make changes to the source code in ~/.emacs/elpaca/repos/doct
, doct
will be automatically rebuilt when you restart emacs, so you don't have to do the rebuild manually each time.
With use-package
:
(use-package doct
:ensure (:host github :repo "progfolio/doct" :build (+elpaca/build-if-new)))