Subject: Re: bug#50732: 28.0.50; project-find-dir: blank line in fido-vertical-mode

From: Dmitry Gutov <[email-masked]>
Date: Wed, 22 Sep 2021 15:01:54 +0300

Hi!

On 22.09.2021 11:23, Manuel Uberti wrote:
> This is a quick recipe:
> 
> - emacs -Q
> - M-x fido-vertical-mode RET
> - C-x p d
> - choose a project (I picked my .emacs.d directory)
> - there is a blank line between the prompt and the list of candidates
> - see attached screenshot for details

First of all, it's easy to fix:

diff --git a/lisp/progmodes/project.el b/lisp/progmodes/project.el
index ebd21d4b60..028de4bbdf 100644
--- a/lisp/progmodes/project.el
+++ b/lisp/progmodes/project.el
@@ -943,7 +943,8 @@ project-find-dir
           ;; `project-files-filtered', and see
           ;; https://stackoverflow.com/a/50685235/615245 for possible
           ;; implementation.
-         (all-dirs (mapcar #'file-name-directory all-files))
+         (all-dirs (delete (expand-file-name (project-root project))
+                           (mapcar #'file-name-directory all-files)))
           (dir (funcall project-read-file-name-function
                         "Dired"
                         ;; Some completion UIs show duplicates.

But should it be changed? It seems, while "" is a valid choice (which 
leads to visiting the root directory), without it in the completions set 
fido-vertical-mode doesn't easily allow you to select such option. 
Whereas the default completion UI does.

(Ivy has the same problem, except it never shows "", without or without 
the patch, so I'm fine with either).