From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: storm@cua.dk (Kim F. Storm) Newsgroups: gmane.emacs.devel Subject: Re: Reading directory names with read-file-name Date: 20 May 2002 01:20:58 +0200 Sender: emacs-devel-admin@gnu.org Message-ID: <5xu1p3zput.fsf@kfs2.cua.dk> References: <5xy9eh820e.fsf@kfs2.cua.dk> <200205182300.g4IN0Cm00753@shade.twinsun.com> <200205191940.g4JJeRw24012@aztec.santafe.edu> NNTP-Posting-Host: localhost.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: main.gmane.org 1021846899 3949 127.0.0.1 (19 May 2002 22:21:39 GMT) X-Complaints-To: usenet@main.gmane.org NNTP-Posting-Date: Sun, 19 May 2002 22:21:39 +0000 (UTC) Cc: eggert@twinsun.com, emacs-devel@gnu.org Return-path: Original-Received: from quimby.gnus.org ([80.91.224.244]) by main.gmane.org with esmtp (Exim 3.33 #1 (Debian)) id 179Z3a-00011a-00 for ; Mon, 20 May 2002 00:21:38 +0200 Original-Received: from fencepost.gnu.org ([199.232.76.164]) by quimby.gnus.org with esmtp (Exim 3.12 #1 (Debian)) id 179ZHF-00040E-00 for ; Mon, 20 May 2002 00:35:45 +0200 Original-Received: from localhost ([127.0.0.1] helo=fencepost.gnu.org) by fencepost.gnu.org with esmtp (Exim 3.34 #1 (Debian)) id 179Z3X-0007O2-00; Sun, 19 May 2002 18:21:35 -0400 Original-Received: from mail.filanet.dk ([195.215.206.179]) by fencepost.gnu.org with smtp (Exim 3.34 #1 (Debian)) id 179Z2I-0007L2-00; Sun, 19 May 2002 18:20:18 -0400 Original-Received: from kfs2.cua.dk.cua.dk (unknown [10.1.82.3]) by mail.filanet.dk (Postfix) with SMTP id 2AFC87C016; Sun, 19 May 2002 22:20:14 +0000 (GMT) Original-To: rms@gnu.org In-Reply-To: <200205191940.g4JJeRw24012@aztec.santafe.edu> Original-Lines: 53 User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.2.50 Errors-To: emacs-devel-admin@gnu.org X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.0.9 Precedence: bulk List-Help: List-Post: List-Subscribe: , List-Id: Emacs development discussions. List-Unsubscribe: , List-Archive: Xref: main.gmane.org gmane.emacs.devel:4143 X-Report-Spam: http://spam.gmane.org/gmane.emacs.devel:4143 Richard Stallman 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 http://www.cua.dk