Remove FORCE-P argument for doom-cli-reload-autoloads

We weren't using them anyway.
This commit is contained in:
Henrik Lissner 2019-12-30 06:44:16 -05:00
parent bb425a2e65
commit 908bd4b945
No known key found for this signature in database
GPG key ID: 5F6C0EA160557395
6 changed files with 45 additions and 73 deletions

View file

@ -105,7 +105,7 @@ line."
(require 'core-cli) (require 'core-cli)
(require 'core-packages) (require 'core-packages)
(doom-initialize-packages) (doom-initialize-packages)
(doom-cli-reload-autoloads nil 'force)) (doom-cli-reload-autoloads))
;;;###autoload ;;;###autoload
(defun doom/reload-env (&optional arg) (defun doom/reload-env (&optional arg)

View file

@ -18,86 +18,58 @@ one wants that.")
(defvar autoload-timestamps) (defvar autoload-timestamps)
(defvar generated-autoload-load-name) (defvar generated-autoload-load-name)
(defun doom-cli-reload-autoloads (&optional type force-p) (defun doom-cli-reload-autoloads (&optional type)
"Reloads FILE (an autoload file), if it needs reloading. "Reloads FILE (an autoload file), if it needs reloading.
FILE should be one of `doom-autoload-file' or `doom-package-autoload-file'. If FILE should be one of `doom-autoload-file' or `doom-package-autoload-file'. If
it is nil, it will try to reload both. If FORCE-P (universal argument) do it it is nil, it will try to reload both."
even if it doesn't need reloading!"
(if type (if type
(cond ((eq type 'core) (cond ((eq type 'core)
(doom-cli-reload-core-autoloads (doom-cli-reload-core-autoloads doom-autoload-file))
doom-autoload-file force-p))
((eq type 'package) ((eq type 'package)
(doom-cli-reload-package-autoloads (doom-cli-reload-package-autoloads doom-package-autoload-file))
doom-package-autoload-file force-p))
((error "Invalid autoloads file: %s" type))) ((error "Invalid autoloads file: %s" type)))
(doom-cli-reload-autoloads 'core force-p) (doom-cli-reload-autoloads 'core)
(doom-cli-reload-autoloads 'package force-p))) (doom-cli-reload-autoloads 'package)))
(defun doom-cli-reload-core-autoloads (file &optional force-p) (defun doom-cli-reload-core-autoloads (file)
(cl-check-type file string) (cl-check-type file string)
(print! (start "(Re)generating core autoloads...")) (print! (start "(Re)generating core autoloads..."))
(print-group! (print-group!
(let ((autoload-files (and (print! (start "Generating core autoloads..."))
(cl-loop for dir in (append (list doom-core-dir) (doom-cli--write-autoloads
(cdr (doom-module-load-path 'all-p)) file (doom-cli--generate-autoloads
(list doom-private-dir)) (cl-loop for dir in (append (list doom-core-dir)
if (doom-glob dir "autoload.el") collect it (cdr (doom-module-load-path 'all-p))
if (doom-glob dir "autoload/*.el") append it))) (list doom-private-dir))
(if (or force-p if (doom-glob dir "autoload.el") collect it
(not (file-exists-p file)) if (doom-glob dir "autoload/*.el") append it)
(file-newer-than-file-p doom-emacs-dir file) 'scan))
(cl-loop for dir (print! (start "Byte-compiling core autoloads file..."))
in (append (doom-glob doom-private-dir "init.el*") (doom-cli--byte-compile-file file)
autoload-files) (print! (success "Generated %s")
if (file-newer-than-file-p dir doom-autoload-file) (relpath (byte-compile-dest-file file)
return t)) doom-emacs-dir)))))
(and (print! (start "Generating core autoloads..."))
(doom-cli--write-autoloads
file (doom-cli--generate-autoloads autoload-files 'scan))
(print! (start "Byte-compiling core autoloads file..."))
(doom-cli--byte-compile-file file)
(print! (success "Generated %s")
(relpath (byte-compile-dest-file file)
doom-emacs-dir)))
(print! (success "Core autoloads are up-to-date"))
nil))))
(defun doom-cli-reload-package-autoloads (file &optional force-p) (defun doom-cli-reload-package-autoloads (file)
(cl-check-type file string) (cl-check-type file string)
(print! (start "(Re)generating package autoloads...")) (print! (start "(Re)generating package autoloads..."))
(print-group! (print-group!
(doom-initialize-packages) (doom-initialize-packages)
(if (or force-p (and (print! (start "Generating package autoloads..."))
(not (file-exists-p file)) (doom-cli--write-autoloads
(file-newer-than-file-p package-user-dir file) file
(cl-loop for dir in (straight--directory-files (straight--build-dir)) (doom-cli--generate-var-cache doom-autoload-cached-vars)
if (cl-find-if (doom-cli--generate-autoloads
(doom-rpartial #'file-newer-than-file-p doom-package-autoload-file) (mapcar #'straight--autoloads-file
(doom-glob (straight--build-dir dir) "*.el")) (cl-set-difference (hash-table-keys straight--build-cache)
return t) doom-autoload-excluded-packages
(not (cl-loop with doom-modules = (doom-modules) :test #'string=))))
for key being the hash-keys of doom-modules (print! (start "Byte-compiling package autoloads file..."))
for path = (doom-module-path (car key) (cdr key) "packages.el") (doom-cli--byte-compile-file file)
if (file-newer-than-file-p path doom-package-autoload-file) (print! (success "Generated %s")
return t))) (relpath (byte-compile-dest-file file)
(and (print! (start "Generating package autoloads...")) doom-emacs-dir)))))
(doom-cli--write-autoloads
file
(doom-cli--generate-var-cache doom-autoload-cached-vars)
(doom-cli--generate-autoloads
(mapcar #'straight--autoloads-file
(cl-set-difference (hash-table-keys straight--build-cache)
doom-autoload-excluded-packages
:test #'string=))))
(print! (start "Byte-compiling package autoloads file..."))
(doom-cli--byte-compile-file file)
(print! (success "Generated %s")
(relpath (byte-compile-dest-file file)
doom-emacs-dir)))
(print! (success "Package autoloads are up-to-date"))
nil)))
;; ;;

View file

@ -78,7 +78,7 @@ DOOMDIR environment variable. e.g.
(doom-cli-packages-install)) (doom-cli-packages-install))
(print! "Regenerating autoloads files") (print! "Regenerating autoloads files")
(doom-cli-reload-autoloads nil 'force-p) (doom-cli-reload-autoloads)
(if nofonts-p (if nofonts-p
(print! (warn "Not installing fonts, as requested")) (print! (warn "Not installing fonts, as requested"))

View file

@ -12,7 +12,7 @@ or :ignore property."
(straight-check-all) (straight-check-all)
(doom-cli-reload-autoloads 'core) (doom-cli-reload-autoloads 'core)
(when (doom-cli-packages-update) (when (doom-cli-packages-update)
(doom-cli-reload-autoloads 'package 'force)) (doom-cli-reload-autoloads 'package))
t) t)
(defcli! (build b) (defcli! (build b)
@ -23,7 +23,7 @@ This ensures that all needed files are symlinked from their package repo and
their elisp files are byte-compiled. This is especially necessary if you upgrade their elisp files are byte-compiled. This is especially necessary if you upgrade
Emacs (as byte-code is generally not forward-compatible)." Emacs (as byte-code is generally not forward-compatible)."
(when (doom-cli-packages-build (not rebuild-p)) (when (doom-cli-packages-build (not rebuild-p))
(doom-cli-reload-autoloads 'package 'force)) (doom-cli-reload-autoloads 'package))
t) t)
(defcli! (purge p) (defcli! (purge p)
@ -46,7 +46,7 @@ list remains lean."
(not norepos-p) (not norepos-p)
(not nobuilds-p) (not nobuilds-p)
regraft-p) regraft-p)
(doom-cli-reload-autoloads 'package 'force)) (doom-cli-reload-autoloads 'package))
t) t)
;; (defcli! rollback () ; TODO doom rollback ;; (defcli! rollback () ; TODO doom rollback

View file

@ -50,9 +50,9 @@
(require 'core-cli) (require 'core-cli)
(doom-initialize 'force 'noerror) (doom-initialize 'force 'noerror)
(doom-initialize-modules) (doom-initialize-modules)
(doom-cli-reload-core-autoloads 'force) (doom-cli-reload-autoloads 'core)
(when (doom-cli-packages-install) (when (doom-cli-packages-install)
(doom-cli-reload-package-autoloads 'force))))) (doom-cli-reload-autoloads 'package)))))
(unless (zerop status) (unless (zerop status)
(error "Failed to bootstrap unit tests")))) (error "Failed to bootstrap unit tests"))))
(with-temp-buffer (with-temp-buffer

View file

@ -255,7 +255,7 @@ stale."
(doom-initialize 'force 'noerror) (doom-initialize 'force 'noerror)
(doom-initialize-modules) (doom-initialize-modules)
(doom-cli-reload-autoloads 'core (not if-necessary-p)) (doom-cli-reload-autoloads 'core)
(unwind-protect (unwind-protect
(progn (progn
(and (doom-cli-packages-install) (and (doom-cli-packages-install)
@ -264,7 +264,7 @@ stale."
(setq success t)) (setq success t))
(and (doom-cli-packages-purge prune-p 'builds-p prune-p prune-p) (and (doom-cli-packages-purge prune-p 'builds-p prune-p prune-p)
(setq success t))) (setq success t)))
(doom-cli-reload-autoloads 'package (or success (not if-necessary-p))) (doom-cli-reload-autoloads 'package)
(doom-cli-byte-compile nil 'recompile)) (doom-cli-byte-compile nil 'recompile))
t))) t)))