Fix switch-project completion defaulting to current project

Affects doom/browse-in-other-project, doom/find-file-in-other-project,
+default/search-other-project and
+default/search-project-for-symbol-at-point.

When performing a text or file search in "another project", prior to
this update the current project would be the first highlighted
candidate, which doesn't make much sense when you're invoking a command
for searching *other* projects.
This commit is contained in:
Henrik Lissner 2020-05-26 14:02:06 -04:00
parent 8d75d72eb0
commit 77a4e8f8a7
No known key found for this signature in database
GPG key ID: 5F6C0EA160557395
2 changed files with 4 additions and 8 deletions

View file

@ -41,8 +41,7 @@ they are absolute."
"Preforms `projectile-find-file' in a known project of your choosing." "Preforms `projectile-find-file' in a known project of your choosing."
(interactive (interactive
(list (list
(completing-read "Find file in project: " (projectile-relevant-known-projects) (completing-read "Find file in project: " (projectile-relevant-known-projects))))
nil nil nil nil (doom-project-root))))
(unless (file-directory-p project-root) (unless (file-directory-p project-root)
(error "Project directory '%s' doesn't exist" project-root)) (error "Project directory '%s' doesn't exist" project-root))
(doom-project-find-file project-root)) (doom-project-find-file project-root))
@ -52,8 +51,7 @@ they are absolute."
"Preforms `find-file' in a known project of your choosing." "Preforms `find-file' in a known project of your choosing."
(interactive (interactive
(list (list
(completing-read "Browse in project: " (projectile-relevant-known-projects) (completing-read "Browse in project: " (projectile-relevant-known-projects))))
nil nil nil nil (doom-project-root))))
(unless (file-directory-p project-root) (unless (file-directory-p project-root)
(error "Project directory '%s' doesn't exist" project-root)) (error "Project directory '%s' doesn't exist" project-root))
(doom-project-browse project-root)) (doom-project-browse project-root))

View file

@ -30,8 +30,7 @@ If prefix ARG is set, prompt for a known project to search from."
(default-directory (default-directory
(if arg (if arg
(if-let (projects (projectile-relevant-known-projects)) (if-let (projects (projectile-relevant-known-projects))
(completing-read "Search project: " projects (completing-read "Search project: " projects nil t)
nil t nil nil (doom-project-root))
(user-error "There are no known projects")) (user-error "There are no known projects"))
default-directory))) default-directory)))
(call-interactively (call-interactively
@ -56,8 +55,7 @@ If prefix ARG is set, prompt for a known project to search from."
(default-directory (default-directory
(if arg (if arg
(if-let (projects (projectile-relevant-known-projects)) (if-let (projects (projectile-relevant-known-projects))
(completing-read "Switch to project: " projects (completing-read "Search project: " projects nil t)
nil t nil nil (doom-project-root))
(user-error "There are no known projects")) (user-error "There are no known projects"))
default-directory))) default-directory)))
(cond ((featurep! :completion ivy) (cond ((featurep! :completion ivy)