response causes Emacs to exit the query-replace loop, you can later
continue with @w{@kbd{M-x fileloop-continue @key{RET}}}.
+@findex project-find-dir
+ The command @kbd{C-x p d} (@code{project-find-dir}) prompts you to
+choose a directory inside the current project, with completion.
+And opens a Dired buffer (@pxref{Dired}) listing the files in it.
+
@findex project-dired
- The command @kbd{C-x p d} (@code{project-dired}) opens a Dired
+ The command @kbd{C-x p D} (@code{project-dired}) opens a Dired
buffer (@pxref{Dired}) listing the files in the current project's root
directory.
(define-key map "F" 'project-or-external-find-file)
(define-key map "b" 'project-switch-to-buffer)
(define-key map "s" 'project-shell)
- (define-key map "d" 'project-dired)
+ (define-key map "d" 'project-find-dir)
+ (define-key map "D" 'project-dired)
(define-key map "v" 'project-vc-dir)
(define-key map "c" 'project-compile)
(define-key map "e" 'project-eshell)
nil
hist)))
+;;;###autoload
+(defun project-find-dir ()
+ "Start Dired in a directory inside the current project."
+ (interactive)
+ (let* ((project (project-current 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 (mapcar #'file-name-directory all-files))
+ (dir (funcall project-read-file-name-function
+ "Dired"
+ ;; Some completion UIs show duplicates.
+ (delete-dups all-dirs)
+ nil nil)))
+ (dired dir)))
+
;;;###autoload
(defun project-dired ()
"Start Dired in the current project's root."
(defcustom project-switch-commands
'((project-find-file "Find file")
(project-find-regexp "Find regexp")
- (project-dired "Dired")
+ (project-find-dir "Find directory")
(project-vc-dir "VC-Dir")
(project-eshell "Eshell"))
"Alist mapping commands to descriptions.