From ffdb726ed86e6b8495fdc74eb2eff2a5d33f15c2 Mon Sep 17 00:00:00 2001 From: Henrik Lissner Date: Mon, 22 Jul 2019 06:02:21 +0200 Subject: [PATCH] Exclude gh.el from autoloads See sigma/gh.el#95 --- core/cli/autoloads.el | 48 ++++++++++++++++++++++++++----------------- 1 file changed, 29 insertions(+), 19 deletions(-) diff --git a/core/cli/autoloads.el b/core/cli/autoloads.el index 36ff96c39..19bfda8da 100644 --- a/core/cli/autoloads.el +++ b/core/cli/autoloads.el @@ -1,5 +1,19 @@ ;;; 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) () "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'." (doom-reload-autoloads nil 'force)) -;; external variables -(defvar autoload-timestamps) -(defvar generated-autoload-load-name) -(defvar generated-autoload-file) - ;; ;;; 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 them,and remove unnecessary `provide' statements or blank links." (dolist (pkg (straight--directory-files (straight--build-dir))) - (let ((file (straight--autoloads-file pkg))) - (when (file-exists-p file) - (insert-file-contents file) - (when (save-excursion - (and (re-search-forward "\\_" nil t) - (not (nth 8 (syntax-ppss))))) - ;; Set `load-file-name' so that the contents of autoloads - ;; files can pretend they're in the file they're expected to - ;; be in, rather than `doom-package-autoload-file'. - (insert (format "(setq load-file-name %S)\n" (abbreviate-file-name file)))) - (while (re-search-forward "^\\(?:;;\\(.*\n\\)\\|\n\\|(provide '[^\n]+\\)" nil t) - (unless (nth 8 (syntax-ppss)) - (replace-match "" t t))) - (unless (bolp) (insert "\n")))))) + (unless (member pkg doom-autoload-excluded-packages) + (let ((file (straight--autoloads-file pkg))) + (when (file-exists-p file) + (insert-file-contents file) + (when (save-excursion + (and (re-search-forward "\\_" nil t) + (not (nth 8 (syntax-ppss))))) + ;; Set `load-file-name' so that the contents of autoloads + ;; files can pretend they're in the file they're expected to + ;; be in, rather than `doom-package-autoload-file'. + (insert (format "(setq load-file-name %S)\n" (abbreviate-file-name file)))) + (while (re-search-forward "^\\(?:;;\\(.*\n\\)\\|\n\\|(provide '[^\n]+\\)" nil t) + (unless (nth 8 (syntax-ppss)) + (replace-match "" t t))) + (unless (bolp) (insert "\n"))))))) (defun doom--generate-var-cache () "Print a `setq' form for expensive-to-initialize variables, so we can cache