From 9000aeaed446a02aaf0684e02f40312b3a2e0b59 Mon Sep 17 00:00:00 2001 From: Dmitry Gutov Date: Tue, 14 Sep 2021 00:53:05 +0300 Subject: [PATCH] Make sure to return some valid project root * lisp/progmodes/project.el (project-prompt-project-dir): If the user just pressed RET on prompt, prompt again. --- lisp/progmodes/project.el | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lisp/progmodes/project.el b/lisp/progmodes/project.el index ba95ed094ed..d034443907d 100644 --- a/lisp/progmodes/project.el +++ b/lisp/progmodes/project.el @@ -1308,7 +1308,10 @@ It's also possible to enter an arbitrary directory not in the list." ;; completion style). (project--file-completion-table (append project--list `(,dir-choice)))) - (pr-dir (completing-read "Select project: " choices nil t))) + (pr-dir "")) + (while (equal pr-dir "") + ;; If the user simply pressed RET, do this again until they don't. + (setq pr-dir (completing-read "Select project: " choices nil t))) (if (equal pr-dir dir-choice) (read-directory-name "Select directory: " default-directory nil t) pr-dir))) -- 2.39.5