Function: project-find-dir

project-find-dir is an autoloaded, interactive and byte-compiled function defined in project.el.gz.

Signature

(project-find-dir)

Documentation

Start Dired in a directory inside the current project.

The current buffer's default-directory is available as part of
"future history".

View in manual

Probably introduced at or before Emacs version 28.1.

Key Bindings

Source Code

;; Defined in /usr/src/emacs/lisp/progmodes/project.el.gz
;;;###autoload
(defun project-find-dir ()
  "Start Dired in a directory inside the current project.

The current buffer's `default-directory' is available as part of
\"future history\"."
  (interactive)
  (let* ((project (project-current t))
         (project-files-relative-names t)
         (all-files (project-files project))
         (completion-ignore-case read-file-name-completion-ignore-case)
         ;; FIXME: This misses directories without any files directly
         ;; inside.  Consider DIRS-ONLY as an argument for
         ;; `project-files-filtered', and see
         ;; https://stackoverflow.com/a/50685235/615245 for possible
         ;; implementation.
         (all-dirs (cons "./"
                         (delq nil
                               ;; Some completion UIs show duplicates.
                               (delete-dups
                                (mapcar #'file-name-directory all-files)))))
         (default-directory (project-root project))
         (dir (project--read-file-name
               project "Dired"
               all-dirs
               nil 'file-name-history
               (and default-directory
                    (project--find-default-from default-directory project)))))
    (dired dir)))