parent
bdbeb8f507
commit
63a03848a3
5 changed files with 34 additions and 35 deletions
2
bin/doom
2
bin/doom
|
@ -3,7 +3,7 @@
|
|||
:; case "$EMACS" in *term*) EMACS=emacs ;; *) EMACS="${EMACS:-emacs}" ;; esac
|
||||
:; export __DOOMPOST="${TMPDIR:-/tmp}/doom.sh"
|
||||
:; $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=$?; }
|
||||
:; exit $__DOOMCODE
|
||||
|
||||
|
|
|
@ -18,6 +18,7 @@ recompile. Run this whenever you:
|
|||
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
|
||||
stale."
|
||||
(run-hooks 'doom-sync-pre-hook)
|
||||
(add-hook 'kill-emacs-hook #'doom--cli-abort-warning-h)
|
||||
(print! (start "Synchronizing your config with Doom Emacs..."))
|
||||
(unwind-protect
|
||||
|
@ -26,7 +27,6 @@ stale."
|
|||
(when (and (not no-envvar-p)
|
||||
(file-exists-p doom-env-file))
|
||||
(doom-cli-reload-env-file 'force))
|
||||
(run-hooks 'doom-sync-pre-hook)
|
||||
(doom-cli-packages-install)
|
||||
(doom-cli-packages-build)
|
||||
(when update-p
|
||||
|
|
|
@ -568,7 +568,7 @@ best to run Doom out of ~/.emacs.d and ~/.doom.d."
|
|||
doom-cache-dir))
|
||||
|
||||
(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)
|
||||
|
||||
(provide 'core-cli)
|
||||
|
|
|
@ -17,36 +17,36 @@ byte-compiled from.")
|
|||
;;;###autoload
|
||||
(defun +literate-tangle-h ()
|
||||
"Tangles `+literate-config-file' if it has changed."
|
||||
(print! (start "Compiling your literate config..."))
|
||||
(print-group!
|
||||
(and (not (getenv "__NOTANGLE"))
|
||||
(require 'ox nil t)
|
||||
(require 'ob-tangle nil t)
|
||||
(letf! ((default-directory doom-private-dir)
|
||||
(target +literate-config-file)
|
||||
(cache +literate-config-cache-file)
|
||||
(dest (concat (file-name-sans-extension target) ".el"))
|
||||
;; Operate on a copy because `org-babel-tangle' has
|
||||
;; side-effects we need to undo immediately as not to
|
||||
;; overwrite the user's config; it's bad ettiquite.
|
||||
(backup (make-temp-file (concat (file-name-nondirectory target) ".")))
|
||||
(and (not (getenv "__NOTANGLE"))
|
||||
(require 'ox nil t)
|
||||
(require 'ob-tangle nil t)
|
||||
(letf! ((default-directory doom-private-dir)
|
||||
(target +literate-config-file)
|
||||
(cache +literate-config-cache-file)
|
||||
(dest (concat (file-name-sans-extension target) ".el"))
|
||||
;; Operate on a copy because `org-babel-tangle' has
|
||||
;; side-effects we need to undo immediately as not to
|
||||
;; overwrite the user's config; it's bad ettiquite.
|
||||
(backup (make-temp-file (concat (file-name-nondirectory target) ".")))
|
||||
|
||||
;; HACK A hack to prevent ob-tangle from operating relative to
|
||||
;; the backup file and thus tangling to the wrong
|
||||
;; destinations.
|
||||
(defun org-babel-tangle-single-block (&rest args)
|
||||
(let* ((spec (apply org-babel-tangle-single-block args))
|
||||
(file (nth 1 spec))
|
||||
(file (if (file-equal-p file backup) target file))
|
||||
(file (if org-babel-tangle-use-relative-file-links
|
||||
(file-relative-name file)
|
||||
file)))
|
||||
(setf (nth 1 spec) file)
|
||||
spec))
|
||||
;; Ensure output conforms to the formatting of all doom CLIs
|
||||
(defun message (msg &rest args)
|
||||
(when msg
|
||||
(print! (info "%s") (apply #'format msg args)))))
|
||||
;; HACK A hack to prevent ob-tangle from operating relative to
|
||||
;; the backup file and thus tangling to the wrong
|
||||
;; destinations.
|
||||
(defun org-babel-tangle-single-block (&rest args)
|
||||
(let* ((spec (apply org-babel-tangle-single-block args))
|
||||
(file (nth 1 spec))
|
||||
(file (if (file-equal-p file backup) target file))
|
||||
(file (if org-babel-tangle-use-relative-file-links
|
||||
(file-relative-name file)
|
||||
file)))
|
||||
(setf (nth 1 spec) file)
|
||||
spec))
|
||||
;; Ensure output conforms to the formatting of all doom CLIs
|
||||
(defun message (msg &rest args)
|
||||
(when msg
|
||||
(print! (info "%s") (apply #'format msg args)))))
|
||||
(print! (start "Compiling your literate config..."))
|
||||
(print-group!
|
||||
(unwind-protect
|
||||
(with-temp-file backup
|
||||
(insert-file-contents target)
|
||||
|
@ -73,8 +73,7 @@ byte-compiled from.")
|
|||
(with-temp-file cache)
|
||||
(if doom-interactive-p t
|
||||
(message "Restarting..." )
|
||||
(doom-cli-execute-lines-after "__NOTANGLE=1 $@")
|
||||
(kill-emacs 0))))))
|
||||
(throw 'exit "__NOTANGLE=1 $@"))))))
|
||||
|
||||
;;;###autoload
|
||||
(defalias '+literate/reload #'doom/reload)
|
||||
|
|
|
@ -3,4 +3,4 @@
|
|||
(load! "autoload")
|
||||
|
||||
;; 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)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue