From: Joseph Turner via "Bug reports for GNU Emacs, the Swiss army knife of text editors" <bug-gnu-emacs@gnu.org>
To: Michael Heerdegen <michael_heerdegen@web.de>
Cc: philipk@posteo.net, 66187@debbugs.gnu.org
Subject: bug#66187: read-file-name unexpected behavior when MUSTMATCH is a function
Date: Tue, 26 Sep 2023 01:37:12 -0700 [thread overview]
Message-ID: <87v8bx48ww.fsf@breatheoutbreathe.in> (raw)
In-Reply-To: <87pm260wh9.fsf@web.de>
Michael Heerdegen <michael_heerdegen@web.de> writes:
> AFAIU the algorithm
> works like this: first it's checked whether a completion is allowed (by
> checking whether it's the name of an existing file and consulting
> PREDICATE when specified). Only when it is not allowed we check whether
> MUSTMATCH declares it acceptable.
Thank you!! That makes sense now.
> This is not really explained in the docstring, however.
>
> In your example, the default-directory is the name of an existing file,
> so the MUSTMATCH argument is irrelevant, the specified PREDICATE is
> fulfilled, so it's accepted as input.
>
> If I guess correctly I think you want something like this:
>
> #+begin_src emacs-lisp
> (let ((acceptable-p (lambda (filename)
> (and (file-directory-p filename)
> (directory-empty-p filename)))))
> (read-file-name "Clone into new or empty directory: " nil nil
> (lambda (filename)
> (if (file-exists-p filename)
> (funcall acceptable-p filename)
> t))
> nil
> acceptable-p))
> #+end_src
>
> Does that come close?
Thank you! What I was hoping for may not have a clean solution:
- the completions buffer displays and allows tab-completion for all
directories, empty or not, then
- upon pressing RET on a non-empty directory, the "[Match required]"
message appears. Only upon pressing RET on an empty directory does
completion succeed.
If this cannot be accomplished elegantly, I'll consider other designs
for the interactive prompt in package-vc-checkout.
Thanks!!
Joseph
next prev parent reply other threads:[~2023-09-26 8:37 UTC|newest]
Thread overview: 40+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-09-24 21:31 bug#66187: read-file-name unexpected behavior when MUSTMATCH is a function Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-09-25 3:58 ` Michael Heerdegen
2023-09-25 5:12 ` Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-09-25 21:33 ` Michael Heerdegen
2023-09-26 8:37 ` Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors [this message]
2023-09-27 0:26 ` Michael Heerdegen
2023-09-27 0:55 ` Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-09-27 1:43 ` Michael Heerdegen
2023-10-03 21:18 ` Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-10-03 23:00 ` Drew Adams
2023-10-04 3:35 ` Michael Heerdegen
2023-10-04 5:22 ` Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-10-05 1:12 ` Michael Heerdegen
2023-10-04 7:03 ` Eli Zaretskii
2023-10-05 19:34 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-10-05 20:20 ` Drew Adams
2023-10-06 4:47 ` Eli Zaretskii
2023-10-06 13:05 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-10-06 14:08 ` Drew Adams
2023-10-06 4:45 ` Eli Zaretskii
2023-10-06 13:01 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-10-06 13:46 ` Eli Zaretskii
2023-10-06 16:43 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-10-07 5:23 ` Eli Zaretskii
2023-10-07 14:25 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-10-07 15:09 ` Eli Zaretskii
2023-10-07 15:12 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-11-12 21:26 ` Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-11-26 6:49 ` Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-12-18 0:24 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-12-19 2:52 ` Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-01-09 8:06 ` Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-01-25 20:53 ` Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-01-28 19:20 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-01-28 19:28 ` Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-10-06 5:55 ` Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-09-29 12:00 ` Eli Zaretskii
2023-10-03 20:43 ` Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-10-04 6:05 ` Eli Zaretskii
2023-10-04 6:25 ` Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87v8bx48ww.fsf@breatheoutbreathe.in \
--to=bug-gnu-emacs@gnu.org \
--cc=66187@debbugs.gnu.org \
--cc=joseph@breatheoutbreathe.in \
--cc=michael_heerdegen@web.de \
--cc=philipk@posteo.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.