Subject: bug#66114: closed (Re: bug#66114: [PATCH] Fix interactive prompt for selecting checkout directory)

From: [email-masked] (GNU bug Tracking System)
Date: Wed, 14 Feb 2024 16:55:01 +0000

Your bug report

#66114: [PATCH] Fix interactive prompt for selecting checkout directory

which was filed against the emacs package, has been closed.

The explanation is attached below, along with your original report.
If you require more details, please reply to [email-masked].

-- 
66114: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=66114
GNU Bug Tracking System
Contact [email-masked] with problems

Subject: Re: bug#66114: [PATCH] Fix interactive prompt for selecting checkout directory
From: Philip Kaludercic <[email-masked]>
To: Joseph Turner <[email-masked]>
Cc: [email-masked]
Date: Wed, 14 Feb 2024 16:54:15 +0000
List-Id: <debbugs-submit.debbugs.gnu.org>

Joseph Turner <[email-masked]> writes:

> Joseph Turner <[email-masked]> writes:
>
>> Philip Kaludercic <[email-masked]> writes:
>>
>>> Joseph Turner <[email-masked]> writes:
>>>
>>>>                                                  However, the behavior of
>>>> read-file-name is unspecified when a MUSTMATCH function returns nil:
>>>>
>>>> - a function, which will be called with the input as the
>>>>   argument.  If the function returns a non-nil value, the
>>>>   minibuffer is exited with that argument as the value.
>>>>
>>>> Is this a bug, a case of under-documentation, or do I misunderstand something?
>>>>
>>>> I'm happy to post this in a separate bug thread if you think it's worth it.
>>>
>>> Perhaps that would be worth doing, that way the people who know more
>>> about completion than I do would be more likely to see it and help
>>> out.
>>
>> Okay, thanks! I'll do that.
>
> Now that #66187
> (<https://yhetil.org/emacs-bugs/[email-masked]/>)
> and bug#68815
> (<https://yhetil.org/emacs-bugs/[email-masked]/>)
> are fixed on emacs-29, I'm revisiting this issue.
>
> With the following patch, the interactive prompt in package-vc-checkout
> now offers all directory for completion (empty or not), but only exits
> when the minibuffer contains an empty directory or nonexistent filename.
>
> Testing this patch requires checking out emacs-29 after e6c82fe35e3.

LGTM, I've pushed it to emacs-29.  Thanks!

> Thanks!
> Joseph

Subject: [PATCH] Fix interactive prompt for selecting checkout directory
From: Joseph Turner <[email-masked]>
To: [email-masked]
Date: Wed, 20 Sep 2023 00:02:43 -0700
List-Id: <debbugs-submit.debbugs.gnu.org>

Tags: patch

This patch fixes the interactive prompt in package-vc-checkout. See
commit message for details.

>From 70061d76542968575555f247d4715d18ed3c4e75 Mon Sep 17 00:00:00 2001
From: Joseph Turner <[email-masked]>
Date: Tue, 19 Sep 2023 23:58:43 -0700
Subject: [PATCH] Fix interactive prompt for selecting checkout directory

* lisp/emacs-lisp/package-vc.el (package-vc-checkout): Use
read-directory-name instead of read-file-name with
predicate.  Previously, it was impossible to interactively navigate to
a nested subdirectory.
---
 lisp/emacs-lisp/package-vc.el | 17 +++++++++++------
 1 file changed, 11 insertions(+), 6 deletions(-)

diff --git a/lisp/emacs-lisp/package-vc.el b/lisp/emacs-lisp/package-vc.el
index c7a30736e32..29b540d86b8 100644
--- a/lisp/emacs-lisp/package-vc.el
+++ b/lisp/emacs-lisp/package-vc.el
@@ -823,12 +823,17 @@ repository.  If REV has the special value
 `:last-release' (interactively, the prefix argument), that stands
 for the last released version of the package."
   (interactive
-   (let* ((name (package-vc--read-package-name "Fetch package source: ")))
-     (list (cadr (assoc name package-archive-contents #'string=))
-           (read-file-name "Clone into new or empty directory: " nil nil t nil
-                           (lambda (dir) (or (not (file-exists-p dir))
-                                             (directory-empty-p dir))))
-           (and current-prefix-arg :last-release))))
+   (let* ((name (package-vc--read-package-name "Fetch package source: "))
+          (desc (cadr (assoc name package-archive-contents #'string=)))
+          (dir (read-directory-name "Clone into new or empty directory: ")))
+     (unless (or (not (file-exists-p dir))
+                 (directory-empty-p dir))
+       (let ((subdir (expand-file-name (package-desc-full-name desc) dir)))
+         (if (and (not (file-exists-p subdir))
+                  (y-or-n-p (format "Create new directory %s ?" subdir)))
+             (setf dir subdir)
+           (user-error "Directory not empty: %S" (expand-file-name dir)))))
+     (list desc dir (and current-prefix-arg :last-release))))
   (package-vc--archives-initialize)
   (let ((pkg-spec (or (package-vc--desc->spec pkg-desc)
                       (and-let* ((extras (package-desc-extras pkg-desc))
-- 
2.41.0