Fix literate tangling on 'doom sync'

Relevant to #3746
This commit is contained in:
Henrik Lissner 2020-08-25 06:01:35 -04:00
parent bdbeb8f507
commit 63a03848a3
No known key found for this signature in database
GPG key ID: 5F6C0EA160557395
5 changed files with 34 additions and 35 deletions

View file

@ -3,7 +3,7 @@
:; case "$EMACS" in *term*) EMACS=emacs ;; *) EMACS="${EMACS:-emacs}" ;; esac :; case "$EMACS" in *term*) EMACS=emacs ;; *) EMACS="${EMACS:-emacs}" ;; esac
:; export __DOOMPOST="${TMPDIR:-/tmp}/doom.sh" :; export __DOOMPOST="${TMPDIR:-/tmp}/doom.sh"
:; $EMACS --version >/dev/null 2>&1 || { >&2 echo "Can't find emacs in your PATH"; exit 1; } :; $EMACS --version >/dev/null 2>&1 || { >&2 echo "Can't find emacs in your PATH"; exit 1; }
:; $EMACS --no-site-file --script "$0" -- "$@"; __DOOMCODE=$? :; $EMACS --no-site-file --script "$0" -- "$@" || __DOOMCODE=$?
:; [ "$__DOOMCODE" -eq 128 ] && { "$__DOOMPOST" "$0" "$@"; __DOOMCODE=$?; } :; [ "$__DOOMCODE" -eq 128 ] && { "$__DOOMPOST" "$0" "$@"; __DOOMCODE=$?; }
:; exit $__DOOMCODE :; exit $__DOOMCODE

View file

@ -18,6 +18,7 @@ recompile. Run this whenever you:
It will ensure that unneeded packages are removed, all needed packages are It will ensure that unneeded packages are removed, all needed packages are
installed, autoloads files are up-to-date and no byte-compiled files have gone installed, autoloads files are up-to-date and no byte-compiled files have gone
stale." stale."
(run-hooks 'doom-sync-pre-hook)
(add-hook 'kill-emacs-hook #'doom--cli-abort-warning-h) (add-hook 'kill-emacs-hook #'doom--cli-abort-warning-h)
(print! (start "Synchronizing your config with Doom Emacs...")) (print! (start "Synchronizing your config with Doom Emacs..."))
(unwind-protect (unwind-protect
@ -26,7 +27,6 @@ stale."
(when (and (not no-envvar-p) (when (and (not no-envvar-p)
(file-exists-p doom-env-file)) (file-exists-p doom-env-file))
(doom-cli-reload-env-file 'force)) (doom-cli-reload-env-file 'force))
(run-hooks 'doom-sync-pre-hook)
(doom-cli-packages-install) (doom-cli-packages-install)
(doom-cli-packages-build) (doom-cli-packages-build)
(when update-p (when update-p

View file

@ -568,7 +568,7 @@ best to run Doom out of ~/.emacs.d and ~/.doom.d."
doom-cache-dir)) doom-cache-dir))
(load! doom-module-init-file doom-private-dir t) (load! doom-module-init-file doom-private-dir t)
;; (maphash (doom-module-loader doom-cli-file) (doom-current-modules)) (maphash (doom-module-loader doom-cli-file) doom-modules)
(load! doom-cli-file doom-private-dir t) (load! doom-cli-file doom-private-dir t)
(provide 'core-cli) (provide 'core-cli)

View file

@ -17,8 +17,6 @@ byte-compiled from.")
;;;###autoload ;;;###autoload
(defun +literate-tangle-h () (defun +literate-tangle-h ()
"Tangles `+literate-config-file' if it has changed." "Tangles `+literate-config-file' if it has changed."
(print! (start "Compiling your literate config..."))
(print-group!
(and (not (getenv "__NOTANGLE")) (and (not (getenv "__NOTANGLE"))
(require 'ox nil t) (require 'ox nil t)
(require 'ob-tangle nil t) (require 'ob-tangle nil t)
@ -47,6 +45,8 @@ byte-compiled from.")
(defun message (msg &rest args) (defun message (msg &rest args)
(when msg (when msg
(print! (info "%s") (apply #'format msg args))))) (print! (info "%s") (apply #'format msg args)))))
(print! (start "Compiling your literate config..."))
(print-group!
(unwind-protect (unwind-protect
(with-temp-file backup (with-temp-file backup
(insert-file-contents target) (insert-file-contents target)
@ -73,8 +73,7 @@ byte-compiled from.")
(with-temp-file cache) (with-temp-file cache)
(if doom-interactive-p t (if doom-interactive-p t
(message "Restarting..." ) (message "Restarting..." )
(doom-cli-execute-lines-after "__NOTANGLE=1 $@") (throw 'exit "__NOTANGLE=1 $@"))))))
(kill-emacs 0))))))
;;;###autoload ;;;###autoload
(defalias '+literate/reload #'doom/reload) (defalias '+literate/reload #'doom/reload)

View file

@ -3,4 +3,4 @@
(load! "autoload") (load! "autoload")
;; Tangle the user's config.org before 'doom sync' runs ;; Tangle the user's config.org before 'doom sync' runs
(add-hook 'doom-cli-pre-hook #'+literate-tangle-h) (add-hook 'doom-sync-pre-hook #'+literate-tangle-h)