 These packages 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.")
+
+(defvar doom-autoloads-excluded-files
+  '("/bufler/bufler-workspaces-tabs\\.el$")
+  "List of regexps whose matching files won't be indexed for autoloads.")
 
 (defvar doom-autoloads-cached-vars
   '(doom-modules

      (doom-autoloads--scan-autodefs
       file target-buffer module module-enabled-p))))

(defun doom-autoloads--scan (files &optional literal)
  (require 'autoload)
  (let (autoloads)
    (dolist (file
             (seq-filter #'file-readable-p files)
             (nreverse (delq nil autoloads)))
      (with-temp-buffer
        (print! (debug "- Scanning %s") (relpath file doom-emacs-dir))
        (if literal
            (insert-file-contents file)
          (doom-autoloads--scan-file file))
        (save-excursion
          (let ((filestr (prin1-to-string file)))
            (while (re-search-forward "\\_<load-file-name\\_>" nil t)
              ;; `load-file-name' is meaningless in a concatenated
              ;; mega-autoloads file, so we replace references to it with the
              ;; file they came from.
              (let ((ppss (save-excursion (syntax-ppss))))
                (or (nth 3 ppss)
                    (nth 4 ppss)
                    (replace-match filestr t t))))))
        (let ((load-file-name file)
              (load-path
               (append (list doom-private-dir)
                       doom-modules-dirs
                       load-path)))
          (condition-case _
              (while t
                (push (doom-autoloads--cleanup-form (read (current-buffer))
                                                    (not literal))
                      autoloads))
            (end-of-file)))))))

                                      (list doom-private-dir))
                           if (doom-glob dir "autoload.el") collect it
                           if (doom-glob dir "autoload/*.el") append it)
                  (mapcan #'doom-glob doom-autoloads-files))
          nil)
         (doom-autoloads--scan
          (mapcar #'straight--autoloads-file
                  (seq-difference (hash-table-keys straight--build-cache)
                                  doom-autoloads-excluded-packages))
          doom-autoloads-excluded-files
          'literal))
        (print! (start "Byte-compiling autoloads file..."))
        (doom-autoloads--compile-file file)
