             (mapcar (doom-rpartial #'doom--resolve-path-forms directory)
                     (cdr spec)))
     (let ((filevar (make-symbol "file")))
-      `(let* ((file-name-handler-alist nil)
-              (,filevar ,spec))
+      `(let ((,filevar ,spec))
          (and (stringp ,filevar)
               ,(if directory
                    `(let ((default-directory ,directory))

The search recurses up to DEPTH and no further. DEPTH is an integer.

MATCH is a string regexp. Only entries that match it will be included."
  (let (result file-name-handler-alist)
    (dolist (file (mapcan (doom-rpartial #'doom-glob "*") (doom-enlist paths)))
      (cond ((file-directory-p file)
             (appendq!

              ,filevar)))))

(defun doom--path (&rest segments)
  (let ((dir (pop segments)))
    (unless segments
      (setq dir (expand-file-name dir)))
    (while segments
      (setq dir (expand-file-name (car segments) dir)
            segments (cdr segments)))
    dir))

;;;###autoload
(defun doom-glob (&rest segments)
  "Construct a path from SEGMENTS and expand glob patterns.
Returns nil if the path doesn't exist."
  (let* (case-fold-search
         (dir (apply #'doom--path segments)))
    (if (string-match-p "[[*?]" dir)
        (file-expand-wildcards dir t)
