parent
6f878a38bd
commit
ffdb726ed8
1 changed files with 29 additions and 19 deletions
|
@ -1,5 +1,19 @@
|
||||||
;;; core/cli/autoloads.el -*- lexical-binding: t; -*-
|
;;; core/cli/autoloads.el -*- lexical-binding: t; -*-
|
||||||
|
|
||||||
|
(defvar doom-autoload-excluded-packages '("gh")
|
||||||
|
"Packages that have silly or destructive autoload files that try to load
|
||||||
|
everyone in the universe and their dog, causing errors that make babies cry. No
|
||||||
|
one wants that.")
|
||||||
|
|
||||||
|
;; external variables
|
||||||
|
(defvar autoload-timestamps)
|
||||||
|
(defvar generated-autoload-load-name)
|
||||||
|
(defvar generated-autoload-file)
|
||||||
|
|
||||||
|
|
||||||
|
;;
|
||||||
|
;;; Commands
|
||||||
|
|
||||||
(def-command! (autoloads a) ()
|
(def-command! (autoloads a) ()
|
||||||
"Regenerates Doom's autoloads files.
|
"Regenerates Doom's autoloads files.
|
||||||
|
|
||||||
|
@ -12,11 +26,6 @@ It also caches `load-path', `Info-directory-list', `doom-disabled-packages',
|
||||||
`package-activated-list' and `auto-mode-alist'."
|
`package-activated-list' and `auto-mode-alist'."
|
||||||
(doom-reload-autoloads nil 'force))
|
(doom-reload-autoloads nil 'force))
|
||||||
|
|
||||||
;; external variables
|
|
||||||
(defvar autoload-timestamps)
|
|
||||||
(defvar generated-autoload-load-name)
|
|
||||||
(defvar generated-autoload-file)
|
|
||||||
|
|
||||||
|
|
||||||
;;
|
;;
|
||||||
;;; Helpers
|
;;; Helpers
|
||||||
|
@ -308,20 +317,21 @@ Run this whenever your `doom!' block, or a module autoload file, is modified."
|
||||||
"Concatenates package autoload files, let-binds `load-file-name' around
|
"Concatenates package autoload files, let-binds `load-file-name' around
|
||||||
them,and remove unnecessary `provide' statements or blank links."
|
them,and remove unnecessary `provide' statements or blank links."
|
||||||
(dolist (pkg (straight--directory-files (straight--build-dir)))
|
(dolist (pkg (straight--directory-files (straight--build-dir)))
|
||||||
(let ((file (straight--autoloads-file pkg)))
|
(unless (member pkg doom-autoload-excluded-packages)
|
||||||
(when (file-exists-p file)
|
(let ((file (straight--autoloads-file pkg)))
|
||||||
(insert-file-contents file)
|
(when (file-exists-p file)
|
||||||
(when (save-excursion
|
(insert-file-contents file)
|
||||||
(and (re-search-forward "\\_<load-file-name\\_>" nil t)
|
(when (save-excursion
|
||||||
(not (nth 8 (syntax-ppss)))))
|
(and (re-search-forward "\\_<load-file-name\\_>" nil t)
|
||||||
;; Set `load-file-name' so that the contents of autoloads
|
(not (nth 8 (syntax-ppss)))))
|
||||||
;; files can pretend they're in the file they're expected to
|
;; Set `load-file-name' so that the contents of autoloads
|
||||||
;; be in, rather than `doom-package-autoload-file'.
|
;; files can pretend they're in the file they're expected to
|
||||||
(insert (format "(setq load-file-name %S)\n" (abbreviate-file-name file))))
|
;; be in, rather than `doom-package-autoload-file'.
|
||||||
(while (re-search-forward "^\\(?:;;\\(.*\n\\)\\|\n\\|(provide '[^\n]+\\)" nil t)
|
(insert (format "(setq load-file-name %S)\n" (abbreviate-file-name file))))
|
||||||
(unless (nth 8 (syntax-ppss))
|
(while (re-search-forward "^\\(?:;;\\(.*\n\\)\\|\n\\|(provide '[^\n]+\\)" nil t)
|
||||||
(replace-match "" t t)))
|
(unless (nth 8 (syntax-ppss))
|
||||||
(unless (bolp) (insert "\n"))))))
|
(replace-match "" t t)))
|
||||||
|
(unless (bolp) (insert "\n")))))))
|
||||||
|
|
||||||
(defun doom--generate-var-cache ()
|
(defun doom--generate-var-cache ()
|
||||||
"Print a `setq' form for expensive-to-initialize variables, so we can cache
|
"Print a `setq' form for expensive-to-initialize variables, so we can cache
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue