              (let ((sexp (sexp-at-point)))
                (when (memq (car-safe sexp) '(featurep! require!))
                  (format "%s %s" (nth 1 sexp) (nth 2 sexp)))))))
-        ((and buffer-file-name
-              (when-let (mod (doom-module-from-path buffer-file-name))
-                (unless (memq (car mod) '(:core :private))
-                  (format "%s %s" (car mod) (cdr mod))))))
+        ((when buffer-file-name
+           (when-let (mod (doom-module-from-path buffer-file-name))
+             (unless (memq (car mod) '(:core :private))
+               (format "%s %s" (car mod) (cdr mod))))))
         ((when-let (mod (cdr (assq major-mode doom--help-major-mode-module-alist)))
            (format "%s %s"
                    (symbol-name (car mod))

current file is in, or d) the module associated with the current major mode (see
`doom--help-major-mode-module-alist')."
  (interactive
   (let* ((module-string
           (completing-read "Describe module: "
                            (doom--help-modules-list)
                            nil t nil nil
                            (doom--help-current-module-str)))
          (key (doom-module-from-path
                (or (car (get-text-property 0 'location module-string))
                    (user-error "Did not select a valid module")))))
     (list (car key)
           (cdr key))))
  (cl-check-type category symbol)
  (cl-check-type module symbol)
  (let ((path (doom-module-locate-path category module)))
    (unless (file-readable-p path)
      (error "'%s %s' isn't a valid module; it doesn't exist" category module))
    (if-let (readme-path (doom-module-locate-path category module "README.org"))
        (find-file readme-path)
      (if (y-or-n-p (format "The '%s %s' module has no README file. Explore its directory?"
                            category module))
          (doom-project-browse path)
        (user-error "Aborted module lookup")))))


         (depth (if (integerp depth) depth)))
    (message "Loading search results...")
    (unwind-protect
        (delq
         nil
         (org-map-entries
          (lambda ()
            (cl-destructuring-bind (level _reduced-level _todo _priority text tags)
                (org-heading-components)
              (when (and (or (null depth)
                             (<= level depth))
                         (or (null tags)
                             (not (string-match-p ":TOC" tags))))
                (let ((path (org-get-outline-path)))
                  (list (string-join
                         (list (string-join
                                (append (when include-files
                                          (list (or (+org-get-global-property "TITLE")
                                                    (file-relative-name (buffer-file-name)))))
                                        path
                                        (list (replace-regexp-in-string org-link-any-re "\\4" text)))
                                " > ")
                               tags)
                         " ")
                        (buffer-file-name)
                        (point))))))
          t 'agenda))
      (mapc #'kill-buffer org-agenda-new-buffers)
      (setq org-agenda-new-buffers nil))))

