unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: storm@cua.dk (Kim F. Storm)
Cc: eggert@twinsun.com, emacs-devel@gnu.org
Subject: Re: Reading directory names with read-file-name
Date: 20 May 2002 01:20:58 +0200	[thread overview]
Message-ID: <5xu1p3zput.fsf@kfs2.cua.dk> (raw)
In-Reply-To: <200205191940.g4JJeRw24012@aztec.santafe.edu>

Richard Stallman <rms@gnu.org> writes:

>     How about allowing READ-DIR to be any predicate, so that the invoker
>     of read-file-name can filter file names in arbitrary ways?
> 
> This could be made consistent with the new locate-file function.
> 
>       I suspect
>     that this would subsume read-file-name's existing MUSTMATCH argument
>     to some extent, since MUSTMATCH=t would be roughly equivalent to
>     READ-DIR=file-exists-p, but I can't think of a cleaner extension
>     offhand.
> 
> This suggests that we should redefine the MUSTMATCH argument
> rather than add a new one.

There is one major difficult here:

The doc string states:

Fourth arg MUSTMATCH non-nil means require existing file's name.
 Non-nil and non-t means also require confirmation after completion.

I've looked through the *.el files, and I've found at least the
following non-nil and non-t values:
    lambda, confirm, must-match, yes

It seems difficult to me to extend the MUSTMATCH argument to cover
both a predicate and the current tri-state behaviour, and do it
in a way which is compatible with locate-file.

It could be a cons (PREDICATE . MUSTMATCH), but in that case, I
thing adding a sixth argument PREDICATE to read-file-name is
simpler.

The predicate need to be passed on the read-file-name-internal, but as
Stefan points out, this is difficult since the predicate argument is
already used for the directory.  Since read-file-name-internal is
overridden by several packages, I don't think changing that API 
is feasible.

Instead, read-file-name could specbind read-file-name-predicate
to the predicate argument, and read-file-name-internal could check
that predicate.

It could also be considered to add a third argument PREDICATE
to file-name-all-completions.


I'm not sure how to proceed.  Please advise!

-- 
Kim F. Storm <storm@cua.dk> http://www.cua.dk

  reply	other threads:[~2002-05-19 23:20 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-05-18 23:33 Reading directory names with read-file-name Kim F. Storm
2002-05-18 22:47 ` Stefan Monnier
2002-05-18 23:00 ` Paul Eggert
2002-05-19 19:40   ` Richard Stallman
2002-05-19 23:20     ` Kim F. Storm [this message]
2002-05-20  0:50       ` Kim F. Storm
2002-05-20 21:33         ` Richard Stallman
2002-05-23 22:04           ` Kim F. Storm
2002-05-23 21:24             ` Stefan Monnier
2002-05-23 22:44               ` Kim F. Storm
2002-05-24 21:14                 ` Richard Stallman
2002-05-24 21:59                   ` Stefan Monnier
2002-05-28 23:11                     ` Kim F. Storm
2002-05-24 21:14               ` Richard Stallman
2002-05-24 22:02                 ` Stefan Monnier
2002-05-20 21:33       ` Richard Stallman

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

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5xu1p3zput.fsf@kfs2.cua.dk \
    --to=storm@cua.dk \
    --cc=eggert@twinsun.com \
    --cc=emacs-devel@gnu.org \
    /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 public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).