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-packages)
(doom-initialize-packages)
(doom-cli-reload-autoloads nil 'force))
(doom-cli-reload-autoloads))
;;;###autoload
(defun doom/reload-env (&optional arg)

View file

@ -18,70 +18,44 @@ one wants that.")
(defvar autoload-timestamps)
(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.
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
even if it doesn't need reloading!"
it is nil, it will try to reload both."
(if type
(cond ((eq type 'core)
(doom-cli-reload-core-autoloads
doom-autoload-file force-p))
(doom-cli-reload-core-autoloads doom-autoload-file))
((eq type 'package)
(doom-cli-reload-package-autoloads
doom-package-autoload-file force-p))
(doom-cli-reload-package-autoloads doom-package-autoload-file))
((error "Invalid autoloads file: %s" type)))
(doom-cli-reload-autoloads 'core force-p)
(doom-cli-reload-autoloads 'package force-p)))
(doom-cli-reload-autoloads 'core)
(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)
(print! (start "(Re)generating core autoloads..."))
(print-group!
(let ((autoload-files
(and (print! (start "Generating core autoloads..."))
(doom-cli--write-autoloads
file (doom-cli--generate-autoloads
(cl-loop for dir in (append (list doom-core-dir)
(cdr (doom-module-load-path 'all-p))
(list doom-private-dir))
if (doom-glob dir "autoload.el") collect it
if (doom-glob dir "autoload/*.el") append it)))
(if (or force-p
(not (file-exists-p file))
(file-newer-than-file-p doom-emacs-dir file)
(cl-loop for dir
in (append (doom-glob doom-private-dir "init.el*")
autoload-files)
if (file-newer-than-file-p dir doom-autoload-file)
return t))
(and (print! (start "Generating core autoloads..."))
(doom-cli--write-autoloads
file (doom-cli--generate-autoloads autoload-files 'scan))
if (doom-glob dir "autoload/*.el") append it)
'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))))
doom-emacs-dir)))))
(defun doom-cli-reload-package-autoloads (file &optional force-p)
(defun doom-cli-reload-package-autoloads (file)
(cl-check-type file string)
(print! (start "(Re)generating package autoloads..."))
(print-group!
(doom-initialize-packages)
(if (or force-p
(not (file-exists-p file))
(file-newer-than-file-p package-user-dir file)
(cl-loop for dir in (straight--directory-files (straight--build-dir))
if (cl-find-if
(doom-rpartial #'file-newer-than-file-p doom-package-autoload-file)
(doom-glob (straight--build-dir dir) "*.el"))
return t)
(not (cl-loop with doom-modules = (doom-modules)
for key being the hash-keys of doom-modules
for path = (doom-module-path (car key) (cdr key) "packages.el")
if (file-newer-than-file-p path doom-package-autoload-file)
return t)))
(and (print! (start "Generating package autoloads..."))
(doom-cli--write-autoloads
file
@ -95,9 +69,7 @@ even if it doesn't need reloading!"
(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)))
doom-emacs-dir)))))
;;

View file

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

View file

@ -12,7 +12,7 @@ or :ignore property."
(straight-check-all)
(doom-cli-reload-autoloads 'core)
(when (doom-cli-packages-update)
(doom-cli-reload-autoloads 'package 'force))
(doom-cli-reload-autoloads 'package))
t)
(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
Emacs (as byte-code is generally not forward-compatible)."
(when (doom-cli-packages-build (not rebuild-p))
(doom-cli-reload-autoloads 'package 'force))
(doom-cli-reload-autoloads 'package))
t)
(defcli! (purge p)
@ -46,7 +46,7 @@ list remains lean."
(not norepos-p)
(not nobuilds-p)
regraft-p)
(doom-cli-reload-autoloads 'package 'force))
(doom-cli-reload-autoloads 'package))
t)
;; (defcli! rollback () ; TODO doom rollback

View file

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

View file

@ -255,7 +255,7 @@ stale."
(doom-initialize 'force 'noerror)
(doom-initialize-modules)
(doom-cli-reload-autoloads 'core (not if-necessary-p))
(doom-cli-reload-autoloads 'core)
(unwind-protect
(progn
(and (doom-cli-packages-install)
@ -264,7 +264,7 @@ stale."
(setq success t))
(and (doom-cli-packages-purge prune-p 'builds-p prune-p prune-p)
(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))
t)))