Minor edits.

This commit is contained in:
Derek Taylor
2020-11-05 13:27:52 -06:00
parent 8fbacc6392
commit 35112d3f8c
170 changed files with 1304 additions and 756 deletions

View File

@@ -10,6 +10,7 @@ one wants that.")
(defvar doom-autoloads-cached-vars
'(doom-modules
doom-disabled-packages
comp-deferred-compilation-black-list
load-path
auto-mode-alist
interpreter-mode-alist
@@ -34,16 +35,13 @@ one wants that.")
(and (print! (start "Generating autoloads file..."))
(doom-autoloads--write
file
`((unless (equal emacs-major-version ,emacs-major-version)
(signal 'doom-error
(list "The installed version of Emacs has changed since last 'doom sync' ran"
"Run 'doom sync && doom build' to bring Doom up to speed")))
(unless (equal doom-version ,doom-version)
`((unless (equal doom-version ,doom-version)
(signal 'doom-error
(list "The installed version of Doom has changed since last 'doom sync' ran"
"Run 'doom sync' to bring Doom up to speed"))))
(mapcar (lambda (var) `(set ',var ',(symbol-value var)))
doom-autoloads-cached-vars)
(cl-loop for var in doom-autoloads-cached-vars
when (boundp var)
collect `(set ',var ',(symbol-value var)))
(doom-autoloads--scan
(append (cl-loop for dir
in (append (list doom-core-dir)

View File

@@ -15,10 +15,10 @@
(insert (json-encode (doom-info)))
(json-pretty-print-buffer)
(print! (buffer-string))))
("--md"
(doom/info))
((or `nil "--lisp")
("--lisp"
(doom/info 'raw))
(`nil
(doom/info))
(_
(user-error "I don't understand %S. Did you mean --json, --md/--markdown or --lisp?"
format)))

View File

@@ -128,8 +128,8 @@ default, on Linux, this is '$SHELL -ic /usr/bin/env'. Variables in
(remq nil (append blacklist doom-env-blacklist)))
(if (not (cl-find-if (doom-rpartial #'string-match-p (car (split-string env "=")))
(remq nil (append whitelist doom-env-whitelist))))
(print! (info "Ignoring %s") env)
(print! (info "Whitelisted %s") env)
(print! (debug "Ignoring %s") env)
(print! (debug "Whitelisted %s") env)
(insert env "\0\n"))
(insert env "\0\n")))
(print! (success "Successfully generated %S")

View File

@@ -28,6 +28,12 @@ DOOMDIR environment variable. e.g.
;; Create `doom-private-dir'
(if noconfig-p
(print! (warn "Not copying private config template, as requested"))
;; Create DOOMDIR in ~/.config/doom if ~/.config/emacs exists.
(when (and (not (file-directory-p doom-private-dir))
(not (getenv "DOOMDIR")))
(let ((xdg-config-dir (or (getenv "XDG_CONFIG_HOME") "~/.config")))
(when (file-in-directory-p doom-emacs-dir xdg-config-dir)
(setq doom-private-dir (expand-file-name "doom/" xdg-config-dir)))))
(print! (start "Creating %s") (relpath doom-private-dir))
(make-directory doom-private-dir 'parents)
(print-group!

View File

@@ -61,10 +61,15 @@ list remains lean."
(if full commit (substring commit 0 7)))
(defun doom--commit-log-between (start-ref end-ref)
(and (straight--call
"git" "log" "--oneline" "--no-merges"
"-n" "25" end-ref (concat "^" (regexp-quote start-ref)))
(straight--process-get-output)))
(when-let*
((status (straight--call
"git" "log" "--oneline" "--no-merges"
"-n" "26" end-ref (concat "^" (regexp-quote start-ref))))
(output (string-trim-right (straight--process-get-output)))
(lines (split-string output "\n")))
(if (> (length lines) 25)
(concat (string-join (butlast lines 1) "\n") "\n[...]")
output)))
(defun doom--barf-if-incomplete-packages ()
(let ((straight-safe-mode t))
@@ -115,9 +120,34 @@ list remains lean."
(setq straight--recipe-lookup-cache (make-hash-table :test #'eq)
doom--cli-updated-recipes t)))
(defvar doom--expected-eln-files nil)
(defvar doom--eln-output-expected nil)
(defvar doom--eln-output-path (car (bound-and-true-p comp-eln-load-path)))
(defun doom--eln-file-name (file)
"Return the short .eln file name corresponding to `file'."
(concat comp-native-version-dir "/"
(file-name-nondirectory
(comp-el-to-eln-filename file))))
(defun doom--eln-output-file (eln-name)
"Return the expected .eln file corresponding to `eln-name'."
(concat doom--eln-output-path eln-name))
(defun doom--eln-error-file (eln-name)
"Return the expected .error file corresponding to `eln-name'."
(concat doom--eln-output-path eln-name ".error"))
(defun doom--find-eln-file (eln-name)
"Find `eln-name' on the `comp-eln-load-path'."
(cl-some (lambda (eln-path)
(let ((file (concat eln-path eln-name)))
(when (file-exists-p file)
file)))
comp-eln-load-path))
(defun doom--elc-file-outdated-p (file)
"Check whether the corresponding .elc for `file' is outdated."
(let ((elc-file (byte-compile-dest-file file)))
;; NOTE Ignore missing elc files, they could be missing due to
;; `no-byte-compile'. Rebuilding unnecessarily is expensive.
@@ -126,17 +156,12 @@ list remains lean."
(doom-log "%s is newer than %s" file elc-file)
t)))
;; DEPRECATED Remove later
(defun doom--comp-output-filename (file)
(if (fboundp 'comp-output-filename)
(comp-output-filename file)
(comp-el-to-eln-filename file)))
(defun doom--eln-file-outdated-p (file)
(when-let* ((eln-file (doom--comp-output-filename file))
(error-file (concat eln-file ".error")))
(push eln-file doom--expected-eln-files)
(cond ((file-exists-p eln-file)
"Check whether the corresponding .eln for `file' is outdated."
(let* ((eln-name (doom--eln-file-name file))
(eln-file (doom--find-eln-file eln-name))
(error-file (doom--eln-error-file eln-name)))
(cond (eln-file
(when (file-newer-than-file-p file eln-file)
(doom-log "%s is newer than %s" file eln-file)
t))
@@ -145,18 +170,20 @@ list remains lean."
(doom-log "%s is newer than %s" file error-file)
t))
(t
(doom-log "%s doesn't exist" eln-file)
(doom-log "%s doesn't exist" eln-name)
t))))
(defun doom--native-compile-done-h (file)
(when-let* ((file)
(eln-file (doom--comp-output-filename file))
(error-file (concat eln-file ".error")))
(if (file-exists-p eln-file)
(doom-log "Compiled %s" eln-file)
(make-directory (file-name-directory error-file) 'parents)
(write-region "" nil error-file)
(doom-log "Compiled %s" error-file))))
"Callback fired when an item has finished async compilation."
(when file
(let* ((eln-name (doom--eln-file-name file))
(eln-file (doom--eln-output-file eln-name))
(error-file (doom--eln-error-file eln-name)))
(if (file-exists-p eln-file)
(doom-log "Compiled %s" eln-file)
(make-directory (file-name-directory error-file) 'parents)
(write-region "" nil error-file)
(doom-log "Wrote %s" error-file)))))
(defun doom--native-compile-jobs ()
"How many async native compilation jobs are queued or in-progress."
@@ -169,25 +196,39 @@ list remains lean."
(defun doom--wait-for-compile-jobs ()
"Wait for all pending async native compilation jobs."
(cl-loop for pending = (doom--native-compile-jobs)
for tick = 0 then (% (1+ tick) 15)
with previous = 0
while (not (zerop pending))
if (and (zerop tick) (/= previous pending)) do
(print! "- Waiting for %d async jobs..." pending)
if (/= previous pending) do
(print! (info "\033[KWaiting for %d async jobs...\033[1A" pending))
(setq previous pending)
else do
(let ((inhibit-message t))
(sleep-for 0.1)))
;; HACK Write .error files for any missing files which still don't exist.
;; We'll just assume there was some kind of error...
(cl-loop for eln-file in doom--expected-eln-files
for error-file = (concat eln-file ".error")
(sleep-for 0.1))))
(defun doom--write-missing-eln-errors ()
"Write .error files for any expected .eln files that are missing."
(cl-loop for file in doom--eln-output-expected
for eln-name = (doom--eln-file-name file)
for eln-file = (doom--eln-output-file eln-name)
for error-file = (doom--eln-error-file eln-name)
unless (or (file-exists-p eln-file)
(file-exists-p error-file)) do
(make-directory (file-name-directory error-file) 'parents)
(write-region "" nil error-file)
(doom-log "Compiled %s" error-file))
(setq doom--expected-eln-files nil))
(file-newer-than-file-p error-file file))
do (make-directory (file-name-directory error-file) 'parents)
(write-region "" nil error-file)
(doom-log "Wrote %s" error-file))
(setq doom--eln-output-expected nil))
(defun doom--compile-site-packages ()
"Queue async compilation for all non-doom Elisp files."
(when (fboundp 'native-compile-async)
(cl-loop with paths = (cl-loop for path in load-path
unless (string-prefix-p doom-local-dir path)
collect path)
for file in (doom-files-in paths :match "\\.el\\(?:\\.gz\\)?$")
if (and (file-exists-p (byte-compile-dest-file file))
(not (doom--find-eln-file (doom--eln-file-name file)))) do
(doom-log "Compiling %s" file)
(native-compile-async file nil 'late))))
(defun doom-cli-packages-install ()
@@ -209,7 +250,7 @@ declaration) or dependency thereof that hasn't already been."
(let ((straight-use-package-pre-build-functions
(cons (lambda (pkg &rest _)
(when-let (commit (cdr (assoc pkg pinned)))
(print! (info "Checked out %s") commit)))
(print! (info "Checked out %s: %s") pkg commit)))
straight-use-package-pre-build-functions)))
(straight-use-package (intern package))
;; HACK Line encoding issues can plague repos with dirty
@@ -224,7 +265,9 @@ declaration) or dependency thereof that hasn't already been."
(error
(signal 'doom-package-error (list package e))))))
(progn
(doom--compile-site-packages)
(doom--wait-for-compile-jobs)
(doom--write-missing-eln-errors)
(print! (success "Installed %d packages") (length built)))
(print! (info "No packages need to be installed"))
nil))))
@@ -267,12 +310,16 @@ declaration) or dependency thereof that hasn't already been."
if (or (if want-byte (doom--elc-file-outdated-p file))
(if want-native (doom--eln-file-outdated-p file)))
do (setq outdated t)
(when want-native
(push file doom--eln-output-expected))
finally return outdated))
(puthash package t straight--packages-to-rebuild))))
(straight-use-package (intern package))))
(progn
(doom--compile-site-packages)
(doom--wait-for-compile-jobs)
(print! (success "Rebuilt %d package(s)") (length built)))
(doom--write-missing-eln-errors)
(print! (success "\033[KRebuilt %d package(s)") (length built)))
(print! (success "No packages need rebuilding"))
nil))))
@@ -359,13 +406,12 @@ declaration) or dependency thereof that hasn't already been."
(cl-return)))
(puthash local-repo t repos-to-rebuild)
(puthash package t packages-to-rebuild)
(unless (string-empty-p output)
(print! (start "\033[K(%d/%d) Updating %s...") i total local-repo)
(print-group! (print! "%s" (indent 2 output))))
(print! (success "\033[K(%d/%d) %s updated (%s -> %s)")
i total local-repo
(doom--abbrev-commit ref)
(doom--abbrev-commit target-ref)))
(doom--abbrev-commit target-ref))
(unless (string-empty-p output)
(print-group! (print! "%s" (indent 2 output)))))
(user-error
(signal 'user-error (error-message-string e)))
(error
@@ -490,9 +536,10 @@ If ELPA-P, include packages installed with package.el (M-x package-install)."
(and (or repos-p regraft-repos-p)
(straight--directory-files (straight--repos-dir) nil nil 'sort))))
(list (when builds-p
(seq-filter #'file-directory-p
(seq-remove (doom-rpartial #'gethash straight--profile-cache)
(straight--directory-files (straight--build-dir) nil nil 'sort))))
(let ((default-directory (straight--build-dir)))
(seq-filter #'file-directory-p
(seq-remove (doom-rpartial #'gethash straight--profile-cache)
(straight--directory-files default-directory nil nil 'sort)))))
(when repos-p
(seq-remove (doom-rpartial #'straight--checkhash straight--repo-cache)
rdirs))

View File

@@ -11,8 +11,7 @@ following shell commands:
cd ~/.emacs.d
git pull --rebase
bin/doom clean
bin/doom sync
bin/doom update"
bin/doom sync -u"
:bare t
(let ((doom-auto-discard force-p))
(cond
@@ -100,13 +99,15 @@ following shell commands:
(cdr (doom-call-process "git" "log" "-1" "--format=%cr" "HEAD"))
(substring new-rev 0 10)
(cdr (doom-call-process "git" "log" "-1" "--format=%cr" target-remote))))
(when (and (not auto-accept-p)
(y-or-n-p "View the comparison diff in your browser?"))
(print! (info "Opened github in your browser."))
(browse-url (format "https://github.com/hlissner/doom-emacs/compare/%s...%s"
this-rev
new-rev)))
(let ((diff-url
(format "https://github.com/hlissner/doom-emacs/compare/%s...%s"
this-rev
new-rev)))
(print! "Link to diff: %s" diff-url)
(when (and (not auto-accept-p)
(y-or-n-p "View the comparison diff in your browser?"))
(print! (info "Opened github in your browser."))
(browse-url diff-url)))
(if (not (or auto-accept-p
(y-or-n-p "Proceed with upgrade?")))