GNU logs - #66224, boring messages


Message sent to bug-gnu-emacs@HIDDEN:


X-Loop: help-debbugs@HIDDEN
Subject: bug#66224: [PATCH] Add optional PREDICATE argument to read-directory-name
Resent-From: Joseph Turner <joseph@HIDDEN>
Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
Resent-CC: bug-gnu-emacs@HIDDEN
Resent-Date: Wed, 27 Sep 2023 01:20:02 +0000
Resent-Message-ID: <handler.66224.B.169577758516905 <at> debbugs.gnu.org>
Resent-Sender: help-debbugs@HIDDEN
X-GNU-PR-Message: report 66224
X-GNU-PR-Package: emacs
X-GNU-PR-Keywords: patch
To: 66224 <at> debbugs.gnu.org
X-Debbugs-Original-To: Emacs Bugs Mailing List <bug-gnu-emacs@HIDDEN>
Received: via spool by submit <at> debbugs.gnu.org id=B.169577758516905
          (code B ref -1); Wed, 27 Sep 2023 01:20:02 +0000
Received: (at submit) by debbugs.gnu.org; 27 Sep 2023 01:19:45 +0000
Received: from localhost ([127.0.0.1]:50132 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1qlJDM-0004Ob-Gm
	for submit <at> debbugs.gnu.org; Tue, 26 Sep 2023 21:19:45 -0400
Received: from lists.gnu.org ([2001:470:142::17]:60550)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <joseph@HIDDEN>) id 1qlJDJ-0004OI-IQ
 for submit <at> debbugs.gnu.org; Tue, 26 Sep 2023 21:19:42 -0400
Received: from eggs.gnu.org ([2001:470:142:3::10])
 by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <joseph@HIDDEN>)
 id 1qlJD1-0005wA-03
 for bug-gnu-emacs@HIDDEN; Tue, 26 Sep 2023 21:19:23 -0400
Received: from out-201.mta1.migadu.com ([2001:41d0:203:375::c9])
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <joseph@HIDDEN>)
 id 1qlJCy-00086J-5y
 for bug-gnu-emacs@HIDDEN; Tue, 26 Sep 2023 21:19:22 -0400
X-Report-Abuse: Please report any abuse attempt to abuse@HIDDEN and
 include these headers.
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=breatheoutbreathe.in; 
 s=key1; t=1695777557;
 h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
 to:to:cc:mime-version:mime-version:content-type:content-type;
 bh=5rCEzZ9V7sWDZ6Wkde6u4YCGWZuWPTQl9Qd9oF0OIUs=;
 b=dMCYpUAWai3AC/TiVUocTnO2m/Cl0VW0aI2dW5HmXnwXkIpu6YT3qcCabeOiMxzMyORR7M
 bWBtKIbQTvOqETTRcbE8evJ693k9hayCZ3WMB0f0l5uOfkvni0suFgm6sz91g7v6Q4vtn1
 Cb4k8CKNJfcoD3+UXShwGIEl37u1jCE=
From: Joseph Turner <joseph@HIDDEN>
Date: Tue, 26 Sep 2023 18:16:40 -0700
Message-ID: <877coch0q7.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="=-=-="
X-Migadu-Flow: FLOW_OUT
Received-SPF: pass client-ip=2001:41d0:203:375::c9;
 envelope-from=joseph@HIDDEN; helo=out-201.mta1.migadu.com
X-Spam_score_int: -16
X-Spam_score: -1.7
X-Spam_bar: -
X-Spam_report: (-1.7 / 5.0 requ) BAYES_00=-1.9, DKIM_INVALID=0.1,
 DKIM_SIGNED=0.1, SPF_HELO_NONE=0.001,
 SPF_PASS=-0.001 autolearn=no autolearn_force=no
X-Spam_action: no action
X-Spam-Score: 0.9 (/)
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -0.1 (/)

--=-=-=
Content-Type: text/plain

Hello!

This patch makes read-directory-name accept an optional PREDICATE arg
so it can be used like read-file-name.

Joseph


--=-=-=
Content-Type: text/x-diff; charset=utf-8
Content-Disposition: attachment;
 filename=0001-Add-optional-PREDICATE-argument-to-read-directory-na.patch
Content-Transfer-Encoding: quoted-printable

From 78ba02683bd163d8991b182ec4e8ec370e734f95 Mon Sep 17 00:00:00 2001
From: Joseph Turner <joseph@HIDDEN>
Date: Tue, 26 Sep 2023 18:14:23 -0700
Subject: [PATCH] Add optional PREDICATE argument to read-directory-name

* lisp/files.el (read-directory-name): Add optional PREDICATE arg.
* doc/lispref/minibuf.texi (Reading File Names): Document change.
* etc/NEWS: Note change.
---
 doc/lispref/minibuf.texi | 6 ++++--
 etc/NEWS                 | 4 ++++
 lisp/files.el            | 8 +++++---
 3 files changed, 13 insertions(+), 5 deletions(-)

diff --git a/doc/lispref/minibuf.texi b/doc/lispref/minibuf.texi
index 620c58ec6e9..c3528ea74d2 100644
--- a/doc/lispref/minibuf.texi
+++ b/doc/lispref/minibuf.texi
@@ -1709,7 +1709,7 @@ If this variable is non-@code{nil}, @code{read-file-n=
ame} ignores case
 when performing completion.
 @end defopt
=20
-@defun read-directory-name prompt &optional directory default require-matc=
h initial
+@defun read-directory-name prompt &optional directory default require-matc=
h initial predicate
 This function is like @code{read-file-name} but allows only directory
 names as completion alternatives.
=20
@@ -1719,7 +1719,9 @@ combining @var{directory} (or the current buffer's de=
fault directory
 if @var{directory} is @code{nil}) and @var{initial}.  If both
 @var{default} and @var{initial} are @code{nil}, this function uses
 @var{directory} as substitute default, or the current buffer's default
-directory if @var{directory} is @code{nil}.
+directory if @var{directory} is @code{nil}.  The union of sixth arg
+@code{predicate} and @code{file-directory-p} is passed as the
+@code{predicate} argument to =E2=80=98read-file-name=E2=80=99.
 @end defun
=20
 @defopt insert-default-directory
diff --git a/etc/NEWS b/etc/NEWS
index 1b3532b5657..ee0143b1958 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -3541,6 +3541,10 @@ This function is called to see whether what the user=
 has typed is a
 match.  This is also available from functions that call
 'completing-read', like 'read-file-name'.
=20
+** 'read-directory-name' now accepts an optional PREDICATE argument.
+The union of sixth arg PREDICATE and 'file-directory-p' is passed
+as the PREDICATE argument to 'read-file-name'.
+
 ** 'posn-col-row' can now give position data based on windows.
 Previously, it reported data only based on the frame.
=20
diff --git a/lisp/files.el b/lisp/files.el
index b72f141c0ee..e78e8ea0a36 100644
--- a/lisp/files.el
+++ b/lisp/files.el
@@ -807,7 +807,7 @@ See Info node `(elisp)Standard File Names' for more det=
ails."
     (dos-convert-standard-filename filename))
    (t filename)))
=20
-(defun read-directory-name (prompt &optional dir default-dirname mustmatch=
 initial)
+(defun read-directory-name (prompt &optional dir default-dirname mustmatch=
 initial predicate)
   "Read directory name, prompting with PROMPT and completing in directory =
DIR.
 Value is not expanded---you must call `expand-file-name' yourself.
 Default name to DEFAULT-DIRNAME if user exits with the same
@@ -821,14 +821,16 @@ Fourth arg MUSTMATCH non-nil means require existing d=
irectory's name.
  Non-nil and non-t means also require confirmation after completion.
 Fifth arg INITIAL specifies text to start with.
 DIR should be an absolute directory name.  It defaults to
-the value of `default-directory'."
+the value of `default-directory'.
+The union of sixth arg PREDICATE and `file-directory-p' is passed
+as the PREDICATE argument to `read-file-name'."
   (unless dir
     (setq dir default-directory))
   (read-file-name prompt dir (or default-dirname
 				 (if initial (expand-file-name initial dir)
 				   dir))
 		  mustmatch initial
-		  'file-directory-p))
+		  (and #'file-directory-p predicate)))
=20
 
 (defun pwd (&optional insert)
--=20
2.41.0


--=-=-=--




Message sent:


Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable
MIME-Version: 1.0
X-Mailer: MIME-tools 5.505 (Entity 5.505)
Content-Type: text/plain; charset=utf-8
X-Loop: help-debbugs@HIDDEN
From: help-debbugs@HIDDEN (GNU bug Tracking System)
To: Joseph Turner <joseph@HIDDEN>
Subject: bug#66224: Acknowledgement ([PATCH] Add optional PREDICATE
 argument to read-directory-name)
Message-ID: <handler.66224.B.169577758516905.ack <at> debbugs.gnu.org>
References: <877coch0q7.fsf@HIDDEN>
X-Gnu-PR-Message: ack 66224
X-Gnu-PR-Package: emacs
X-Gnu-PR-Keywords: patch
Reply-To: 66224 <at> debbugs.gnu.org
Date: Wed, 27 Sep 2023 01:20:02 +0000

Thank you for filing a new bug report with debbugs.gnu.org.

This is an automatically generated reply to let you know your message
has been received.

Your message is being forwarded to the package maintainers and other
interested parties for their attention; they will reply in due course.

Your message has been sent to the package maintainer(s):
 bug-gnu-emacs@HIDDEN

If you wish to submit further information on this problem, please
send it to 66224 <at> debbugs.gnu.org.

Please do not send mail to help-debbugs@HIDDEN unless you wish
to report a problem with the Bug-tracking system.

--=20
66224: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=3D66224
GNU Bug Tracking System
Contact help-debbugs@HIDDEN with problems


Message sent to bug-gnu-emacs@HIDDEN:


X-Loop: help-debbugs@HIDDEN
Subject: bug#66224: [PATCH] Add optional PREDICATE argument to read-directory-name
Resent-From: Philip Kaludercic <philipk@HIDDEN>
Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
Resent-CC: bug-gnu-emacs@HIDDEN
Resent-Date: Thu, 28 Sep 2023 09:06:01 +0000
Resent-Message-ID: <handler.66224.B66224.169589193010591 <at> debbugs.gnu.org>
Resent-Sender: help-debbugs@HIDDEN
X-GNU-PR-Message: followup 66224
X-GNU-PR-Package: emacs
X-GNU-PR-Keywords: patch
To: Joseph Turner <joseph@HIDDEN>
Cc: 66224 <at> debbugs.gnu.org
Received: via spool by 66224-submit <at> debbugs.gnu.org id=B66224.169589193010591
          (code B ref 66224); Thu, 28 Sep 2023 09:06:01 +0000
Received: (at 66224) by debbugs.gnu.org; 28 Sep 2023 09:05:30 +0000
Received: from localhost ([127.0.0.1]:52968 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1qlmxe-0002kk-DP
	for submit <at> debbugs.gnu.org; Thu, 28 Sep 2023 05:05:30 -0400
Received: from mout02.posteo.de ([185.67.36.66]:38805)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <philipk@HIDDEN>) id 1qlmxZ-0002kQ-8e
 for 66224 <at> debbugs.gnu.org; Thu, 28 Sep 2023 05:05:29 -0400
Received: from submission (posteo.de [185.67.36.169]) 
 by mout02.posteo.de (Postfix) with ESMTPS id 3FF8C240101
 for <66224 <at> debbugs.gnu.org>; Thu, 28 Sep 2023 11:05:05 +0200 (CEST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017;
 t=1695891905; bh=mIdMKR5/dCQ0gNnnEArPB32opQmUHcUnYO8tvCJdfNo=;
 h=From:To:Cc:Subject:Autocrypt:Date:Message-ID:MIME-Version:
 Content-Transfer-Encoding:From;
 b=BKnRJONGJsjicQdvPyLPfOoX2fiYgaxFDaOl8q73LtrkpUBjoFkipFldl72mO+uQt
 G76CStI2+JeUO7jKACsg831c1IGlmzmUTM1cbTUSrXWuVOLENgK0YX/qeUVFDgnuX7
 tp3qDgUQZ01M5VFYQPVLqHLuZ0d6v/HNNP5sdh7FG2Q3ruxqWvbgZOvNILyLT2VbPj
 +fnJhzcRvetNXmVooWZq7WYXroUc/pWAGqH6Qn5mWzDpumX8nNWxuWniJl54KSgi5V
 gaQ48h5zu0prtxT6+VhTPqXH6yADiCip6usYAFVLXBOID6owoed2oMTTw/7TWA25dY
 UFunZ7tREIDHw==
Received: from customer (localhost [127.0.0.1])
 by submission (posteo.de) with ESMTPSA id 4Rx6xr0xGcz6v3D;
 Thu, 28 Sep 2023 11:05:03 +0200 (CEST)
From: Philip Kaludercic <philipk@HIDDEN>
In-Reply-To: <877coch0q7.fsf@HIDDEN> (Joseph Turner's message of
 "Tue, 26 Sep 2023 18:16:40 -0700")
References: <877coch0q7.fsf@HIDDEN>
Autocrypt: addr=philipk@HIDDEN; keydata=
 mDMEZBBQQhYJKwYBBAHaRw8BAQdAHJuofBrfqFh12uQu0Yi7mrl525F28eTmwUDflFNmdui0QlBo
 aWxpcCBLYWx1ZGVyY2ljIChnZW5lcmF0ZWQgYnkgYXV0b2NyeXB0LmVsKSA8cGhpbGlwa0Bwb3N0
 ZW8ubmV0PoiWBBMWCAA+FiEEDg7HY17ghYlni8XN8xYDWXahwukFAmQQUEICGwMFCQHhM4AFCwkI
 BwIGFQoJCAsCBBYCAwECHgECF4AACgkQ8xYDWXahwulikAEA77hloUiSrXgFkUVJhlKBpLCHUjA0
 mWZ9j9w5d08+jVwBAK6c4iGP7j+/PhbkxaEKa4V3MzIl7zJkcNNjHCXmvFcEuDgEZBBQQhIKKwYB
 BAGXVQEFAQEHQI5NLiLRjZy3OfSt1dhCmFyn+fN/QKELUYQetiaoe+MMAwEIB4h+BBgWCAAmFiEE
 Dg7HY17ghYlni8XN8xYDWXahwukFAmQQUEICGwwFCQHhM4AACgkQ8xYDWXahwukm+wEA8cml4JpK
 NeAu65rg+auKrPOP6TP/4YWRCTIvuYDm0joBALw98AMz7/qMHvSCeU/hw9PL6u6R2EScxtpKnWof
 z4oM
Date: Thu, 28 Sep 2023 09:05:03 +0000
Message-ID: <874jje1xds.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable
X-Spam-Score: -2.3 (--)
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

Joseph Turner <joseph@HIDDEN> writes:

> Hello!
>
> This patch makes read-directory-name accept an optional PREDICATE arg
> so it can be used like read-file-name.
>
> Joseph
>
>>From 78ba02683bd163d8991b182ec4e8ec370e734f95 Mon Sep 17 00:00:00 2001
> From: Joseph Turner <joseph@HIDDEN>
> Date: Tue, 26 Sep 2023 18:14:23 -0700
> Subject: [PATCH] Add optional PREDICATE argument to read-directory-name
>
> * lisp/files.el (read-directory-name): Add optional PREDICATE arg.
> * doc/lispref/minibuf.texi (Reading File Names): Document change.
> * etc/NEWS: Note change.
> ---
>  doc/lispref/minibuf.texi | 6 ++++--
>  etc/NEWS                 | 4 ++++
>  lisp/files.el            | 8 +++++---
>  3 files changed, 13 insertions(+), 5 deletions(-)
>
> diff --git a/doc/lispref/minibuf.texi b/doc/lispref/minibuf.texi
> index 620c58ec6e9..c3528ea74d2 100644
> --- a/doc/lispref/minibuf.texi
> +++ b/doc/lispref/minibuf.texi
> @@ -1709,7 +1709,7 @@ If this variable is non-@code{nil}, @code{read-file=
-name} ignores case
>  when performing completion.
>  @end defopt
>=20=20
> -@defun read-directory-name prompt &optional directory default require-ma=
tch initial
> +@defun read-directory-name prompt &optional directory default require-ma=
tch initial predicate
>  This function is like @code{read-file-name} but allows only directory
>  names as completion alternatives.
>=20=20
> @@ -1719,7 +1719,9 @@ combining @var{directory} (or the current buffer's =
default directory
>  if @var{directory} is @code{nil}) and @var{initial}.  If both
>  @var{default} and @var{initial} are @code{nil}, this function uses
>  @var{directory} as substitute default, or the current buffer's default
> -directory if @var{directory} is @code{nil}.
> +directory if @var{directory} is @code{nil}.  The union of sixth arg
> +@code{predicate} and @code{file-directory-p} is passed as the
> +@code{predicate} argument to =E2=80=98read-file-name=E2=80=99.
>  @end defun
>=20=20
>  @defopt insert-default-directory
> diff --git a/etc/NEWS b/etc/NEWS
> index 1b3532b5657..ee0143b1958 100644
> --- a/etc/NEWS
> +++ b/etc/NEWS
> @@ -3541,6 +3541,10 @@ This function is called to see whether what the us=
er has typed is a
>  match.  This is also available from functions that call
>  'completing-read', like 'read-file-name'.
>=20=20
> +** 'read-directory-name' now accepts an optional PREDICATE argument.
> +The union of sixth arg PREDICATE and 'file-directory-p' is passed
> +as the PREDICATE argument to 'read-file-name'.
> +
>  ** 'posn-col-row' can now give position data based on windows.
>  Previously, it reported data only based on the frame.
>=20=20
> diff --git a/lisp/files.el b/lisp/files.el
> index b72f141c0ee..e78e8ea0a36 100644
> --- a/lisp/files.el
> +++ b/lisp/files.el
> @@ -807,7 +807,7 @@ See Info node `(elisp)Standard File Names' for more d=
etails."
>      (dos-convert-standard-filename filename))
>     (t filename)))
>=20=20
> -(defun read-directory-name (prompt &optional dir default-dirname mustmat=
ch initial)
> +(defun read-directory-name (prompt &optional dir default-dirname mustmat=
ch initial predicate)
>    "Read directory name, prompting with PROMPT and completing in director=
y DIR.
>  Value is not expanded---you must call `expand-file-name' yourself.
>  Default name to DEFAULT-DIRNAME if user exits with the same
> @@ -821,14 +821,16 @@ Fourth arg MUSTMATCH non-nil means require existing=
 directory's name.
>   Non-nil and non-t means also require confirmation after completion.
>  Fifth arg INITIAL specifies text to start with.
>  DIR should be an absolute directory name.  It defaults to
> -the value of `default-directory'."
> +the value of `default-directory'.
> +The union of sixth arg PREDICATE and `file-directory-p' is passed
> +as the PREDICATE argument to `read-file-name'."
>    (unless dir
>      (setq dir default-directory))
>    (read-file-name prompt dir (or default-dirname
>  				 (if initial (expand-file-name initial dir)
>  				   dir))
>  		  mustmatch initial
> -		  'file-directory-p))
> +		  (and #'file-directory-p predicate)))

I am not sure this makes sense, #'file-directory-p is always non-nil but
a PREDICATE will only be passed on to `read-file-name' is PREDICATE is
also non-nil.  So if no PREDICATE is passed, the expression ignored
#'file-directory-p, breaking `read-directory-name', or am I mistaken (I
haven't tried it out)?

>=20=20
>  
>  (defun pwd (&optional insert)




Message sent to bug-gnu-emacs@HIDDEN:


X-Loop: help-debbugs@HIDDEN
Subject: bug#66224: [PATCH] Add optional PREDICATE argument to read-directory-name
Resent-From: Joseph Turner <joseph@HIDDEN>
Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
Resent-CC: bug-gnu-emacs@HIDDEN
Resent-Date: Fri, 29 Sep 2023 03:32:02 +0000
Resent-Message-ID: <handler.66224.B66224.169595827711521 <at> debbugs.gnu.org>
Resent-Sender: help-debbugs@HIDDEN
X-GNU-PR-Message: followup 66224
X-GNU-PR-Package: emacs
X-GNU-PR-Keywords: patch
To: Philip Kaludercic <philipk@HIDDEN>
Cc: 66224 <at> debbugs.gnu.org
Received: via spool by 66224-submit <at> debbugs.gnu.org id=B66224.169595827711521
          (code B ref 66224); Fri, 29 Sep 2023 03:32:02 +0000
Received: (at 66224) by debbugs.gnu.org; 29 Sep 2023 03:31:17 +0000
Received: from localhost ([127.0.0.1]:54782 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1qm4Dk-0002zl-SX
	for submit <at> debbugs.gnu.org; Thu, 28 Sep 2023 23:31:17 -0400
Received: from out-199.mta1.migadu.com ([95.215.58.199]:32365)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <joseph@HIDDEN>) id 1qm4Dg-0002zY-0Q
 for 66224 <at> debbugs.gnu.org; Thu, 28 Sep 2023 23:31:15 -0400
References: <877coch0q7.fsf@HIDDEN> <874jje1xds.fsf@HIDDEN>
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=breatheoutbreathe.in; 
 s=key1; t=1695958255;
 h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
 to:to:cc:cc:mime-version:mime-version:content-type:content-type:
 in-reply-to:in-reply-to:references:references;
 bh=2j6w60YjBnzMbBG2Wvtcc0ykQ/ltLLQYmvzIko0fTow=;
 b=IjzCVZ4Czj8fPOVz7Xsb05L5Ro64enRzVJZIdOyaZ9VAF1bvO404OnEH+xFAxld/pkbU8N
 mQRXbHkFbyUgnFdVN0drdMEDRUqNEPGcfQPfqydia64FZLHdM6hkiQvdFUo15FQAuA03MT
 4yZkmn0RQelc5H15lMYLwlJffoQBtg4=
X-Report-Abuse: Please report any abuse attempt to abuse@HIDDEN and
 include these headers.
From: Joseph Turner <joseph@HIDDEN>
Date: Thu, 28 Sep 2023 20:28:52 -0700
In-reply-to: <874jje1xds.fsf@HIDDEN>
Message-ID: <87edihy7tg.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="=-=-="
X-Migadu-Flow: FLOW_OUT
X-Spam-Score: 0.0 (/)
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

--=-=-=
Content-Type: text/plain


Philip Kaludercic <philipk@HIDDEN> writes:
>
> I am not sure this makes sense, #'file-directory-p is always non-nil but
> a PREDICATE will only be passed on to `read-file-name' is PREDICATE is
> also non-nil.  So if no PREDICATE is passed, the expression ignored
> #'file-directory-p, breaking `read-directory-name', or am I mistaken (I
> haven't tried it out)?

Oops! Thanks for catching my error!! The attached patch should actually
do what I intended.

Joseph


--=-=-=
Content-Type: text/x-diff
Content-Disposition: attachment;
 filename=0001-Add-optional-PREDICATE-argument-to-read-directory-na.patch

From 58f4215a6742c6cefc318f84544cc74495c901c1 Mon Sep 17 00:00:00 2001
From: Joseph Turner <joseph@HIDDEN>
Date: Thu, 28 Sep 2023 20:27:47 -0700
Subject: [PATCH] Add optional PREDICATE argument to read-directory-name

* lisp/files.el (read-directory-name): Add optional PREDICATE arg.
* doc/lispref/minibuf.texi (Reading File Names): Document change.
* etc/NEWS: Note change.
---
 doc/lispref/minibuf.texi |  7 +++++--
 etc/NEWS                 |  5 +++++
 lisp/files.el            | 13 ++++++++++---
 3 files changed, 20 insertions(+), 5 deletions(-)

diff --git a/doc/lispref/minibuf.texi b/doc/lispref/minibuf.texi
index 620c58ec6e9..bf4d6e13d3a 100644
--- a/doc/lispref/minibuf.texi
+++ b/doc/lispref/minibuf.texi
@@ -1709,7 +1709,7 @@ If this variable is non-@code{nil}, @code{read-file-name} ignores case
 when performing completion.
 @end defopt
 
-@defun read-directory-name prompt &optional directory default require-match initial
+@defun read-directory-name prompt &optional directory default require-match initial predicate
 This function is like @code{read-file-name} but allows only directory
 names as completion alternatives.
 
@@ -1719,7 +1719,10 @@ combining @var{directory} (or the current buffer's default directory
 if @var{directory} is @code{nil}) and @var{initial}.  If both
 @var{default} and @var{initial} are @code{nil}, this function uses
 @var{directory} as substitute default, or the current buffer's default
-directory if @var{directory} is @code{nil}.
+directory if @var{directory} is @code{nil}.  When optional sixth
+argument @code{predicate} is non-nil, the union of @code{predicate}
+and @code{file-directory-p} is passed as the @code{predicate} argument
+to @code{read-file-name}.
 @end defun
 
 @defopt insert-default-directory
diff --git a/etc/NEWS b/etc/NEWS
index 1b3532b5657..fb9f6a0b43f 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -3541,6 +3541,11 @@ This function is called to see whether what the user has typed is a
 match.  This is also available from functions that call
 'completing-read', like 'read-file-name'.
 
+** 'read-directory-name' now accepts an optional PREDICATE argument.
+When optional sixth argument PREDICATE is non-nil, the union of
+PREDICATE and 'file-directory-p' is passed as the PREDICATE argument
+to 'read-file-name'.
+
 ** 'posn-col-row' can now give position data based on windows.
 Previously, it reported data only based on the frame.
 
diff --git a/lisp/files.el b/lisp/files.el
index b72f141c0ee..17f433fd339 100644
--- a/lisp/files.el
+++ b/lisp/files.el
@@ -807,7 +807,7 @@ See Info node `(elisp)Standard File Names' for more details."
     (dos-convert-standard-filename filename))
    (t filename)))
 
-(defun read-directory-name (prompt &optional dir default-dirname mustmatch initial)
+(defun read-directory-name (prompt &optional dir default-dirname mustmatch initial predicate)
   "Read directory name, prompting with PROMPT and completing in directory DIR.
 Value is not expanded---you must call `expand-file-name' yourself.
 Default name to DEFAULT-DIRNAME if user exits with the same
@@ -821,14 +821,21 @@ Fourth arg MUSTMATCH non-nil means require existing directory's name.
  Non-nil and non-t means also require confirmation after completion.
 Fifth arg INITIAL specifies text to start with.
 DIR should be an absolute directory name.  It defaults to
-the value of `default-directory'."
+the value of `default-directory'.
+When sixth arg PREDICATE is non-nil, the union of PREDICATE and
+`file-directory-p' is passed as the PREDICATE argument to
+`read-file-name'. Otherwise, only `file-directory-p' is passed."
   (unless dir
     (setq dir default-directory))
   (read-file-name prompt dir (or default-dirname
 				 (if initial (expand-file-name initial dir)
 				   dir))
 		  mustmatch initial
-		  'file-directory-p))
+                  (lambda (filename)
+                    (if predicate
+                        (and (file-directory-p filename)
+                             (funcall predicate filename))
+                      (file-directory-p filename)))))
 
 
 (defun pwd (&optional insert)
-- 
2.41.0


--=-=-=--




Message sent to bug-gnu-emacs@HIDDEN:


X-Loop: help-debbugs@HIDDEN
Subject: bug#66224: [PATCH] Add optional PREDICATE argument to read-directory-name
Resent-From: Joseph Turner <joseph@HIDDEN>
Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
Resent-CC: bug-gnu-emacs@HIDDEN
Resent-Date: Fri, 29 Sep 2023 03:32:02 +0000
Resent-Message-ID: <handler.66224.B66224.169595828411541 <at> debbugs.gnu.org>
Resent-Sender: help-debbugs@HIDDEN
X-GNU-PR-Message: followup 66224
X-GNU-PR-Package: emacs
X-GNU-PR-Keywords: patch
To: Philip Kaludercic <philipk@HIDDEN>
Cc: 66224 <at> debbugs.gnu.org
Received: via spool by 66224-submit <at> debbugs.gnu.org id=B66224.169595828411541
          (code B ref 66224); Fri, 29 Sep 2023 03:32:02 +0000
Received: (at 66224) by debbugs.gnu.org; 29 Sep 2023 03:31:24 +0000
Received: from localhost ([127.0.0.1]:54785 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1qm4Dr-000305-DJ
	for submit <at> debbugs.gnu.org; Thu, 28 Sep 2023 23:31:23 -0400
Received: from out-197.mta1.migadu.com ([95.215.58.197]:32587)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <joseph@HIDDEN>) id 1qm4Dp-0002zv-Bf
 for 66224 <at> debbugs.gnu.org; Thu, 28 Sep 2023 23:31:22 -0400
References: <877coch0q7.fsf@HIDDEN> <874jje1xds.fsf@HIDDEN>
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=breatheoutbreathe.in; 
 s=key1; t=1695958266;
 h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
 to:to:cc:cc:mime-version:mime-version:content-type:content-type:
 in-reply-to:in-reply-to:references:references;
 bh=2j6w60YjBnzMbBG2Wvtcc0ykQ/ltLLQYmvzIko0fTow=;
 b=LBZh2rMA55V9ZF9sXAwQRO8tuP50NDgp4JTcn4plqTcUoH24opi58V0Aq5WpOT/JXBv10f
 hUJcQdsdB5QtqVhz09MFd11AwGKTQCeVg99Zs5+ZUuWMK+/wUzFeuUu9BUymmjlcGjeYs1
 1HSdZs1XzCIVdcM14f8Qs/Yptzj14d0=
X-Report-Abuse: Please report any abuse attempt to abuse@HIDDEN and
 include these headers.
From: Joseph Turner <joseph@HIDDEN>
Date: Thu, 28 Sep 2023 20:28:52 -0700
In-reply-to: <874jje1xds.fsf@HIDDEN>
Message-ID: <87bkdly7t4.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="=-=-="
X-Migadu-Flow: FLOW_OUT
X-Spam-Score: 0.0 (/)
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

--=-=-=
Content-Type: text/plain


Philip Kaludercic <philipk@HIDDEN> writes:
>
> I am not sure this makes sense, #'file-directory-p is always non-nil but
> a PREDICATE will only be passed on to `read-file-name' is PREDICATE is
> also non-nil.  So if no PREDICATE is passed, the expression ignored
> #'file-directory-p, breaking `read-directory-name', or am I mistaken (I
> haven't tried it out)?

Oops! Thanks for catching my error!! The attached patch should actually
do what I intended.

Joseph


--=-=-=
Content-Type: text/x-diff
Content-Disposition: attachment;
 filename=0001-Add-optional-PREDICATE-argument-to-read-directory-na.patch

From 58f4215a6742c6cefc318f84544cc74495c901c1 Mon Sep 17 00:00:00 2001
From: Joseph Turner <joseph@HIDDEN>
Date: Thu, 28 Sep 2023 20:27:47 -0700
Subject: [PATCH] Add optional PREDICATE argument to read-directory-name

* lisp/files.el (read-directory-name): Add optional PREDICATE arg.
* doc/lispref/minibuf.texi (Reading File Names): Document change.
* etc/NEWS: Note change.
---
 doc/lispref/minibuf.texi |  7 +++++--
 etc/NEWS                 |  5 +++++
 lisp/files.el            | 13 ++++++++++---
 3 files changed, 20 insertions(+), 5 deletions(-)

diff --git a/doc/lispref/minibuf.texi b/doc/lispref/minibuf.texi
index 620c58ec6e9..bf4d6e13d3a 100644
--- a/doc/lispref/minibuf.texi
+++ b/doc/lispref/minibuf.texi
@@ -1709,7 +1709,7 @@ If this variable is non-@code{nil}, @code{read-file-name} ignores case
 when performing completion.
 @end defopt
 
-@defun read-directory-name prompt &optional directory default require-match initial
+@defun read-directory-name prompt &optional directory default require-match initial predicate
 This function is like @code{read-file-name} but allows only directory
 names as completion alternatives.
 
@@ -1719,7 +1719,10 @@ combining @var{directory} (or the current buffer's default directory
 if @var{directory} is @code{nil}) and @var{initial}.  If both
 @var{default} and @var{initial} are @code{nil}, this function uses
 @var{directory} as substitute default, or the current buffer's default
-directory if @var{directory} is @code{nil}.
+directory if @var{directory} is @code{nil}.  When optional sixth
+argument @code{predicate} is non-nil, the union of @code{predicate}
+and @code{file-directory-p} is passed as the @code{predicate} argument
+to @code{read-file-name}.
 @end defun
 
 @defopt insert-default-directory
diff --git a/etc/NEWS b/etc/NEWS
index 1b3532b5657..fb9f6a0b43f 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -3541,6 +3541,11 @@ This function is called to see whether what the user has typed is a
 match.  This is also available from functions that call
 'completing-read', like 'read-file-name'.
 
+** 'read-directory-name' now accepts an optional PREDICATE argument.
+When optional sixth argument PREDICATE is non-nil, the union of
+PREDICATE and 'file-directory-p' is passed as the PREDICATE argument
+to 'read-file-name'.
+
 ** 'posn-col-row' can now give position data based on windows.
 Previously, it reported data only based on the frame.
 
diff --git a/lisp/files.el b/lisp/files.el
index b72f141c0ee..17f433fd339 100644
--- a/lisp/files.el
+++ b/lisp/files.el
@@ -807,7 +807,7 @@ See Info node `(elisp)Standard File Names' for more details."
     (dos-convert-standard-filename filename))
    (t filename)))
 
-(defun read-directory-name (prompt &optional dir default-dirname mustmatch initial)
+(defun read-directory-name (prompt &optional dir default-dirname mustmatch initial predicate)
   "Read directory name, prompting with PROMPT and completing in directory DIR.
 Value is not expanded---you must call `expand-file-name' yourself.
 Default name to DEFAULT-DIRNAME if user exits with the same
@@ -821,14 +821,21 @@ Fourth arg MUSTMATCH non-nil means require existing directory's name.
  Non-nil and non-t means also require confirmation after completion.
 Fifth arg INITIAL specifies text to start with.
 DIR should be an absolute directory name.  It defaults to
-the value of `default-directory'."
+the value of `default-directory'.
+When sixth arg PREDICATE is non-nil, the union of PREDICATE and
+`file-directory-p' is passed as the PREDICATE argument to
+`read-file-name'. Otherwise, only `file-directory-p' is passed."
   (unless dir
     (setq dir default-directory))
   (read-file-name prompt dir (or default-dirname
 				 (if initial (expand-file-name initial dir)
 				   dir))
 		  mustmatch initial
-		  'file-directory-p))
+                  (lambda (filename)
+                    (if predicate
+                        (and (file-directory-p filename)
+                             (funcall predicate filename))
+                      (file-directory-p filename)))))
 
 
 (defun pwd (&optional insert)
-- 
2.41.0


--=-=-=--




Message sent to bug-gnu-emacs@HIDDEN:


X-Loop: help-debbugs@HIDDEN
Subject: bug#66224: [PATCH] Add optional PREDICATE argument to read-directory-name
Resent-From: Michael Heerdegen <michael_heerdegen@HIDDEN>
Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
Resent-CC: bug-gnu-emacs@HIDDEN
Resent-Date: Fri, 29 Sep 2023 03:55:02 +0000
Resent-Message-ID: <handler.66224.B66224.169595970114356 <at> debbugs.gnu.org>
Resent-Sender: help-debbugs@HIDDEN
X-GNU-PR-Message: followup 66224
X-GNU-PR-Package: emacs
X-GNU-PR-Keywords: patch
To: 66224 <at> debbugs.gnu.org
Cc: philipk@HIDDEN, joseph@HIDDEN
X-Debbugs-Original-To: Joseph Turner via "Bug reports for GNU Emacs, the Swiss army knife of text editors" <bug-gnu-emacs@HIDDEN>
X-Debbugs-Original-Cc: Philip Kaludercic <philipk@HIDDEN>, 66224 <at> debbugs.gnu.org, Joseph Turner <joseph@HIDDEN>
Received: via spool by 66224-submit <at> debbugs.gnu.org id=B66224.169595970114356
          (code B ref 66224); Fri, 29 Sep 2023 03:55:02 +0000
Received: (at 66224) by debbugs.gnu.org; 29 Sep 2023 03:55:01 +0000
Received: from localhost ([127.0.0.1]:54800 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1qm4ai-0003jU-T2
	for submit <at> debbugs.gnu.org; Thu, 28 Sep 2023 23:55:01 -0400
Received: from mout.web.de ([212.227.15.3]:54833)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <michael_heerdegen@HIDDEN>) id 1qm4ab-0003j7-6Q
 for 66224 <at> debbugs.gnu.org; Thu, 28 Sep 2023 23:54:58 -0400
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=web.de; s=s29768273;
 t=1695959670; x=1696564470; i=michael_heerdegen@HIDDEN;
 bh=rlFbgCo+Lr6XN82Wj3RoZcbRmE6WttQS9omMjBxIj/M=;
 h=X-UI-Sender-Class:From:To:Cc:Subject:In-Reply-To:References:Date;
 b=T5R4BI6A2efsiLO7QVPIUOpN9O5zECsAUBVPedXBbqkkeeIrLMqKKuulhT0n/uctAeR3Clip8Wa
 0UP4GFLrMfwq1nh8yWMwz+o6zpPKP2w90gJl7MIFjbV8JF8hgdsIRcp0d/2bjp4r2Br6bLv9Sc7eo
 fMix9MmlIkDbCueAcQB5EDvl04uqZ5wfebiQpc/8N4WAlWPBdzoFkZ3CMjW5ssE6CfhE5krd6ATp3
 QiU4dswQeVJ2u2wVwhSmiy4iyLbD0mK9llTbnEHuaFoQAjBo+tnNo+hBHkZTGn+FR6WENXaCBbvXK
 OFk5ld4bSX66aU6NMw6avo/iTaQ1BhJ0yzjA==
X-UI-Sender-Class: 814a7b36-bfc1-4dae-8640-3722d8ec6cd6
Received: from drachen.dragon ([88.66.201.191]) by smtp.web.de (mrweb006
 [213.165.67.108]) with ESMTPSA (Nemesis) id 1M8Bvz-1qhPkL2c6N-005G0r; Fri, 29
 Sep 2023 05:54:30 +0200
From: Michael Heerdegen <michael_heerdegen@HIDDEN>
In-Reply-To: <87bkdly7t4.fsf@HIDDEN> (Joseph Turner via's
 message of "Thu, 28 Sep 2023 20:28:52 -0700")
References: <877coch0q7.fsf@HIDDEN> <874jje1xds.fsf@HIDDEN>
 <87bkdly7t4.fsf@HIDDEN>
Date: Fri, 29 Sep 2023 05:54:31 +0200
Message-ID: <871qehr5vs.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13)
MIME-Version: 1.0
Content-Type: text/plain
X-Provags-ID: V03:K1:/wiNMQAEz9qiyMHs+bsHznFFNVeH++/HvMdjPX/2XB/x+95o6Ml
 k1+Yk1EJAoCrj/kmgoTWt+9FweiLq1QmbMAQeDq/cE9zyR4A3lME53a4LScY7fmicCump7k
 SuygcgIuQgOR5R6+qUXbtPn7dx/+KxX9YiR7FctzkxejILpFM9uf5todQwVpPDYO2HMbekO
 mn9C2XJZAzC9BXS9310Yw==
X-Spam-Flag: NO
UI-OutboundReport: notjunk:1;M01:P0:q7VMDmB6kwY=;wL1LOKNzGq+u8NxHn9jmlLdqhGE
 /G4NIdN8nLEvPKbc0BY/f8oQSh17ATAVWhgoqTM/BD7reRITZQ72rmslxwqPewnZBr0X8XAnR
 TbUjMHmfd2nqJw2R72V2j8SVR6hAjCBVI1iIr6LrW+c7a/afN2Yj6260xaH0Gu2K6FtSx/03b
 3jtwmw0Auk1xqrgyiMcLsx6fiZNSPZXHmxs88tzQ6tHFHIXF4ocrt4XjY7tgyu9rC3V/4UIa2
 RdgWBTFjUcnKol11u+IBlKjYavYZ8xG02HyV5j4rL8biKjQPUYpI5YlLF2DAhnnnzr+53EMFG
 nAWx8lyZ7ascil1rYmPOUhA1N7kTh3iNTwBmaaE4oKsKD7CwT27Qn4z245ETF/4qqokDoi7rC
 /hvZtdMVUBP95dQVya8+txTgckKlE3kchTIL3FPsBjVZ1Ct8T0GymlhjX6r5fi4dAdLSzfRV1
 DmEPucwoAX2ceYawR2E1CW3pLHtUZdWnWIE43EWnkVWJZ5GSvYm7WEgn2Kx0VwQBogNsphJBV
 MIJcnPGDbsmD5aerNWi982UOYhHzSHXhoEJKRZyGyS9/7lJ4HR7v0tDE/SfNz9rAr+axC+n40
 c2n3DAMOXKajga2C6dnFxJx5JffwAN/6kY3dKtohZ0WPZD83ck61fEEnXbqWuzKmBYzVxXCdf
 7htShobESIO+jXzqLD4LiSltIixAP8DlCtInx1cvo5J9KY2aUNa0mykDmJuyhuO4hb6+5nLWr
 wxjhfFeCcAW4xj3e9xQeZCiNOIIIXuGBGyBqel5JXAnmrb4ZaeqCsvkSlG1LtEcyFmxzxWz9h
 UeFC65DyFH51WBHVtG1nWseA0Hyfca1IB3H0IxxcRfubZkqqbu8PlgnIZGSyQuOg9cUU/Y+WF
 AbUowVAfEueGE2inwQGWCOxrfCM7Jqs+rDfygxBq8XxMcO13wVS4fGDanO+PdhGrzb/9k4wvi
 mPWYWzoEKrr8G7j/Zaq7vLFx9rI=
X-Spam-Score: -0.7 (/)
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.7 (-)

Joseph Turner via "Bug reports for GNU Emacs, the Swiss army knife of
text editors" <bug-gnu-emacs@HIDDEN> writes:

> -		  'file-directory-p))
> +                  (lambda (filename)
> +                    (if predicate
> +                        (and (file-directory-p filename)
> +                             (funcall predicate filename))
> +                      (file-directory-p filename)))))

Yip.  Nitpick: The code will be faster if you move the test out of the
predicate (so that it will not be performed repeatedly):

#+begin_src emacs-lisp
(if predicate
    (lambda (filename)
      (and (file-directory-p filename)
           (funcall predicate filename)))
  #'file-directory-p)
#+end_src


Michael.





Message sent to bug-gnu-emacs@HIDDEN:


X-Loop: help-debbugs@HIDDEN
Subject: bug#66224: [PATCH] Add optional PREDICATE argument to read-directory-name
Resent-From: Michael Heerdegen <michael_heerdegen@HIDDEN>
Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
Resent-CC: bug-gnu-emacs@HIDDEN
Resent-Date: Fri, 29 Sep 2023 03:56:02 +0000
Resent-Message-ID: <handler.66224.B.169595971514415 <at> debbugs.gnu.org>
Resent-Sender: help-debbugs@HIDDEN
X-GNU-PR-Message: followup 66224
X-GNU-PR-Package: emacs
X-GNU-PR-Keywords: patch
To: 66224 <at> debbugs.gnu.org
Cc: philipk@HIDDEN, joseph@HIDDEN
X-Debbugs-Original-To: Joseph Turner via "Bug reports for GNU Emacs, the Swiss army knife of text editors" <bug-gnu-emacs@HIDDEN>
X-Debbugs-Original-Cc: Philip Kaludercic <philipk@HIDDEN>, 66224 <at> debbugs.gnu.org, Joseph Turner <joseph@HIDDEN>
Received: via spool by submit <at> debbugs.gnu.org id=B.169595971514415
          (code B ref -1); Fri, 29 Sep 2023 03:56:02 +0000
Received: (at submit) by debbugs.gnu.org; 29 Sep 2023 03:55:15 +0000
Received: from localhost ([127.0.0.1]:54804 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1qm4ax-0003kR-Bm
	for submit <at> debbugs.gnu.org; Thu, 28 Sep 2023 23:55:15 -0400
Received: from lists.gnu.org ([2001:470:142::17]:37522)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <michael_heerdegen@HIDDEN>) id 1qm4as-0003k8-Hr
 for submit <at> debbugs.gnu.org; Thu, 28 Sep 2023 23:55:13 -0400
Received: from eggs.gnu.org ([2001:470:142:3::10])
 by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <michael_heerdegen@HIDDEN>)
 id 1qm4aY-0007fd-As
 for bug-gnu-emacs@HIDDEN; Thu, 28 Sep 2023 23:54:50 -0400
Received: from mout.web.de ([212.227.15.3])
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <michael_heerdegen@HIDDEN>)
 id 1qm4aV-0006Wg-1O
 for bug-gnu-emacs@HIDDEN; Thu, 28 Sep 2023 23:54:50 -0400
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=web.de; s=s29768273;
 t=1695959670; x=1696564470; i=michael_heerdegen@HIDDEN;
 bh=rlFbgCo+Lr6XN82Wj3RoZcbRmE6WttQS9omMjBxIj/M=;
 h=X-UI-Sender-Class:From:To:Cc:Subject:In-Reply-To:References:Date;
 b=T5R4BI6A2efsiLO7QVPIUOpN9O5zECsAUBVPedXBbqkkeeIrLMqKKuulhT0n/uctAeR3Clip8Wa
 0UP4GFLrMfwq1nh8yWMwz+o6zpPKP2w90gJl7MIFjbV8JF8hgdsIRcp0d/2bjp4r2Br6bLv9Sc7eo
 fMix9MmlIkDbCueAcQB5EDvl04uqZ5wfebiQpc/8N4WAlWPBdzoFkZ3CMjW5ssE6CfhE5krd6ATp3
 QiU4dswQeVJ2u2wVwhSmiy4iyLbD0mK9llTbnEHuaFoQAjBo+tnNo+hBHkZTGn+FR6WENXaCBbvXK
 OFk5ld4bSX66aU6NMw6avo/iTaQ1BhJ0yzjA==
X-UI-Sender-Class: 814a7b36-bfc1-4dae-8640-3722d8ec6cd6
Received: from drachen.dragon ([88.66.201.191]) by smtp.web.de (mrweb006
 [213.165.67.108]) with ESMTPSA (Nemesis) id 1M8Bvz-1qhPkL2c6N-005G0r; Fri, 29
 Sep 2023 05:54:30 +0200
From: Michael Heerdegen <michael_heerdegen@HIDDEN>
In-Reply-To: <87bkdly7t4.fsf@HIDDEN> (Joseph Turner via's
 message of "Thu, 28 Sep 2023 20:28:52 -0700")
References: <877coch0q7.fsf@HIDDEN> <874jje1xds.fsf@HIDDEN>
 <87bkdly7t4.fsf@HIDDEN>
Date: Fri, 29 Sep 2023 05:54:31 +0200
Message-ID: <871qehr5vs.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13)
MIME-Version: 1.0
Content-Type: text/plain
X-Provags-ID: V03:K1:/wiNMQAEz9qiyMHs+bsHznFFNVeH++/HvMdjPX/2XB/x+95o6Ml
 k1+Yk1EJAoCrj/kmgoTWt+9FweiLq1QmbMAQeDq/cE9zyR4A3lME53a4LScY7fmicCump7k
 SuygcgIuQgOR5R6+qUXbtPn7dx/+KxX9YiR7FctzkxejILpFM9uf5todQwVpPDYO2HMbekO
 mn9C2XJZAzC9BXS9310Yw==
X-Spam-Flag: NO
UI-OutboundReport: notjunk:1;M01:P0:q7VMDmB6kwY=;wL1LOKNzGq+u8NxHn9jmlLdqhGE
 /G4NIdN8nLEvPKbc0BY/f8oQSh17ATAVWhgoqTM/BD7reRITZQ72rmslxwqPewnZBr0X8XAnR
 TbUjMHmfd2nqJw2R72V2j8SVR6hAjCBVI1iIr6LrW+c7a/afN2Yj6260xaH0Gu2K6FtSx/03b
 3jtwmw0Auk1xqrgyiMcLsx6fiZNSPZXHmxs88tzQ6tHFHIXF4ocrt4XjY7tgyu9rC3V/4UIa2
 RdgWBTFjUcnKol11u+IBlKjYavYZ8xG02HyV5j4rL8biKjQPUYpI5YlLF2DAhnnnzr+53EMFG
 nAWx8lyZ7ascil1rYmPOUhA1N7kTh3iNTwBmaaE4oKsKD7CwT27Qn4z245ETF/4qqokDoi7rC
 /hvZtdMVUBP95dQVya8+txTgckKlE3kchTIL3FPsBjVZ1Ct8T0GymlhjX6r5fi4dAdLSzfRV1
 DmEPucwoAX2ceYawR2E1CW3pLHtUZdWnWIE43EWnkVWJZ5GSvYm7WEgn2Kx0VwQBogNsphJBV
 MIJcnPGDbsmD5aerNWi982UOYhHzSHXhoEJKRZyGyS9/7lJ4HR7v0tDE/SfNz9rAr+axC+n40
 c2n3DAMOXKajga2C6dnFxJx5JffwAN/6kY3dKtohZ0WPZD83ck61fEEnXbqWuzKmBYzVxXCdf
 7htShobESIO+jXzqLD4LiSltIixAP8DlCtInx1cvo5J9KY2aUNa0mykDmJuyhuO4hb6+5nLWr
 wxjhfFeCcAW4xj3e9xQeZCiNOIIIXuGBGyBqel5JXAnmrb4ZaeqCsvkSlG1LtEcyFmxzxWz9h
 UeFC65DyFH51WBHVtG1nWseA0Hyfca1IB3H0IxxcRfubZkqqbu8PlgnIZGSyQuOg9cUU/Y+WF
 AbUowVAfEueGE2inwQGWCOxrfCM7Jqs+rDfygxBq8XxMcO13wVS4fGDanO+PdhGrzb/9k4wvi
 mPWYWzoEKrr8G7j/Zaq7vLFx9rI=
Received-SPF: pass client-ip=212.227.15.3;
 envelope-from=michael_heerdegen@HIDDEN; helo=mout.web.de
X-Spam_score_int: -27
X-Spam_score: -2.8
X-Spam_bar: --
X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1,
 DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001,
 RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001,
 SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no
X-Spam_action: no action
X-Spam-Score: 1.0 (+)
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -0.0 (/)

Joseph Turner via "Bug reports for GNU Emacs, the Swiss army knife of
text editors" <bug-gnu-emacs@HIDDEN> writes:

> -		  'file-directory-p))
> +                  (lambda (filename)
> +                    (if predicate
> +                        (and (file-directory-p filename)
> +                             (funcall predicate filename))
> +                      (file-directory-p filename)))))

Yip.  Nitpick: The code will be faster if you move the test out of the
predicate (so that it will not be performed repeatedly):

#+begin_src emacs-lisp
(if predicate
    (lambda (filename)
      (and (file-directory-p filename)
           (funcall predicate filename)))
  #'file-directory-p)
#+end_src


Michael.





Message sent to bug-gnu-emacs@HIDDEN:


X-Loop: help-debbugs@HIDDEN
Subject: bug#66224: [PATCH] Add optional PREDICATE argument to read-directory-name
Resent-From: Joseph Turner <joseph@HIDDEN>
Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
Resent-CC: bug-gnu-emacs@HIDDEN
Resent-Date: Fri, 29 Sep 2023 04:21:02 +0000
Resent-Message-ID: <handler.66224.B.169596122817302 <at> debbugs.gnu.org>
Resent-Sender: help-debbugs@HIDDEN
X-GNU-PR-Message: followup 66224
X-GNU-PR-Package: emacs
X-GNU-PR-Keywords: patch
To: Michael Heerdegen <michael_heerdegen@HIDDEN>
Cc: 66224 <at> debbugs.gnu.org, philipk@HIDDEN
X-Debbugs-Original-Cc: "Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors" <bug-gnu-emacs@HIDDEN>, 66224 <at> debbugs.gnu.org, Philip Kaludercic <philipk@HIDDEN>
Received: via spool by submit <at> debbugs.gnu.org id=B.169596122817302
          (code B ref -1); Fri, 29 Sep 2023 04:21:02 +0000
Received: (at submit) by debbugs.gnu.org; 29 Sep 2023 04:20:28 +0000
Received: from localhost ([127.0.0.1]:54811 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1qm4zJ-0004Uw-Gh
	for submit <at> debbugs.gnu.org; Fri, 29 Sep 2023 00:20:28 -0400
Received: from lists.gnu.org ([2001:470:142::17]:49190)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <joseph@HIDDEN>) id 1qm4zE-0004US-CT
 for submit <at> debbugs.gnu.org; Fri, 29 Sep 2023 00:20:24 -0400
Received: from eggs.gnu.org ([2001:470:142:3::10])
 by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <joseph@HIDDEN>)
 id 1qm4yu-0006OG-9m
 for bug-gnu-emacs@HIDDEN; Fri, 29 Sep 2023 00:20:00 -0400
Received: from out-202.mta1.migadu.com ([95.215.58.202])
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <joseph@HIDDEN>)
 id 1qm4yr-0003Lb-QU
 for bug-gnu-emacs@HIDDEN; Fri, 29 Sep 2023 00:20:00 -0400
References: <877coch0q7.fsf@HIDDEN>
 <874jje1xds.fsf@HIDDEN> <87bkdly7t4.fsf@HIDDEN>
 <871qehr5vs.fsf@HIDDEN>
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=breatheoutbreathe.in; 
 s=key1; t=1695961194;
 h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
 to:to:cc:cc:mime-version:mime-version:content-type:content-type:
 in-reply-to:in-reply-to:references:references;
 bh=DKaIlgOIMXW6yvN+EX4GN4faypFbpBe+5YKWELfQyNM=;
 b=UNPH9qU1DSJa2svOZ6/iweX5Pk96N7xA9A0SApDDrNncde6WdN+nB1mMicX9uT9cqGRlc7
 BBKhWte4C8lB82XY0py+pMUhFl+yfy0Up2XFxufxGlzJg/ln8GFKcBA/GnXbMc9ePHMNgB
 3QJyVg7czSCaiPqmuVxl0+l7HyTVHUo=
X-Report-Abuse: Please report any abuse attempt to abuse@HIDDEN and
 include these headers.
From: Joseph Turner <joseph@HIDDEN>
Date: Thu, 28 Sep 2023 21:19:24 -0700
In-reply-to: <871qehr5vs.fsf@HIDDEN>
Message-ID: <877co9y5jt.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="=-=-="
X-Migadu-Flow: FLOW_OUT
Received-SPF: pass client-ip=95.215.58.202;
 envelope-from=joseph@HIDDEN; helo=out-202.mta1.migadu.com
X-Spam_score_int: -16
X-Spam_score: -1.7
X-Spam_bar: -
X-Spam_report: (-1.7 / 5.0 requ) BAYES_00=-1.9, DKIM_INVALID=0.1,
 DKIM_SIGNED=0.1, SPF_HELO_NONE=0.001,
 SPF_PASS=-0.001 autolearn=no autolearn_force=no
X-Spam_action: no action
X-Spam-Score: 0.9 (/)
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -0.1 (/)

--=-=-=
Content-Type: text/plain


Michael Heerdegen <michael_heerdegen@HIDDEN> writes:

> Joseph Turner via "Bug reports for GNU Emacs, the Swiss army knife of
> text editors" <bug-gnu-emacs@HIDDEN> writes:
>
>> -		  'file-directory-p))
>> +                  (lambda (filename)
>> +                    (if predicate
>> +                        (and (file-directory-p filename)
>> +                             (funcall predicate filename))
>> +                      (file-directory-p filename)))))
>
> Yip.  Nitpick: The code will be faster if you move the test out of the
> predicate (so that it will not be performed repeatedly):
>
> #+begin_src emacs-lisp
> (if predicate
>     (lambda (filename)
>       (and (file-directory-p filename)
>            (funcall predicate filename)))
>   #'file-directory-p)
> #+end_src

Thank you!! See attached patch.

Joseph

--=-=-=
Content-Type: text/x-diff
Content-Disposition: attachment;
 filename=0001-Add-optional-PREDICATE-argument-to-read-directory-na.patch

From 894e44bce60cf30c9e8bc8c5323eaed91d135bbb Mon Sep 17 00:00:00 2001
From: Joseph Turner <joseph@HIDDEN>
Date: Thu, 28 Sep 2023 20:27:47 -0700
Subject: [PATCH] Add optional PREDICATE argument to read-directory-name

* lisp/files.el (read-directory-name): Add optional PREDICATE arg.
* doc/lispref/minibuf.texi (Reading File Names): Document change.
* etc/NEWS: Note change.
---
 doc/lispref/minibuf.texi |  7 +++++--
 etc/NEWS                 |  5 +++++
 lisp/files.el            | 13 ++++++++++---
 3 files changed, 20 insertions(+), 5 deletions(-)

diff --git a/doc/lispref/minibuf.texi b/doc/lispref/minibuf.texi
index 620c58ec6e9..bf4d6e13d3a 100644
--- a/doc/lispref/minibuf.texi
+++ b/doc/lispref/minibuf.texi
@@ -1709,7 +1709,7 @@ If this variable is non-@code{nil}, @code{read-file-name} ignores case
 when performing completion.
 @end defopt
 
-@defun read-directory-name prompt &optional directory default require-match initial
+@defun read-directory-name prompt &optional directory default require-match initial predicate
 This function is like @code{read-file-name} but allows only directory
 names as completion alternatives.
 
@@ -1719,7 +1719,10 @@ combining @var{directory} (or the current buffer's default directory
 if @var{directory} is @code{nil}) and @var{initial}.  If both
 @var{default} and @var{initial} are @code{nil}, this function uses
 @var{directory} as substitute default, or the current buffer's default
-directory if @var{directory} is @code{nil}.
+directory if @var{directory} is @code{nil}.  When optional sixth
+argument @code{predicate} is non-nil, the union of @code{predicate}
+and @code{file-directory-p} is passed as the @code{predicate} argument
+to @code{read-file-name}.
 @end defun
 
 @defopt insert-default-directory
diff --git a/etc/NEWS b/etc/NEWS
index 1b3532b5657..fb9f6a0b43f 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -3541,6 +3541,11 @@ This function is called to see whether what the user has typed is a
 match.  This is also available from functions that call
 'completing-read', like 'read-file-name'.
 
+** 'read-directory-name' now accepts an optional PREDICATE argument.
+When optional sixth argument PREDICATE is non-nil, the union of
+PREDICATE and 'file-directory-p' is passed as the PREDICATE argument
+to 'read-file-name'.
+
 ** 'posn-col-row' can now give position data based on windows.
 Previously, it reported data only based on the frame.
 
diff --git a/lisp/files.el b/lisp/files.el
index b72f141c0ee..68855cd1c6d 100644
--- a/lisp/files.el
+++ b/lisp/files.el
@@ -807,7 +807,7 @@ See Info node `(elisp)Standard File Names' for more details."
     (dos-convert-standard-filename filename))
    (t filename)))
 
-(defun read-directory-name (prompt &optional dir default-dirname mustmatch initial)
+(defun read-directory-name (prompt &optional dir default-dirname mustmatch initial predicate)
   "Read directory name, prompting with PROMPT and completing in directory DIR.
 Value is not expanded---you must call `expand-file-name' yourself.
 Default name to DEFAULT-DIRNAME if user exits with the same
@@ -821,14 +821,21 @@ Fourth arg MUSTMATCH non-nil means require existing directory's name.
  Non-nil and non-t means also require confirmation after completion.
 Fifth arg INITIAL specifies text to start with.
 DIR should be an absolute directory name.  It defaults to
-the value of `default-directory'."
+the value of `default-directory'.
+When sixth arg PREDICATE is non-nil, the union of PREDICATE and
+`file-directory-p' is passed as the PREDICATE argument to
+`read-file-name'. Otherwise, only `file-directory-p' is passed."
   (unless dir
     (setq dir default-directory))
   (read-file-name prompt dir (or default-dirname
 				 (if initial (expand-file-name initial dir)
 				   dir))
 		  mustmatch initial
-		  'file-directory-p))
+                  (if predicate
+                      (lambda (filename)
+                        (and (file-directory-p filename)
+                             (funcall predicate filename)))
+                    #'file-directory-p)))
 
 
 (defun pwd (&optional insert)
-- 
2.41.0


--=-=-=--




Message sent to bug-gnu-emacs@HIDDEN:


X-Loop: help-debbugs@HIDDEN
Subject: bug#66224: [PATCH] Add optional PREDICATE argument to read-directory-name
Resent-From: Joseph Turner <joseph@HIDDEN>
Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
Resent-CC: bug-gnu-emacs@HIDDEN
Resent-Date: Fri, 29 Sep 2023 04:21:02 +0000
Resent-Message-ID: <handler.66224.B66224.169596121617272 <at> debbugs.gnu.org>
Resent-Sender: help-debbugs@HIDDEN
X-GNU-PR-Message: followup 66224
X-GNU-PR-Package: emacs
X-GNU-PR-Keywords: patch
To: Michael Heerdegen <michael_heerdegen@HIDDEN>
Cc: 66224 <at> debbugs.gnu.org, philipk@HIDDEN
X-Debbugs-Original-Cc: "Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors" <bug-gnu-emacs@HIDDEN>, 66224 <at> debbugs.gnu.org, Philip Kaludercic <philipk@HIDDEN>
Received: via spool by 66224-submit <at> debbugs.gnu.org id=B66224.169596121617272
          (code B ref 66224); Fri, 29 Sep 2023 04:21:02 +0000
Received: (at 66224) by debbugs.gnu.org; 29 Sep 2023 04:20:16 +0000
Received: from localhost ([127.0.0.1]:54808 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1qm4z9-0004UU-Qq
	for submit <at> debbugs.gnu.org; Fri, 29 Sep 2023 00:20:16 -0400
Received: from out-197.mta1.migadu.com ([2001:41d0:203:375::c5]:43533)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <joseph@HIDDEN>) id 1qm4z4-0004UF-Fo
 for 66224 <at> debbugs.gnu.org; Fri, 29 Sep 2023 00:20:13 -0400
References: <877coch0q7.fsf@HIDDEN>
 <874jje1xds.fsf@HIDDEN> <87bkdly7t4.fsf@HIDDEN>
 <871qehr5vs.fsf@HIDDEN>
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=breatheoutbreathe.in; 
 s=key1; t=1695961194;
 h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
 to:to:cc:cc:mime-version:mime-version:content-type:content-type:
 in-reply-to:in-reply-to:references:references;
 bh=DKaIlgOIMXW6yvN+EX4GN4faypFbpBe+5YKWELfQyNM=;
 b=UNPH9qU1DSJa2svOZ6/iweX5Pk96N7xA9A0SApDDrNncde6WdN+nB1mMicX9uT9cqGRlc7
 BBKhWte4C8lB82XY0py+pMUhFl+yfy0Up2XFxufxGlzJg/ln8GFKcBA/GnXbMc9ePHMNgB
 3QJyVg7czSCaiPqmuVxl0+l7HyTVHUo=
X-Report-Abuse: Please report any abuse attempt to abuse@HIDDEN and
 include these headers.
From: Joseph Turner <joseph@HIDDEN>
Date: Thu, 28 Sep 2023 21:19:24 -0700
In-reply-to: <871qehr5vs.fsf@HIDDEN>
Message-ID: <877co9y5jt.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="=-=-="
X-Migadu-Flow: FLOW_OUT
X-Spam-Score: 0.0 (/)
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

--=-=-=
Content-Type: text/plain


Michael Heerdegen <michael_heerdegen@HIDDEN> writes:

> Joseph Turner via "Bug reports for GNU Emacs, the Swiss army knife of
> text editors" <bug-gnu-emacs@HIDDEN> writes:
>
>> -		  'file-directory-p))
>> +                  (lambda (filename)
>> +                    (if predicate
>> +                        (and (file-directory-p filename)
>> +                             (funcall predicate filename))
>> +                      (file-directory-p filename)))))
>
> Yip.  Nitpick: The code will be faster if you move the test out of the
> predicate (so that it will not be performed repeatedly):
>
> #+begin_src emacs-lisp
> (if predicate
>     (lambda (filename)
>       (and (file-directory-p filename)
>            (funcall predicate filename)))
>   #'file-directory-p)
> #+end_src

Thank you!! See attached patch.

Joseph

--=-=-=
Content-Type: text/x-diff
Content-Disposition: attachment;
 filename=0001-Add-optional-PREDICATE-argument-to-read-directory-na.patch

From 894e44bce60cf30c9e8bc8c5323eaed91d135bbb Mon Sep 17 00:00:00 2001
From: Joseph Turner <joseph@HIDDEN>
Date: Thu, 28 Sep 2023 20:27:47 -0700
Subject: [PATCH] Add optional PREDICATE argument to read-directory-name

* lisp/files.el (read-directory-name): Add optional PREDICATE arg.
* doc/lispref/minibuf.texi (Reading File Names): Document change.
* etc/NEWS: Note change.
---
 doc/lispref/minibuf.texi |  7 +++++--
 etc/NEWS                 |  5 +++++
 lisp/files.el            | 13 ++++++++++---
 3 files changed, 20 insertions(+), 5 deletions(-)

diff --git a/doc/lispref/minibuf.texi b/doc/lispref/minibuf.texi
index 620c58ec6e9..bf4d6e13d3a 100644
--- a/doc/lispref/minibuf.texi
+++ b/doc/lispref/minibuf.texi
@@ -1709,7 +1709,7 @@ If this variable is non-@code{nil}, @code{read-file-name} ignores case
 when performing completion.
 @end defopt
 
-@defun read-directory-name prompt &optional directory default require-match initial
+@defun read-directory-name prompt &optional directory default require-match initial predicate
 This function is like @code{read-file-name} but allows only directory
 names as completion alternatives.
 
@@ -1719,7 +1719,10 @@ combining @var{directory} (or the current buffer's default directory
 if @var{directory} is @code{nil}) and @var{initial}.  If both
 @var{default} and @var{initial} are @code{nil}, this function uses
 @var{directory} as substitute default, or the current buffer's default
-directory if @var{directory} is @code{nil}.
+directory if @var{directory} is @code{nil}.  When optional sixth
+argument @code{predicate} is non-nil, the union of @code{predicate}
+and @code{file-directory-p} is passed as the @code{predicate} argument
+to @code{read-file-name}.
 @end defun
 
 @defopt insert-default-directory
diff --git a/etc/NEWS b/etc/NEWS
index 1b3532b5657..fb9f6a0b43f 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -3541,6 +3541,11 @@ This function is called to see whether what the user has typed is a
 match.  This is also available from functions that call
 'completing-read', like 'read-file-name'.
 
+** 'read-directory-name' now accepts an optional PREDICATE argument.
+When optional sixth argument PREDICATE is non-nil, the union of
+PREDICATE and 'file-directory-p' is passed as the PREDICATE argument
+to 'read-file-name'.
+
 ** 'posn-col-row' can now give position data based on windows.
 Previously, it reported data only based on the frame.
 
diff --git a/lisp/files.el b/lisp/files.el
index b72f141c0ee..68855cd1c6d 100644
--- a/lisp/files.el
+++ b/lisp/files.el
@@ -807,7 +807,7 @@ See Info node `(elisp)Standard File Names' for more details."
     (dos-convert-standard-filename filename))
    (t filename)))
 
-(defun read-directory-name (prompt &optional dir default-dirname mustmatch initial)
+(defun read-directory-name (prompt &optional dir default-dirname mustmatch initial predicate)
   "Read directory name, prompting with PROMPT and completing in directory DIR.
 Value is not expanded---you must call `expand-file-name' yourself.
 Default name to DEFAULT-DIRNAME if user exits with the same
@@ -821,14 +821,21 @@ Fourth arg MUSTMATCH non-nil means require existing directory's name.
  Non-nil and non-t means also require confirmation after completion.
 Fifth arg INITIAL specifies text to start with.
 DIR should be an absolute directory name.  It defaults to
-the value of `default-directory'."
+the value of `default-directory'.
+When sixth arg PREDICATE is non-nil, the union of PREDICATE and
+`file-directory-p' is passed as the PREDICATE argument to
+`read-file-name'. Otherwise, only `file-directory-p' is passed."
   (unless dir
     (setq dir default-directory))
   (read-file-name prompt dir (or default-dirname
 				 (if initial (expand-file-name initial dir)
 				   dir))
 		  mustmatch initial
-		  'file-directory-p))
+                  (if predicate
+                      (lambda (filename)
+                        (and (file-directory-p filename)
+                             (funcall predicate filename)))
+                    #'file-directory-p)))
 
 
 (defun pwd (&optional insert)
-- 
2.41.0


--=-=-=--




Message sent to bug-gnu-emacs@HIDDEN:


X-Loop: help-debbugs@HIDDEN
Subject: bug#66224: [PATCH] Add optional PREDICATE argument to read-directory-name
Resent-From: Eli Zaretskii <eliz@HIDDEN>
Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
Resent-CC: bug-gnu-emacs@HIDDEN
Resent-Date: Fri, 29 Sep 2023 12:07:01 +0000
Resent-Message-ID: <handler.66224.B66224.169598919415468 <at> debbugs.gnu.org>
Resent-Sender: help-debbugs@HIDDEN
X-GNU-PR-Message: followup 66224
X-GNU-PR-Package: emacs
X-GNU-PR-Keywords: patch
To: Joseph Turner <joseph@HIDDEN>
Cc: 66224 <at> debbugs.gnu.org
Received: via spool by 66224-submit <at> debbugs.gnu.org id=B66224.169598919415468
          (code B ref 66224); Fri, 29 Sep 2023 12:07:01 +0000
Received: (at 66224) by debbugs.gnu.org; 29 Sep 2023 12:06:34 +0000
Received: from localhost ([127.0.0.1]:55471 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1qmCGP-00041Q-Rq
	for submit <at> debbugs.gnu.org; Fri, 29 Sep 2023 08:06:34 -0400
Received: from eggs.gnu.org ([2001:470:142:3::10]:51984)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <eliz@HIDDEN>) id 1qmCGJ-000413-T4
 for 66224 <at> debbugs.gnu.org; Fri, 29 Sep 2023 08:06:32 -0400
Received: from fencepost.gnu.org ([2001:470:142:3::e])
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <eliz@HIDDEN>)
 id 1qmCFx-0007iF-VX; Fri, 29 Sep 2023 08:06:07 -0400
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org;
 s=fencepost-gnu-org; h=MIME-version:References:Subject:In-Reply-To:To:From:
 Date; bh=c+f+fCyyV6TYOegqnboqOxNjtq8qeHtOx6mH9mfKTco=; b=NyiCg5tEwUnie5laI8dt
 KFkQTwVMhA+XcbHDaAr3vcLnchEYumlAjOvWFwt6dchhrqq7+BXTUzq/V/tp8dJM/Smw0lwTXC81D
 Xf0YdShsA9q/7yS5eoWpvd0KtSK4VbDn6Ks4P/ek9SvDk+DjQJPomwTvv2e3xAdBnuOEbzvFBiifE
 dFyu7CohW9or72JjV7d5WIf9+6P4uO5K3Z/ZakArlxSsWW+aoq2+OgFXKJkEVnmiHlBWOS9WD9gcv
 JKmf6LRHkrHoA8ynqiIBYnx+iMv1PIbtkq7KnEboheHx6JHb3l6gsxX7NQ4UopRq9a8jrJd14/heX
 Uihp6Lwi6kCoJw==;
Date: Fri, 29 Sep 2023 15:05:44 +0300
Message-Id: <83wmw9yyjr.fsf@HIDDEN>
From: Eli Zaretskii <eliz@HIDDEN>
In-Reply-To: <877coch0q7.fsf@HIDDEN> (bug-gnu-emacs@HIDDEN)
References: <877coch0q7.fsf@HIDDEN>
MIME-version: 1.0
Content-type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit
X-Spam-Score: -2.3 (--)
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

> Date: Tue, 26 Sep 2023 18:16:40 -0700
> From:  Joseph Turner via "Bug reports for GNU Emacs,
>  the Swiss army knife of text editors" <bug-gnu-emacs@HIDDEN>
> 
> This patch makes read-directory-name accept an optional PREDICATE arg
> so it can be used like read-file-name.

Any rationale?

> @@ -1719,7 +1719,9 @@ combining @var{directory} (or the current buffer's default directory
>  if @var{directory} is @code{nil}) and @var{initial}.  If both
>  @var{default} and @var{initial} are @code{nil}, this function uses
>  @var{directory} as substitute default, or the current buffer's default
> -directory if @var{directory} is @code{nil}.
> +directory if @var{directory} is @code{nil}.  The union of sixth arg
> +@code{predicate} and @code{file-directory-p} is passed as the

This should be elaborated: what is meant by "the union of sixth arg
and 'file-directory-p'"?

> +@code{predicate} argument to ‘read-file-name’.
                                ^^^^^^^^^^^^^^^^
That should be @code{read-file-name}

> +** 'read-directory-name' now accepts an optional PREDICATE argument.
> +The union of sixth arg PREDICATE and 'file-directory-p' is passed
> +as the PREDICATE argument to 'read-file-name'.

Likewise here, regarding the "union" part.

Also, since you submit the patch for the manual, this NEWS entry
should be marked with "+++".

>  Fifth arg INITIAL specifies text to start with.
>  DIR should be an absolute directory name.  It defaults to
> -the value of `default-directory'."
> +the value of `default-directory'.
> +The union of sixth arg PREDICATE and `file-directory-p' is passed
> +as the PREDICATE argument to `read-file-name'."

The "union" part again.

Thanks.




Message sent to bug-gnu-emacs@HIDDEN:


X-Loop: help-debbugs@HIDDEN
Subject: bug#66224: [PATCH] Add optional PREDICATE argument to read-directory-name
Resent-From: Michael Heerdegen <michael_heerdegen@HIDDEN>
Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
Resent-CC: bug-gnu-emacs@HIDDEN
Resent-Date: Tue, 03 Oct 2023 03:33:26 +0000
Resent-Message-ID: <handler.66224.B.16963039295955 <at> debbugs.gnu.org>
Resent-Sender: help-debbugs@HIDDEN
X-GNU-PR-Message: followup 66224
X-GNU-PR-Package: emacs
X-GNU-PR-Keywords: patch
To: 66224 <at> debbugs.gnu.org
Cc: philipk@HIDDEN, joseph@HIDDEN
X-Debbugs-Original-To: Joseph Turner via "Bug reports for GNU Emacs, the Swiss army knife of text editors" <bug-gnu-emacs@HIDDEN>
X-Debbugs-Original-Cc: philipk@HIDDEN, 66224 <at> debbugs.gnu.org, Joseph Turner <joseph@HIDDEN>
Received: via spool by submit <at> debbugs.gnu.org id=B.16963039295955
          (code B ref -1); Tue, 03 Oct 2023 03:33:26 +0000
Received: (at submit) by debbugs.gnu.org; 3 Oct 2023 03:32:09 +0000
Received: from localhost ([127.0.0.1]:38384 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1qnW8m-0001Xz-PP
	for submit <at> debbugs.gnu.org; Mon, 02 Oct 2023 23:32:09 -0400
Received: from lists.gnu.org ([2001:470:142::17]:41202)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <michael_heerdegen@HIDDEN>) id 1qnW8k-0001X0-Ov
 for submit <at> debbugs.gnu.org; Mon, 02 Oct 2023 23:32:07 -0400
Received: from eggs.gnu.org ([2001:470:142:3::10])
 by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <michael_heerdegen@HIDDEN>)
 id 1qnW8N-0003IS-NE
 for bug-gnu-emacs@HIDDEN; Mon, 02 Oct 2023 23:31:43 -0400
Received: from mout.web.de ([217.72.192.78])
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <michael_heerdegen@HIDDEN>)
 id 1qnW8L-0008DW-UX
 for bug-gnu-emacs@HIDDEN; Mon, 02 Oct 2023 23:31:43 -0400
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=web.de; s=s29768273;
 t=1696303830; x=1696908630; i=michael_heerdegen@HIDDEN;
 bh=pQB/RwQuMYEkyGSRno2Dharg6HPTMVMhGFflBHw6V8o=;
 h=X-UI-Sender-Class:From:To:Cc:Subject:In-Reply-To:References:Date;
 b=kOQXZPIrKIQI/Q29aOI4qzHpvuMIt/rZ6jNhf4PNLRQJU0v2tLRSAGJ8VFvptg8SJjMcbfiBBrQ
 xYSP/pLw2BrbMd20J0hoXRxiy69piAK5FU1UGSK/zzBayE4NXCm4FlPFZVFIuVsVPW5JkCUV0TKWB
 P0JLGazOSI3w0Gu2GcIQiDhfLzjdW89C4aCh7259Tjs+geAXerS4McwLRMXmC1QYmLKdAUCGGqTru
 Nk88Febcsl0VKKCOSiCG02k1cg5lftUQkHItYsYpbmsQJuEXytCfRMVfybsZsBKCSCPqMtpkJK1Eo
 n5oc/qBe4i0VsUdLnUpddsmsmKefIsyNprrg==
X-UI-Sender-Class: 814a7b36-bfc1-4dae-8640-3722d8ec6cd6
Received: from drachen.dragon ([88.66.201.191]) by smtp.web.de (mrweb105
 [213.165.67.124]) with ESMTPSA (Nemesis) id 1MlbHE-1rUrI42vJq-00iov7; Tue, 03
 Oct 2023 05:30:30 +0200
From: Michael Heerdegen <michael_heerdegen@HIDDEN>
In-Reply-To: <877co9y5jt.fsf@HIDDEN> (Joseph Turner via's
 message of "Thu, 28 Sep 2023 21:19:24 -0700")
References: <877coch0q7.fsf@HIDDEN> <874jje1xds.fsf@HIDDEN>
 <87bkdly7t4.fsf@HIDDEN> <871qehr5vs.fsf@HIDDEN>
 <877co9y5jt.fsf@HIDDEN>
Date: Tue, 03 Oct 2023 05:30:32 +0200
Message-ID: <877co4tmav.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13)
MIME-Version: 1.0
Content-Type: text/plain
X-Provags-ID: V03:K1:55+LacOk7d99ZOb95j1m1UsPJon49hzFNgpYbCWoHy2HVw4ABE7
 vpuWjwjG1+8g5eIU9LHd5tNgIlCMKE8AyCZTWtrxPE8Cvp4HDhluSa+eneUi3r6ZBoQYpVE
 9cp7raz15Z+pWfNOOFvzNd1BPwneFxZwtSKrToIM7peMdluYfv0t1VfkayWuEphUyeQsEAw
 FVK329Qkd0h0NAn7gVlFA==
X-Spam-Flag: NO
UI-OutboundReport: notjunk:1;M01:P0:RKB83doAwjc=;NEzSGDJ/8Dx8TESzj1DbFesf9Q/
 uMrPHL2XrlXohCIqRdN3d8XmRbiGjYJhx8DD4rQebfmi+Fdl7LGIwwUyz+a0EQqQuzshtrPB6
 90BnGNjDs1hzhqP4DxlbTyQE4xvCiPVnQAO0zef532Wsq5DYXlbT+EDI1zXxvmdFKgTgpKl8y
 PDaUZ+Pc6Ce12v4+6M9xKUKKuw+JxFjJd3GkeHBRknbLBLlyrn41Z1Avd6j6GZWIsl4djWFJM
 9EwUI+qDS/nkYNpd557/6OnL5j7+2LiULOt9ikGVbUMrC5j+67hsAcT4xaOzeUuroXsI8ptpH
 SBMHZOVYW2OqRHPUs2dKbyXE5YNeTKJSVj/tLvaXbJWsag3tNTRfYZ3DujhL6nDVsDUAs/W9/
 sqU1DuUKGMdYj1q0q0+CblgFtZ0agoxcMZpEqYk+enzGz4k+5QsfvPiUgcdlpGRkT97/wkpYF
 hApBu/bpzJzi/8iaisAhgT+7HW6Qoql8dw7JNDJF9LH1/5STL72hQBdCQdVOXBwTOB9sGki4q
 cSc5vYj2dHxdpc04k964NuMREwt98YmsgxrscE/7NJKyX2rP3WQPqbiASqh9qKXtGHY2glFfC
 DFzhY1zeP1a7yIkDPZ/CIEwC5VR5MF3yy2MykbAGsH7U1R37Z/UhOR6TkSU0OjsJsltASsUGP
 BWMUjiBbdgdF5VSBPSBeytlBS4r2lmS8wDYwNy/MuFOoqQanDyZ291zM9jdex2DXTlTmfgmoo
 WpvilKW8EsTbtZccl9s+I0GRVHs0j9oPTQ6Fz4hxNjE7m6jhp5FKdcNnQJnlkXcfN5ssxWlto
 dhHuxAKWbw/nvefmODJbeToUORjN3vJGX6B/fuy86Q6tb6hZr5IW3Hg0Ib9sGNERJhMRymXln
 rE9AFo5/Tqh9gy50e11//ZTiF8k5oKm6UidI06aiJ8xatzCwFt0dDdph3OzcvPeLColIl+J2H
 QbZWjfaor+e4rS/OkrXkqD5Y3wk=
Received-SPF: pass client-ip=217.72.192.78;
 envelope-from=michael_heerdegen@HIDDEN; helo=mout.web.de
X-Spam_score_int: -27
X-Spam_score: -2.8
X-Spam_bar: --
X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1,
 DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001,
 RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001,
 SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no
X-Spam_action: no action
X-Spam-Score: 1.0 (+)
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -0.0 (/)

Joseph Turner via "Bug reports for GNU Emacs, the Swiss army knife of
text editors" <bug-gnu-emacs@HIDDEN> writes:

> Thank you!! See attached patch.

Yes, thanks, the code LGTM now.

You know that the predicate will be ignored when MUSTMATCH is t?
The behavior is not different than for `read-file-name'.

I think your patch is definitely a step in the right direction, but I
also still think we should think about the semantics of the restricting
arguments as a whole.

Michael.




Message sent to bug-gnu-emacs@HIDDEN:


X-Loop: help-debbugs@HIDDEN
Subject: bug#66224: [PATCH] Add optional PREDICATE argument to read-directory-name
Resent-From: Michael Heerdegen <michael_heerdegen@HIDDEN>
Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
Resent-CC: bug-gnu-emacs@HIDDEN
Resent-Date: Tue, 03 Oct 2023 03:33:45 +0000
Resent-Message-ID: <handler.66224.B66224.16963039245915 <at> debbugs.gnu.org>
Resent-Sender: help-debbugs@HIDDEN
X-GNU-PR-Message: followup 66224
X-GNU-PR-Package: emacs
X-GNU-PR-Keywords: patch
To: 66224 <at> debbugs.gnu.org
Cc: philipk@HIDDEN, joseph@HIDDEN
X-Debbugs-Original-To: Joseph Turner via "Bug reports for GNU Emacs, the Swiss army knife of text editors" <bug-gnu-emacs@HIDDEN>
X-Debbugs-Original-Cc: philipk@HIDDEN, 66224 <at> debbugs.gnu.org, Joseph Turner <joseph@HIDDEN>
Received: via spool by 66224-submit <at> debbugs.gnu.org id=B66224.16963039245915
          (code B ref 66224); Tue, 03 Oct 2023 03:33:45 +0000
Received: (at 66224) by debbugs.gnu.org; 3 Oct 2023 03:32:04 +0000
Received: from localhost ([127.0.0.1]:38381 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1qnW8f-0001X7-QO
	for submit <at> debbugs.gnu.org; Mon, 02 Oct 2023 23:32:03 -0400
Received: from mout.web.de ([217.72.192.78]:50667)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <michael_heerdegen@HIDDEN>) id 1qnW7f-00019i-26
 for 66224 <at> debbugs.gnu.org; Mon, 02 Oct 2023 23:31:57 -0400
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=web.de; s=s29768273;
 t=1696303830; x=1696908630; i=michael_heerdegen@HIDDEN;
 bh=pQB/RwQuMYEkyGSRno2Dharg6HPTMVMhGFflBHw6V8o=;
 h=X-UI-Sender-Class:From:To:Cc:Subject:In-Reply-To:References:Date;
 b=kOQXZPIrKIQI/Q29aOI4qzHpvuMIt/rZ6jNhf4PNLRQJU0v2tLRSAGJ8VFvptg8SJjMcbfiBBrQ
 xYSP/pLw2BrbMd20J0hoXRxiy69piAK5FU1UGSK/zzBayE4NXCm4FlPFZVFIuVsVPW5JkCUV0TKWB
 P0JLGazOSI3w0Gu2GcIQiDhfLzjdW89C4aCh7259Tjs+geAXerS4McwLRMXmC1QYmLKdAUCGGqTru
 Nk88Febcsl0VKKCOSiCG02k1cg5lftUQkHItYsYpbmsQJuEXytCfRMVfybsZsBKCSCPqMtpkJK1Eo
 n5oc/qBe4i0VsUdLnUpddsmsmKefIsyNprrg==
X-UI-Sender-Class: 814a7b36-bfc1-4dae-8640-3722d8ec6cd6
Received: from drachen.dragon ([88.66.201.191]) by smtp.web.de (mrweb105
 [213.165.67.124]) with ESMTPSA (Nemesis) id 1MlbHE-1rUrI42vJq-00iov7; Tue, 03
 Oct 2023 05:30:30 +0200
From: Michael Heerdegen <michael_heerdegen@HIDDEN>
In-Reply-To: <877co9y5jt.fsf@HIDDEN> (Joseph Turner via's
 message of "Thu, 28 Sep 2023 21:19:24 -0700")
References: <877coch0q7.fsf@HIDDEN> <874jje1xds.fsf@HIDDEN>
 <87bkdly7t4.fsf@HIDDEN> <871qehr5vs.fsf@HIDDEN>
 <877co9y5jt.fsf@HIDDEN>
Date: Tue, 03 Oct 2023 05:30:32 +0200
Message-ID: <877co4tmav.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13)
MIME-Version: 1.0
Content-Type: text/plain
X-Provags-ID: V03:K1:55+LacOk7d99ZOb95j1m1UsPJon49hzFNgpYbCWoHy2HVw4ABE7
 vpuWjwjG1+8g5eIU9LHd5tNgIlCMKE8AyCZTWtrxPE8Cvp4HDhluSa+eneUi3r6ZBoQYpVE
 9cp7raz15Z+pWfNOOFvzNd1BPwneFxZwtSKrToIM7peMdluYfv0t1VfkayWuEphUyeQsEAw
 FVK329Qkd0h0NAn7gVlFA==
X-Spam-Flag: NO
UI-OutboundReport: notjunk:1;M01:P0:RKB83doAwjc=;NEzSGDJ/8Dx8TESzj1DbFesf9Q/
 uMrPHL2XrlXohCIqRdN3d8XmRbiGjYJhx8DD4rQebfmi+Fdl7LGIwwUyz+a0EQqQuzshtrPB6
 90BnGNjDs1hzhqP4DxlbTyQE4xvCiPVnQAO0zef532Wsq5DYXlbT+EDI1zXxvmdFKgTgpKl8y
 PDaUZ+Pc6Ce12v4+6M9xKUKKuw+JxFjJd3GkeHBRknbLBLlyrn41Z1Avd6j6GZWIsl4djWFJM
 9EwUI+qDS/nkYNpd557/6OnL5j7+2LiULOt9ikGVbUMrC5j+67hsAcT4xaOzeUuroXsI8ptpH
 SBMHZOVYW2OqRHPUs2dKbyXE5YNeTKJSVj/tLvaXbJWsag3tNTRfYZ3DujhL6nDVsDUAs/W9/
 sqU1DuUKGMdYj1q0q0+CblgFtZ0agoxcMZpEqYk+enzGz4k+5QsfvPiUgcdlpGRkT97/wkpYF
 hApBu/bpzJzi/8iaisAhgT+7HW6Qoql8dw7JNDJF9LH1/5STL72hQBdCQdVOXBwTOB9sGki4q
 cSc5vYj2dHxdpc04k964NuMREwt98YmsgxrscE/7NJKyX2rP3WQPqbiASqh9qKXtGHY2glFfC
 DFzhY1zeP1a7yIkDPZ/CIEwC5VR5MF3yy2MykbAGsH7U1R37Z/UhOR6TkSU0OjsJsltASsUGP
 BWMUjiBbdgdF5VSBPSBeytlBS4r2lmS8wDYwNy/MuFOoqQanDyZ291zM9jdex2DXTlTmfgmoo
 WpvilKW8EsTbtZccl9s+I0GRVHs0j9oPTQ6Fz4hxNjE7m6jhp5FKdcNnQJnlkXcfN5ssxWlto
 dhHuxAKWbw/nvefmODJbeToUORjN3vJGX6B/fuy86Q6tb6hZr5IW3Hg0Ib9sGNERJhMRymXln
 rE9AFo5/Tqh9gy50e11//ZTiF8k5oKm6UidI06aiJ8xatzCwFt0dDdph3OzcvPeLColIl+J2H
 QbZWjfaor+e4rS/OkrXkqD5Y3wk=
X-Spam-Score: -0.7 (/)
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.7 (-)

Joseph Turner via "Bug reports for GNU Emacs, the Swiss army knife of
text editors" <bug-gnu-emacs@HIDDEN> writes:

> Thank you!! See attached patch.

Yes, thanks, the code LGTM now.

You know that the predicate will be ignored when MUSTMATCH is t?
The behavior is not different than for `read-file-name'.

I think your patch is definitely a step in the right direction, but I
also still think we should think about the semantics of the restricting
arguments as a whole.

Michael.




Message sent to bug-gnu-emacs@HIDDEN:


X-Loop: help-debbugs@HIDDEN
Subject: bug#66224: [PATCH] Add optional PREDICATE argument to read-directory-name
Resent-From: Joseph Turner <joseph@HIDDEN>
Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
Resent-CC: bug-gnu-emacs@HIDDEN
Resent-Date: Tue, 03 Oct 2023 23:19:02 +0000
Resent-Message-ID: <handler.66224.B66224.169637513714650 <at> debbugs.gnu.org>
Resent-Sender: help-debbugs@HIDDEN
X-GNU-PR-Message: followup 66224
X-GNU-PR-Package: emacs
X-GNU-PR-Keywords: patch
To: Eli Zaretskii <eliz@HIDDEN>
Cc: 66224 <at> debbugs.gnu.org
Received: via spool by 66224-submit <at> debbugs.gnu.org id=B66224.169637513714650
          (code B ref 66224); Tue, 03 Oct 2023 23:19:02 +0000
Received: (at 66224) by debbugs.gnu.org; 3 Oct 2023 23:18:57 +0000
Received: from localhost ([127.0.0.1]:40889 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1qnofI-0003oD-Jh
	for submit <at> debbugs.gnu.org; Tue, 03 Oct 2023 19:18:57 -0400
Received: from out-196.mta1.migadu.com ([95.215.58.196]:16165)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <joseph@HIDDEN>) id 1qnofF-0003o2-Mm
 for 66224 <at> debbugs.gnu.org; Tue, 03 Oct 2023 19:18:55 -0400
References: <877coch0q7.fsf@HIDDEN> <83wmw9yyjr.fsf@HIDDEN>
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=breatheoutbreathe.in; 
 s=key1; t=1696375114;
 h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
 to:to:cc:cc:mime-version:mime-version:content-type:content-type:
 in-reply-to:in-reply-to:references:references;
 bh=3pLrteS23zInak4jZBYI8rreJqXquOyp2kFIrLF1wkY=;
 b=TZGfSDARlYueShQOBzWyIjy6qVmlu5E3CH/IhMpjhBXDyR5LQkgrsYQXp9UCCa50buNT1i
 CZfcEpPpe6cqByPPRwdJEdELanawXU6TXXszMMZMLnXpekNZEXFfctfHh66A7Q1OD46Js6
 AtyOMQXmAN/WFIbNy0vKfC6X7LmdZ5k=
X-Report-Abuse: Please report any abuse attempt to abuse@HIDDEN and
 include these headers.
From: Joseph Turner <joseph@HIDDEN>
Date: Tue, 03 Oct 2023 16:08:57 -0700
In-reply-to: <83wmw9yyjr.fsf@HIDDEN>
Message-ID: <87fs2r47nd.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="=-=-="
X-Migadu-Flow: FLOW_OUT
X-Spam-Score: 0.0 (/)
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

--=-=-=
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable


Eli Zaretskii <eliz@HIDDEN> writes:

>> Date: Tue, 26 Sep 2023 18:16:40 -0700
>> From:  Joseph Turner via "Bug reports for GNU Emacs,
>>  the Swiss army knife of text editors" <bug-gnu-emacs@HIDDEN>
>>
>> This patch makes read-directory-name accept an optional PREDICATE arg
>> so it can be used like read-file-name.
>
> Any rationale?

Mainly code clarity. If you want to prompt for a certain type of
directory, then IMO the intent is more clear like this:

(read-directory-name "Prompt: " "~/" nil nil nil #'my/predicate)

than like this:

(read-file-name "Prompt: " "~/" nil nil nil
                (lambda (filename)
                  (and (funcall #'file-directory-p filename)
                       (funcall #'my/predicate filename))))

Also, I think that it would follow the principle of least suprise to
have read-file-name and read-directory-name accept the same args.

>> @@ -1719,7 +1719,9 @@ combining @var{directory} (or the current buffer's=
 default directory
>>  if @var{directory} is @code{nil}) and @var{initial}.  If both
>>  @var{default} and @var{initial} are @code{nil}, this function uses
>>  @var{directory} as substitute default, or the current buffer's default
>> -directory if @var{directory} is @code{nil}.
>> +directory if @var{directory} is @code{nil}.  The union of sixth arg
>> +@code{predicate} and @code{file-directory-p} is passed as the
>
> This should be elaborated: what is meant by "the union of sixth arg
> and 'file-directory-p'"?
>
>> +@code{predicate} argument to =E2=80=98read-file-name=E2=80=99.
>                                 ^^^^^^^^^^^^^^^^
> That should be @code{read-file-name}
>
>> +** 'read-directory-name' now accepts an optional PREDICATE argument.
>> +The union of sixth arg PREDICATE and 'file-directory-p' is passed
>> +as the PREDICATE argument to 'read-file-name'.
>
> Likewise here, regarding the "union" part.
>
> Also, since you submit the patch for the manual, this NEWS entry
> should be marked with "+++".
>
>>  Fifth arg INITIAL specifies text to start with.
>>  DIR should be an absolute directory name.  It defaults to
>> -the value of `default-directory'."
>> +the value of `default-directory'.
>> +The union of sixth arg PREDICATE and `file-directory-p' is passed
>> +as the PREDICATE argument to `read-file-name'."
>
> The "union" part again.

Thanks for the review!! Please see attached patch.

Best,

Joseph


--=-=-=
Content-Type: text/x-diff
Content-Disposition: attachment;
 filename=0001-Add-optional-PREDICATE-argument-to-read-directory-na.patch

From 1c7581914c1b446ea17692d425a4605d915fa7ef Mon Sep 17 00:00:00 2001
From: Joseph Turner <joseph@HIDDEN>
Date: Thu, 28 Sep 2023 20:27:47 -0700
Subject: [PATCH] Add optional PREDICATE argument to read-directory-name

* lisp/files.el (read-directory-name): Add optional PREDICATE arg.
* doc/lispref/minibuf.texi (Reading File Names): Document change.
* etc/NEWS: Note change.
---
 doc/lispref/minibuf.texi |  8 ++++++--
 etc/NEWS                 |  7 +++++++
 lisp/files.el            | 14 +++++++++++---
 3 files changed, 24 insertions(+), 5 deletions(-)

diff --git a/doc/lispref/minibuf.texi b/doc/lispref/minibuf.texi
index 620c58ec6e9..eb344595ae3 100644
--- a/doc/lispref/minibuf.texi
+++ b/doc/lispref/minibuf.texi
@@ -1709,7 +1709,7 @@ If this variable is non-@code{nil}, @code{read-file-name} ignores case
 when performing completion.
 @end defopt
 
-@defun read-directory-name prompt &optional directory default require-match initial
+@defun read-directory-name prompt &optional directory default require-match initial predicate
 This function is like @code{read-file-name} but allows only directory
 names as completion alternatives.
 
@@ -1719,7 +1719,11 @@ combining @var{directory} (or the current buffer's default directory
 if @var{directory} is @code{nil}) and @var{initial}.  If both
 @var{default} and @var{initial} are @code{nil}, this function uses
 @var{directory} as substitute default, or the current buffer's default
-directory if @var{directory} is @code{nil}.
+directory if @var{directory} is @code{nil}.  Sixth arg
+@code{predicate}, if non-nil, should be a function of one argument;
+then a file name is considered an acceptable completion alternative if
+both @code{file-directory-p} and @code{predicate} return non-nil with
+the file name argument.
 @end defun
 
 @defopt insert-default-directory
diff --git a/etc/NEWS b/etc/NEWS
index 1b3532b5657..a5a41d6546f 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -3541,6 +3541,13 @@ This function is called to see whether what the user has typed is a
 match.  This is also available from functions that call
 'completing-read', like 'read-file-name'.
 
++++
+** 'read-directory-name' now accepts an optional PREDICATE argument.
+Sixth arg PREDICATE, if non-nil, should be a function of one argument;
+then a file name is considered an acceptable completion alternative if
+both `file-directory-p' and PREDICATE return non-nil with the file
+name argument.
+
 ** 'posn-col-row' can now give position data based on windows.
 Previously, it reported data only based on the frame.
 
diff --git a/lisp/files.el b/lisp/files.el
index b72f141c0ee..1663f1e2d71 100644
--- a/lisp/files.el
+++ b/lisp/files.el
@@ -807,7 +807,7 @@ See Info node `(elisp)Standard File Names' for more details."
     (dos-convert-standard-filename filename))
    (t filename)))
 
-(defun read-directory-name (prompt &optional dir default-dirname mustmatch initial)
+(defun read-directory-name (prompt &optional dir default-dirname mustmatch initial predicate)
   "Read directory name, prompting with PROMPT and completing in directory DIR.
 Value is not expanded---you must call `expand-file-name' yourself.
 Default name to DEFAULT-DIRNAME if user exits with the same
@@ -821,14 +821,22 @@ Fourth arg MUSTMATCH non-nil means require existing directory's name.
  Non-nil and non-t means also require confirmation after completion.
 Fifth arg INITIAL specifies text to start with.
 DIR should be an absolute directory name.  It defaults to
-the value of `default-directory'."
+the value of `default-directory'.
+Sixth arg PREDICATE, if non-nil, should be a function of one
+argument; then a file name is considered an acceptable completion
+alternative if both `file-directory-p' and PREDICATE return
+non-nil with the file name argument."
   (unless dir
     (setq dir default-directory))
   (read-file-name prompt dir (or default-dirname
 				 (if initial (expand-file-name initial dir)
 				   dir))
 		  mustmatch initial
-		  'file-directory-p))
+                  (if predicate
+                      (lambda (filename)
+                        (and (file-directory-p filename)
+                             (funcall predicate filename)))
+                    #'file-directory-p)))
 
 
 (defun pwd (&optional insert)
-- 
2.41.0


--=-=-=--




Message sent to bug-gnu-emacs@HIDDEN:


X-Loop: help-debbugs@HIDDEN
Subject: bug#66224: [PATCH] Add optional PREDICATE argument to read-directory-name
Resent-From: Joseph Turner <joseph@HIDDEN>
Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
Resent-CC: bug-gnu-emacs@HIDDEN
Resent-Date: Tue, 03 Oct 2023 23:24:01 +0000
Resent-Message-ID: <handler.66224.B.169637543115112 <at> debbugs.gnu.org>
Resent-Sender: help-debbugs@HIDDEN
X-GNU-PR-Message: followup 66224
X-GNU-PR-Package: emacs
X-GNU-PR-Keywords: patch
To: Michael Heerdegen <michael_heerdegen@HIDDEN>
Cc: 66224 <at> debbugs.gnu.org, philipk@HIDDEN
X-Debbugs-Original-Cc: "Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors" <bug-gnu-emacs@HIDDEN>, 66224 <at> debbugs.gnu.org, philipk@HIDDEN
Received: via spool by submit <at> debbugs.gnu.org id=B.169637543115112
          (code B ref -1); Tue, 03 Oct 2023 23:24:01 +0000
Received: (at submit) by debbugs.gnu.org; 3 Oct 2023 23:23:51 +0000
Received: from localhost ([127.0.0.1]:40897 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1qnok2-0003vg-Sc
	for submit <at> debbugs.gnu.org; Tue, 03 Oct 2023 19:23:51 -0400
Received: from lists.gnu.org ([2001:470:142::17]:37042)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <joseph@HIDDEN>) id 1qnok0-0003vS-RU
 for submit <at> debbugs.gnu.org; Tue, 03 Oct 2023 19:23:49 -0400
Received: from eggs.gnu.org ([2001:470:142:3::10])
 by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <joseph@HIDDEN>)
 id 1qnojW-0000CS-HN
 for bug-gnu-emacs@HIDDEN; Tue, 03 Oct 2023 19:23:19 -0400
Received: from out-194.mta0.migadu.com ([2001:41d0:1004:224b::c2])
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <joseph@HIDDEN>)
 id 1qnojE-0002DH-9r
 for bug-gnu-emacs@HIDDEN; Tue, 03 Oct 2023 19:23:02 -0400
References: <877coch0q7.fsf@HIDDEN>
 <874jje1xds.fsf@HIDDEN> <87bkdly7t4.fsf@HIDDEN>
 <871qehr5vs.fsf@HIDDEN> <877co9y5jt.fsf@HIDDEN>
 <877co4tmav.fsf@HIDDEN>
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=breatheoutbreathe.in; 
 s=key1; t=1696375377;
 h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
 to:to:cc:cc:mime-version:mime-version:content-type:content-type:
 in-reply-to:in-reply-to:references:references;
 bh=e94Ko55sw/FYlsAGI+cVDNlqEJGNnG/2xCrwWpET3vs=;
 b=S10Ebt4IlpPbkIE76CtKPgvf11VoBbmE9i2QzLbt/5gYYN46YWiaLVMuT6BAyhhVGWbQx0
 EuHYWdyYhj8eV7mUTquqOYsCQ/3BAy/A+sbdhhPUInu2grhf9vvTsibTvgIfJdFEA3S92R
 llRVgez6b/H0tyRhzdkxNGqB49eMcXc=
X-Report-Abuse: Please report any abuse attempt to abuse@HIDDEN and
 include these headers.
From: Joseph Turner <joseph@HIDDEN>
Date: Tue, 03 Oct 2023 16:20:27 -0700
In-reply-to: <877co4tmav.fsf@HIDDEN>
Message-ID: <87bkdf47g5.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: text/plain
X-Migadu-Flow: FLOW_OUT
Received-SPF: pass client-ip=2001:41d0:1004:224b::c2;
 envelope-from=joseph@HIDDEN; helo=out-194.mta0.migadu.com
X-Spam_score_int: -20
X-Spam_score: -2.1
X-Spam_bar: --
X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1,
 DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_NONE=0.001,
 SPF_PASS=-0.001 autolearn=ham autolearn_force=no
X-Spam_action: no action
X-Spam-Score: 0.9 (/)
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -0.1 (/)


Michael Heerdegen <michael_heerdegen@HIDDEN> writes:

> You know that the predicate will be ignored when MUSTMATCH is t?
> The behavior is not different than for `read-file-name'.

I'm not sure what you mean. In both of the following examples, PREDICATE
is used to narrow the completion candidates to only empty directories:

(read-directory-name "Prompt: " "~/" nil t nil #'directory-empty-p)
(read-directory-name "Prompt: " "~/" nil nil nil #'directory-empty-p)

Thank you!

Joseph




Message sent to bug-gnu-emacs@HIDDEN:


X-Loop: help-debbugs@HIDDEN
Subject: bug#66224: [PATCH] Add optional PREDICATE argument to read-directory-name
Resent-From: Joseph Turner <joseph@HIDDEN>
Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
Resent-CC: bug-gnu-emacs@HIDDEN
Resent-Date: Tue, 03 Oct 2023 23:24:02 +0000
Resent-Message-ID: <handler.66224.B66224.169637539915052 <at> debbugs.gnu.org>
Resent-Sender: help-debbugs@HIDDEN
X-GNU-PR-Message: followup 66224
X-GNU-PR-Package: emacs
X-GNU-PR-Keywords: patch
To: Michael Heerdegen <michael_heerdegen@HIDDEN>
Cc: 66224 <at> debbugs.gnu.org, philipk@HIDDEN
X-Debbugs-Original-Cc: "Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors" <bug-gnu-emacs@HIDDEN>, 66224 <at> debbugs.gnu.org, philipk@HIDDEN
Received: via spool by 66224-submit <at> debbugs.gnu.org id=B66224.169637539915052
          (code B ref 66224); Tue, 03 Oct 2023 23:24:02 +0000
Received: (at 66224) by debbugs.gnu.org; 3 Oct 2023 23:23:19 +0000
Received: from localhost ([127.0.0.1]:40893 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1qnojX-0003ui-Hu
	for submit <at> debbugs.gnu.org; Tue, 03 Oct 2023 19:23:19 -0400
Received: from out-201.mta0.migadu.com ([2001:41d0:1004:224b::c9]:12747)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <joseph@HIDDEN>) id 1qnojU-0003uY-NH
 for 66224 <at> debbugs.gnu.org; Tue, 03 Oct 2023 19:23:18 -0400
References: <877coch0q7.fsf@HIDDEN>
 <874jje1xds.fsf@HIDDEN> <87bkdly7t4.fsf@HIDDEN>
 <871qehr5vs.fsf@HIDDEN> <877co9y5jt.fsf@HIDDEN>
 <877co4tmav.fsf@HIDDEN>
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=breatheoutbreathe.in; 
 s=key1; t=1696375377;
 h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
 to:to:cc:cc:mime-version:mime-version:content-type:content-type:
 in-reply-to:in-reply-to:references:references;
 bh=e94Ko55sw/FYlsAGI+cVDNlqEJGNnG/2xCrwWpET3vs=;
 b=S10Ebt4IlpPbkIE76CtKPgvf11VoBbmE9i2QzLbt/5gYYN46YWiaLVMuT6BAyhhVGWbQx0
 EuHYWdyYhj8eV7mUTquqOYsCQ/3BAy/A+sbdhhPUInu2grhf9vvTsibTvgIfJdFEA3S92R
 llRVgez6b/H0tyRhzdkxNGqB49eMcXc=
X-Report-Abuse: Please report any abuse attempt to abuse@HIDDEN and
 include these headers.
From: Joseph Turner <joseph@HIDDEN>
Date: Tue, 03 Oct 2023 16:20:27 -0700
In-reply-to: <877co4tmav.fsf@HIDDEN>
Message-ID: <87bkdf47g5.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: text/plain
X-Migadu-Flow: FLOW_OUT
X-Spam-Score: 0.0 (/)
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)


Michael Heerdegen <michael_heerdegen@HIDDEN> writes:

> You know that the predicate will be ignored when MUSTMATCH is t?
> The behavior is not different than for `read-file-name'.

I'm not sure what you mean. In both of the following examples, PREDICATE
is used to narrow the completion candidates to only empty directories:

(read-directory-name "Prompt: " "~/" nil t nil #'directory-empty-p)
(read-directory-name "Prompt: " "~/" nil nil nil #'directory-empty-p)

Thank you!

Joseph




Message sent to bug-gnu-emacs@HIDDEN:


X-Loop: help-debbugs@HIDDEN
Subject: bug#66224: [PATCH] Add optional PREDICATE argument to read-directory-name
Resent-From: Michael Heerdegen <michael_heerdegen@HIDDEN>
Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
Resent-CC: bug-gnu-emacs@HIDDEN
Resent-Date: Thu, 05 Oct 2023 01:25:01 +0000
Resent-Message-ID: <handler.66224.B.169646906812605 <at> debbugs.gnu.org>
Resent-Sender: help-debbugs@HIDDEN
X-GNU-PR-Message: followup 66224
X-GNU-PR-Package: emacs
X-GNU-PR-Keywords: patch
To: 66224 <at> debbugs.gnu.org
Cc: philipk@HIDDEN, joseph@HIDDEN
X-Debbugs-Original-To: Joseph Turner via "Bug reports for GNU Emacs, the Swiss army knife of text editors" <bug-gnu-emacs@HIDDEN>
X-Debbugs-Original-Cc: philipk@HIDDEN, 66224 <at> debbugs.gnu.org, Joseph Turner <joseph@HIDDEN>
Received: via spool by submit <at> debbugs.gnu.org id=B.169646906812605
          (code B ref -1); Thu, 05 Oct 2023 01:25:01 +0000
Received: (at submit) by debbugs.gnu.org; 5 Oct 2023 01:24:28 +0000
Received: from localhost ([127.0.0.1]:45607 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1qoD6K-0003HF-5l
	for submit <at> debbugs.gnu.org; Wed, 04 Oct 2023 21:24:28 -0400
Received: from lists.gnu.org ([2001:470:142::17]:47864)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <michael_heerdegen@HIDDEN>) id 1qoD6I-0003H0-5L
 for submit <at> debbugs.gnu.org; Wed, 04 Oct 2023 21:24:26 -0400
Received: from eggs.gnu.org ([2001:470:142:3::10])
 by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <michael_heerdegen@HIDDEN>)
 id 1qoD5s-0000TV-60
 for bug-gnu-emacs@HIDDEN; Wed, 04 Oct 2023 21:24:00 -0400
Received: from mout.web.de ([212.227.15.3])
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <michael_heerdegen@HIDDEN>)
 id 1qoD5q-0006XA-LI
 for bug-gnu-emacs@HIDDEN; Wed, 04 Oct 2023 21:23:59 -0400
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=web.de; s=s29768273;
 t=1696469028; x=1697073828; i=michael_heerdegen@HIDDEN;
 bh=zAaGWdrqVv0sx56fyvm/B+L0Wk+O2/bmEz7LAzgvFRY=;
 h=X-UI-Sender-Class:From:To:Cc:Subject:In-Reply-To:References:Date;
 b=XsuFwWtY6SvymBwZdnMplOMql94FUbX2V5+fWLy9mAY2x55uVNuJN1WmE4+tw4Gm50lZypRCwdc
 hP97SCBwepvULzIZjBgpHgKwxviqiE7EfXlJ25nCHebp+8nQZ60VlYjgSjm5EfIf8sOSGYp9tRrWc
 vAytPDg89NFBU8LEPm74BKpVu/N2+7RZ6ko9Ut44jdAFzxaATcY97bSVlZxLCVOe9ygCCWQSZUWR7
 +anTGvq8dV/Vk2sShuUPgQ83Jkll4eaY6hN73S6ofPEGdJbg+8hVWoG2rWWoN9utE2qseZ3dAgYmg
 BqJE4cScKHFn0AQ+/4EY4UHPAWpkswTWUZGA==
X-UI-Sender-Class: 814a7b36-bfc1-4dae-8640-3722d8ec6cd6
Received: from drachen.dragon ([88.66.201.191]) by smtp.web.de (mrweb006
 [213.165.67.108]) with ESMTPSA (Nemesis) id 1MIyeU-1r38g53ulW-00KPuZ; Thu, 05
 Oct 2023 03:23:48 +0200
From: Michael Heerdegen <michael_heerdegen@HIDDEN>
In-Reply-To: <87bkdf47g5.fsf@HIDDEN> (Joseph Turner via's
 message of "Tue, 03 Oct 2023 16:20:27 -0700")
References: <877coch0q7.fsf@HIDDEN> <874jje1xds.fsf@HIDDEN>
 <87bkdly7t4.fsf@HIDDEN> <871qehr5vs.fsf@HIDDEN>
 <877co9y5jt.fsf@HIDDEN> <877co4tmav.fsf@HIDDEN>
 <87bkdf47g5.fsf@HIDDEN>
Date: Thu, 05 Oct 2023 03:23:50 +0200
Message-ID: <87pm1t3lqx.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13)
MIME-Version: 1.0
Content-Type: text/plain
X-Provags-ID: V03:K1:ND6sCCBKQEibTgQZR8DZuD8neN2Lml6AH+u1ZgXOTOKfzJsyInQ
 2aXDmEKxn+w4hQkN15xlNjgEM6DRg98SZD3Cui3tsdwbmGfgLHJ+oZAtX3XG3ZyfOZbLGiL
 +hJjcNdd7OqVnse/otvj/ylYdtYlXUjy/7119b+aY3tAlR0jUtUnzkQysrtLH+koHFVXGle
 MquJo0UIlD2/UpDwgU5nQ==
X-Spam-Flag: NO
UI-OutboundReport: notjunk:1;M01:P0:eduuC5zceWU=;6QcFxxje61u9gLnstL/agSAMvL4
 b4xnCaU1acuiECXV9sOX6l9HakT/K4nVJh1Odx2dCMj8Xa4oWMsipkPPW9+aIjuxR9Zn1bUAh
 422O1Ihg/B6KVLxFS3uancGvlp6cZgPiKWE5CnaWCdfaEJ41KD5huox4JiW6xQOGZz3yyW6fI
 IL4hTk/xwlnP0R8ZsP73hSkjR5yDg2refcocwxajeip0K31DJYxHB7Z/JL6Vr7q7e03CViTKS
 +hFZZ7JjqGRcziQrWs+w02kpvecII7nIpxwbU0idtp1Wdzhr6weIh3WViJfU52CYyyqJOSg6i
 RqzJ3wB1wQf3zpKtyyYEfL60UQjV+pSRdyIeDyFT/8zME48pelOhzpvXejzTzsgTSCNxjcU/J
 sYPiqwg3Xs/I+/Pt3z8TaNO5WZy2rf0TBNm8DsimitOZaTEN8f9PO+7+2MI2wMCFW9WJ/KdW3
 s2rvQy57sf6avV8T2kKOA2wELQ0ST4H0rFG6VAPlNHGqBctuPTeJm9ZjVL4tEcr4ggK9ez2/N
 IggciiXTYiTr6G2bDhQpgGX9XnR/hCsPszWFKNF0y/mVsmOAQXiARSHmjvjzQ30vHd92CrVnM
 wCJFsRIYlChmlbx4VQ5hkHAANkOLslGiq6+zecIOXCo5r0iyXg/96VQD6lt8fQDQj1EHJewD5
 gQUx8dq5vxhVHnAb6ck0pFuDJHicbL/mLiiuw3MUUs3lN7a2nr0ERLQJL6vv4FE67zEFP/xis
 fDM/IFFQJKYyuZbKDyJD5xq1vHh44ttayj21nMszh8x199ZbOn+JxwN4bK7+aZLgUomAR9xP2
 KJXWHxDWAHkNQzIrTDYrL73ybF+SVBdCRBWsbpEkWWwMv/PZCRQBl1xD413hf/FgwTAWiJoQw
 bedKNC1JCWOJZ7ukNbQmKzh7crdnyxBwzgdMexSMoFLVBZ4YAqlyDbBsQFwT7ShBWzgbAAPdn
 LJrFMvW/YWBHl+yhNA8rIXK+Gbc=
Received-SPF: pass client-ip=212.227.15.3;
 envelope-from=michael_heerdegen@HIDDEN; helo=mout.web.de
X-Spam_score_int: -27
X-Spam_score: -2.8
X-Spam_bar: --
X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1,
 DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001,
 RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001,
 SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no
X-Spam_action: no action
X-Spam-Score: 1.0 (+)
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -0.0 (/)

Joseph Turner via "Bug reports for GNU Emacs, the Swiss army knife of
text editors" <bug-gnu-emacs@HIDDEN> writes:

> I'm not sure what you mean. In both of the following examples, PREDICATE
> is used to narrow the completion candidates to only empty directories:
>
> (read-directory-name "Prompt: " "~/" nil t nil #'directory-empty-p)
> (read-directory-name "Prompt: " "~/" nil nil nil #'directory-empty-p)

In the second version also non-empty directories will be accepted.

Michael.




Message sent to bug-gnu-emacs@HIDDEN:


X-Loop: help-debbugs@HIDDEN
Subject: bug#66224: [PATCH] Add optional PREDICATE argument to read-directory-name
Resent-From: Michael Heerdegen <michael_heerdegen@HIDDEN>
Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
Resent-CC: bug-gnu-emacs@HIDDEN
Resent-Date: Thu, 05 Oct 2023 01:25:02 +0000
Resent-Message-ID: <handler.66224.B66224.169646905612578 <at> debbugs.gnu.org>
Resent-Sender: help-debbugs@HIDDEN
X-GNU-PR-Message: followup 66224
X-GNU-PR-Package: emacs
X-GNU-PR-Keywords: patch
To: 66224 <at> debbugs.gnu.org
Cc: philipk@HIDDEN, joseph@HIDDEN
X-Debbugs-Original-To: Joseph Turner via "Bug reports for GNU Emacs, the Swiss army knife of text editors" <bug-gnu-emacs@HIDDEN>
X-Debbugs-Original-Cc: philipk@HIDDEN, 66224 <at> debbugs.gnu.org, Joseph Turner <joseph@HIDDEN>
Received: via spool by 66224-submit <at> debbugs.gnu.org id=B66224.169646905612578
          (code B ref 66224); Thu, 05 Oct 2023 01:25:02 +0000
Received: (at 66224) by debbugs.gnu.org; 5 Oct 2023 01:24:16 +0000
Received: from localhost ([127.0.0.1]:45604 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1qoD67-0003Gn-RM
	for submit <at> debbugs.gnu.org; Wed, 04 Oct 2023 21:24:16 -0400
Received: from mout.web.de ([212.227.15.3]:39873)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <michael_heerdegen@HIDDEN>) id 1qoD65-0003GU-HH
 for 66224 <at> debbugs.gnu.org; Wed, 04 Oct 2023 21:24:14 -0400
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=web.de; s=s29768273;
 t=1696469028; x=1697073828; i=michael_heerdegen@HIDDEN;
 bh=zAaGWdrqVv0sx56fyvm/B+L0Wk+O2/bmEz7LAzgvFRY=;
 h=X-UI-Sender-Class:From:To:Cc:Subject:In-Reply-To:References:Date;
 b=XsuFwWtY6SvymBwZdnMplOMql94FUbX2V5+fWLy9mAY2x55uVNuJN1WmE4+tw4Gm50lZypRCwdc
 hP97SCBwepvULzIZjBgpHgKwxviqiE7EfXlJ25nCHebp+8nQZ60VlYjgSjm5EfIf8sOSGYp9tRrWc
 vAytPDg89NFBU8LEPm74BKpVu/N2+7RZ6ko9Ut44jdAFzxaATcY97bSVlZxLCVOe9ygCCWQSZUWR7
 +anTGvq8dV/Vk2sShuUPgQ83Jkll4eaY6hN73S6ofPEGdJbg+8hVWoG2rWWoN9utE2qseZ3dAgYmg
 BqJE4cScKHFn0AQ+/4EY4UHPAWpkswTWUZGA==
X-UI-Sender-Class: 814a7b36-bfc1-4dae-8640-3722d8ec6cd6
Received: from drachen.dragon ([88.66.201.191]) by smtp.web.de (mrweb006
 [213.165.67.108]) with ESMTPSA (Nemesis) id 1MIyeU-1r38g53ulW-00KPuZ; Thu, 05
 Oct 2023 03:23:48 +0200
From: Michael Heerdegen <michael_heerdegen@HIDDEN>
In-Reply-To: <87bkdf47g5.fsf@HIDDEN> (Joseph Turner via's
 message of "Tue, 03 Oct 2023 16:20:27 -0700")
References: <877coch0q7.fsf@HIDDEN> <874jje1xds.fsf@HIDDEN>
 <87bkdly7t4.fsf@HIDDEN> <871qehr5vs.fsf@HIDDEN>
 <877co9y5jt.fsf@HIDDEN> <877co4tmav.fsf@HIDDEN>
 <87bkdf47g5.fsf@HIDDEN>
Date: Thu, 05 Oct 2023 03:23:50 +0200
Message-ID: <87pm1t3lqx.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13)
MIME-Version: 1.0
Content-Type: text/plain
X-Provags-ID: V03:K1:ND6sCCBKQEibTgQZR8DZuD8neN2Lml6AH+u1ZgXOTOKfzJsyInQ
 2aXDmEKxn+w4hQkN15xlNjgEM6DRg98SZD3Cui3tsdwbmGfgLHJ+oZAtX3XG3ZyfOZbLGiL
 +hJjcNdd7OqVnse/otvj/ylYdtYlXUjy/7119b+aY3tAlR0jUtUnzkQysrtLH+koHFVXGle
 MquJo0UIlD2/UpDwgU5nQ==
X-Spam-Flag: NO
UI-OutboundReport: notjunk:1;M01:P0:eduuC5zceWU=;6QcFxxje61u9gLnstL/agSAMvL4
 b4xnCaU1acuiECXV9sOX6l9HakT/K4nVJh1Odx2dCMj8Xa4oWMsipkPPW9+aIjuxR9Zn1bUAh
 422O1Ihg/B6KVLxFS3uancGvlp6cZgPiKWE5CnaWCdfaEJ41KD5huox4JiW6xQOGZz3yyW6fI
 IL4hTk/xwlnP0R8ZsP73hSkjR5yDg2refcocwxajeip0K31DJYxHB7Z/JL6Vr7q7e03CViTKS
 +hFZZ7JjqGRcziQrWs+w02kpvecII7nIpxwbU0idtp1Wdzhr6weIh3WViJfU52CYyyqJOSg6i
 RqzJ3wB1wQf3zpKtyyYEfL60UQjV+pSRdyIeDyFT/8zME48pelOhzpvXejzTzsgTSCNxjcU/J
 sYPiqwg3Xs/I+/Pt3z8TaNO5WZy2rf0TBNm8DsimitOZaTEN8f9PO+7+2MI2wMCFW9WJ/KdW3
 s2rvQy57sf6avV8T2kKOA2wELQ0ST4H0rFG6VAPlNHGqBctuPTeJm9ZjVL4tEcr4ggK9ez2/N
 IggciiXTYiTr6G2bDhQpgGX9XnR/hCsPszWFKNF0y/mVsmOAQXiARSHmjvjzQ30vHd92CrVnM
 wCJFsRIYlChmlbx4VQ5hkHAANkOLslGiq6+zecIOXCo5r0iyXg/96VQD6lt8fQDQj1EHJewD5
 gQUx8dq5vxhVHnAb6ck0pFuDJHicbL/mLiiuw3MUUs3lN7a2nr0ERLQJL6vv4FE67zEFP/xis
 fDM/IFFQJKYyuZbKDyJD5xq1vHh44ttayj21nMszh8x199ZbOn+JxwN4bK7+aZLgUomAR9xP2
 KJXWHxDWAHkNQzIrTDYrL73ybF+SVBdCRBWsbpEkWWwMv/PZCRQBl1xD413hf/FgwTAWiJoQw
 bedKNC1JCWOJZ7ukNbQmKzh7crdnyxBwzgdMexSMoFLVBZ4YAqlyDbBsQFwT7ShBWzgbAAPdn
 LJrFMvW/YWBHl+yhNA8rIXK+Gbc=
X-Spam-Score: -0.7 (/)
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.7 (-)

Joseph Turner via "Bug reports for GNU Emacs, the Swiss army knife of
text editors" <bug-gnu-emacs@HIDDEN> writes:

> I'm not sure what you mean. In both of the following examples, PREDICATE
> is used to narrow the completion candidates to only empty directories:
>
> (read-directory-name "Prompt: " "~/" nil t nil #'directory-empty-p)
> (read-directory-name "Prompt: " "~/" nil nil nil #'directory-empty-p)

In the second version also non-empty directories will be accepted.

Michael.




Message sent to bug-gnu-emacs@HIDDEN:


X-Loop: help-debbugs@HIDDEN
Subject: bug#66224: [PATCH] Add optional PREDICATE argument to read-directory-name
Resent-From: Joseph Turner <joseph@HIDDEN>
Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
Resent-CC: bug-gnu-emacs@HIDDEN
Resent-Date: Thu, 05 Oct 2023 01:37:02 +0000
Resent-Message-ID: <handler.66224.B.169646981714102 <at> debbugs.gnu.org>
Resent-Sender: help-debbugs@HIDDEN
X-GNU-PR-Message: followup 66224
X-GNU-PR-Package: emacs
X-GNU-PR-Keywords: patch
To: Michael Heerdegen <michael_heerdegen@HIDDEN>
Cc: 66224 <at> debbugs.gnu.org, philipk@HIDDEN
X-Debbugs-Original-Cc: "Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors" <bug-gnu-emacs@HIDDEN>, 66224 <at> debbugs.gnu.org, philipk@HIDDEN
Received: via spool by submit <at> debbugs.gnu.org id=B.169646981714102
          (code B ref -1); Thu, 05 Oct 2023 01:37:02 +0000
Received: (at submit) by debbugs.gnu.org; 5 Oct 2023 01:36:57 +0000
Received: from localhost ([127.0.0.1]:45633 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1qoDIO-0003fM-Td
	for submit <at> debbugs.gnu.org; Wed, 04 Oct 2023 21:36:57 -0400
Received: from lists.gnu.org ([2001:470:142::17]:44920)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <joseph@HIDDEN>) id 1qoDIN-0003f7-6H
 for submit <at> debbugs.gnu.org; Wed, 04 Oct 2023 21:36:55 -0400
Received: from eggs.gnu.org ([2001:470:142:3::10])
 by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <joseph@HIDDEN>)
 id 1qoDHz-0003Wi-L2
 for bug-gnu-emacs@HIDDEN; Wed, 04 Oct 2023 21:36:31 -0400
Received: from out-209.mta1.migadu.com ([95.215.58.209])
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <joseph@HIDDEN>)
 id 1qoDHx-0002IA-6S
 for bug-gnu-emacs@HIDDEN; Wed, 04 Oct 2023 21:36:31 -0400
References: <877coch0q7.fsf@HIDDEN>
 <874jje1xds.fsf@HIDDEN> <87bkdly7t4.fsf@HIDDEN>
 <871qehr5vs.fsf@HIDDEN> <877co9y5jt.fsf@HIDDEN>
 <877co4tmav.fsf@HIDDEN> <87bkdf47g5.fsf@HIDDEN>
 <87pm1t3lqx.fsf@HIDDEN>
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=breatheoutbreathe.in; 
 s=key1; t=1696469785;
 h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
 to:to:cc:cc:mime-version:mime-version:content-type:content-type:
 in-reply-to:in-reply-to:references:references;
 bh=AhYnCnwsuqmWI79hfkbQt4rAmT9+7Zzy5XrlLr+cpiM=;
 b=C1yOTi20rFisnuUMbclTtFcvLr7YoaFXSxZe7mWf6+Kro2IfAAHzllr6L3ZU9R6ZMjHyYj
 F9vXct4mhFf5BnDF0dPOL9xEakNnDO/bipKIbOTKlzpV1c+lMYyrUHbFH6Dj8w/VIOhA9Z
 lriIGzWaBeCvHoCEUFWtt2K+HRLhfRs=
X-Report-Abuse: Please report any abuse attempt to abuse@HIDDEN and
 include these headers.
From: Joseph Turner <joseph@HIDDEN>
Date: Wed, 04 Oct 2023 18:34:30 -0700
In-reply-to: <87pm1t3lqx.fsf@HIDDEN>
Message-ID: <87v8blzw89.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: text/plain
X-Migadu-Flow: FLOW_OUT
Received-SPF: pass client-ip=95.215.58.209;
 envelope-from=joseph@HIDDEN; helo=out-209.mta1.migadu.com
X-Spam_score_int: -20
X-Spam_score: -2.1
X-Spam_bar: --
X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1,
 DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_NONE=0.001,
 SPF_PASS=-0.001 autolearn=ham autolearn_force=no
X-Spam_action: no action
X-Spam-Score: 0.9 (/)
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -0.1 (/)


Michael Heerdegen <michael_heerdegen@HIDDEN> writes:

> Joseph Turner via "Bug reports for GNU Emacs, the Swiss army knife of
> text editors" <bug-gnu-emacs@HIDDEN> writes:
>
>> I'm not sure what you mean. In both of the following examples, PREDICATE
>> is used to narrow the completion candidates to only empty directories:
>>
>> (read-directory-name "Prompt: " "~/" nil t nil #'directory-empty-p)
>> (read-directory-name "Prompt: " "~/" nil nil nil #'directory-empty-p)
>
> In the second version also non-empty directories will be accepted.

Yes, PREDICATE narrows the completion candidates but doesn't determine a
valid return value.






Message sent to bug-gnu-emacs@HIDDEN:


X-Loop: help-debbugs@HIDDEN
Subject: bug#66224: [PATCH] Add optional PREDICATE argument to read-directory-name
Resent-From: Joseph Turner <joseph@HIDDEN>
Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
Resent-CC: bug-gnu-emacs@HIDDEN
Resent-Date: Thu, 05 Oct 2023 01:37:02 +0000
Resent-Message-ID: <handler.66224.B66224.169646980914078 <at> debbugs.gnu.org>
Resent-Sender: help-debbugs@HIDDEN
X-GNU-PR-Message: followup 66224
X-GNU-PR-Package: emacs
X-GNU-PR-Keywords: patch
To: Michael Heerdegen <michael_heerdegen@HIDDEN>
Cc: 66224 <at> debbugs.gnu.org, philipk@HIDDEN
X-Debbugs-Original-Cc: "Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors" <bug-gnu-emacs@HIDDEN>, 66224 <at> debbugs.gnu.org, philipk@HIDDEN
Received: via spool by 66224-submit <at> debbugs.gnu.org id=B66224.169646980914078
          (code B ref 66224); Thu, 05 Oct 2023 01:37:02 +0000
Received: (at 66224) by debbugs.gnu.org; 5 Oct 2023 01:36:49 +0000
Received: from localhost ([127.0.0.1]:45630 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1qoDIH-0003ez-JI
	for submit <at> debbugs.gnu.org; Wed, 04 Oct 2023 21:36:49 -0400
Received: from out-202.mta1.migadu.com ([2001:41d0:203:375::ca]:23931)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <joseph@HIDDEN>) id 1qoDIE-0003eh-If
 for 66224 <at> debbugs.gnu.org; Wed, 04 Oct 2023 21:36:48 -0400
References: <877coch0q7.fsf@HIDDEN>
 <874jje1xds.fsf@HIDDEN> <87bkdly7t4.fsf@HIDDEN>
 <871qehr5vs.fsf@HIDDEN> <877co9y5jt.fsf@HIDDEN>
 <877co4tmav.fsf@HIDDEN> <87bkdf47g5.fsf@HIDDEN>
 <87pm1t3lqx.fsf@HIDDEN>
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=breatheoutbreathe.in; 
 s=key1; t=1696469785;
 h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
 to:to:cc:cc:mime-version:mime-version:content-type:content-type:
 in-reply-to:in-reply-to:references:references;
 bh=AhYnCnwsuqmWI79hfkbQt4rAmT9+7Zzy5XrlLr+cpiM=;
 b=C1yOTi20rFisnuUMbclTtFcvLr7YoaFXSxZe7mWf6+Kro2IfAAHzllr6L3ZU9R6ZMjHyYj
 F9vXct4mhFf5BnDF0dPOL9xEakNnDO/bipKIbOTKlzpV1c+lMYyrUHbFH6Dj8w/VIOhA9Z
 lriIGzWaBeCvHoCEUFWtt2K+HRLhfRs=
X-Report-Abuse: Please report any abuse attempt to abuse@HIDDEN and
 include these headers.
From: Joseph Turner <joseph@HIDDEN>
Date: Wed, 04 Oct 2023 18:34:30 -0700
In-reply-to: <87pm1t3lqx.fsf@HIDDEN>
Message-ID: <87v8blzw89.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: text/plain
X-Migadu-Flow: FLOW_OUT
X-Spam-Score: 0.0 (/)
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)


Michael Heerdegen <michael_heerdegen@HIDDEN> writes:

> Joseph Turner via "Bug reports for GNU Emacs, the Swiss army knife of
> text editors" <bug-gnu-emacs@HIDDEN> writes:
>
>> I'm not sure what you mean. In both of the following examples, PREDICATE
>> is used to narrow the completion candidates to only empty directories:
>>
>> (read-directory-name "Prompt: " "~/" nil t nil #'directory-empty-p)
>> (read-directory-name "Prompt: " "~/" nil nil nil #'directory-empty-p)
>
> In the second version also non-empty directories will be accepted.

Yes, PREDICATE narrows the completion candidates but doesn't determine a
valid return value.






Message sent to bug-gnu-emacs@HIDDEN:


X-Loop: help-debbugs@HIDDEN
Subject: bug#66224: [PATCH] Add optional PREDICATE argument to read-directory-name
Resent-From: Joseph Turner <joseph@HIDDEN>
Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
Resent-CC: bug-gnu-emacs@HIDDEN
Resent-Date: Sun, 12 Nov 2023 20:46:02 +0000
Resent-Message-ID: <handler.66224.B.16998219183777 <at> debbugs.gnu.org>
Resent-Sender: help-debbugs@HIDDEN
X-GNU-PR-Message: followup 66224
X-GNU-PR-Package: emacs
X-GNU-PR-Keywords: patch
To: michael_heerdegen@HIDDEN, 66224 <at> debbugs.gnu.org, philipk@HIDDEN
X-Debbugs-Original-To: Michael Heerdegen <michael_heerdegen@HIDDEN>, "Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of   text editors" <bug-gnu-emacs@HIDDEN>, 66224 <at> debbugs.gnu.org, philipk@HIDDEN
Received: via spool by submit <at> debbugs.gnu.org id=B.16998219183777
          (code B ref -1); Sun, 12 Nov 2023 20:46:02 +0000
Received: (at submit) by debbugs.gnu.org; 12 Nov 2023 20:45:18 +0000
Received: from localhost ([127.0.0.1]:57114 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1r2HKX-0000yq-Qh
	for submit <at> debbugs.gnu.org; Sun, 12 Nov 2023 15:45:18 -0500
Received: from lists.gnu.org ([2001:470:142::17]:52502)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <joseph@HIDDEN>) id 1r2HKV-0000yT-6p
 for submit <at> debbugs.gnu.org; Sun, 12 Nov 2023 15:45:16 -0500
Received: from eggs.gnu.org ([2001:470:142:3::10])
 by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <joseph@HIDDEN>)
 id 1r2HJi-0004rP-Ew
 for bug-gnu-emacs@HIDDEN; Sun, 12 Nov 2023 15:44:26 -0500
Received: from out-179.mta1.migadu.com ([95.215.58.179])
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <joseph@HIDDEN>)
 id 1r2HJg-00055A-7s
 for bug-gnu-emacs@HIDDEN; Sun, 12 Nov 2023 15:44:26 -0500
References: <877coch0q7.fsf@HIDDEN>
 <874jje1xds.fsf@HIDDEN> <87bkdly7t4.fsf@HIDDEN>
 <871qehr5vs.fsf@HIDDEN> <877co9y5jt.fsf@HIDDEN>
 <877co4tmav.fsf@HIDDEN> <87bkdf47g5.fsf@HIDDEN>
 <87pm1t3lqx.fsf@HIDDEN> <87v8blzw89.fsf@HIDDEN>
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=breatheoutbreathe.in; 
 s=key1; t=1699821862;
 h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
 to:to:cc:mime-version:mime-version:content-type:content-type:
 in-reply-to:in-reply-to:references:references;
 bh=wjfaOKqLoIojGmabAfO68eRzqwXmkvjCPVZgoiS2zyo=;
 b=GXOGM6BRXYSDqqx9pB8AjVJCbKgXYYkCOKs3ZwaYcPr0h7qelEjqwYQkT+RFp70pA2G+m2
 cFA5qoQOmoNrm+l7r6WhsADaO1+D/ITC0ikJ9jiqFtY7Jb2F0X80RKUSno9eqm9YznIvu+
 cuXUpjTC7bevt6vsRQSSm3kduX4OlBo=
X-Report-Abuse: Please report any abuse attempt to abuse@HIDDEN and
 include these headers.
From: Joseph Turner <joseph@HIDDEN>
Date: Sun, 12 Nov 2023 12:42:42 -0800
In-reply-to: <87v8blzw89.fsf@HIDDEN>
Message-ID: <87il66og65.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: text/plain
X-Migadu-Flow: FLOW_OUT
Received-SPF: pass client-ip=95.215.58.179;
 envelope-from=joseph@HIDDEN; helo=out-179.mta1.migadu.com
X-Spam_score_int: -20
X-Spam_score: -2.1
X-Spam_bar: --
X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1,
 DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_NONE=0.001,
 SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no
X-Spam_action: no action
X-Spam-Score: 0.9 (/)
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -0.1 (/)


Joseph Turner <joseph@HIDDEN> writes:

> Michael Heerdegen <michael_heerdegen@HIDDEN> writes:
>
>> Joseph Turner via "Bug reports for GNU Emacs, the Swiss army knife of
>> text editors" <bug-gnu-emacs@HIDDEN> writes:
>>
>>> I'm not sure what you mean. In both of the following examples, PREDICATE
>>> is used to narrow the completion candidates to only empty directories:
>>>
>>> (read-directory-name "Prompt: " "~/" nil t nil #'directory-empty-p)
>>> (read-directory-name "Prompt: " "~/" nil nil nil #'directory-empty-p)
>>
>> In the second version also non-empty directories will be accepted.
>
> Yes, PREDICATE narrows the completion candidates but doesn't determine a
> valid return value.

Ping!  I'm happy to keep discussing this patch if others are interested.




Message sent to bug-gnu-emacs@HIDDEN:


X-Loop: help-debbugs@HIDDEN
Subject: bug#66224: [PATCH] Add optional PREDICATE argument to read-directory-name
Resent-From: Joseph Turner <joseph@HIDDEN>
Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
Resent-CC: bug-gnu-emacs@HIDDEN
Resent-Date: Sun, 12 Nov 2023 20:46:02 +0000
Resent-Message-ID: <handler.66224.B66224.16998219083755 <at> debbugs.gnu.org>
Resent-Sender: help-debbugs@HIDDEN
X-GNU-PR-Message: followup 66224
X-GNU-PR-Package: emacs
X-GNU-PR-Keywords: patch
To: michael_heerdegen@HIDDEN, 66224 <at> debbugs.gnu.org, philipk@HIDDEN
X-Debbugs-Original-To: Michael Heerdegen <michael_heerdegen@HIDDEN>, "Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of   text editors" <bug-gnu-emacs@HIDDEN>, 66224 <at> debbugs.gnu.org, philipk@HIDDEN
Received: via spool by 66224-submit <at> debbugs.gnu.org id=B66224.16998219083755
          (code B ref 66224); Sun, 12 Nov 2023 20:46:02 +0000
Received: (at 66224) by debbugs.gnu.org; 12 Nov 2023 20:45:08 +0000
Received: from localhost ([127.0.0.1]:57111 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1r2HKO-0000yV-GK
	for submit <at> debbugs.gnu.org; Sun, 12 Nov 2023 15:45:08 -0500
Received: from out-173.mta1.migadu.com ([2001:41d0:203:375::ad]:19829)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <joseph@HIDDEN>) id 1r2HKK-0000yJ-V3
 for 66224 <at> debbugs.gnu.org; Sun, 12 Nov 2023 15:45:06 -0500
References: <877coch0q7.fsf@HIDDEN>
 <874jje1xds.fsf@HIDDEN> <87bkdly7t4.fsf@HIDDEN>
 <871qehr5vs.fsf@HIDDEN> <877co9y5jt.fsf@HIDDEN>
 <877co4tmav.fsf@HIDDEN> <87bkdf47g5.fsf@HIDDEN>
 <87pm1t3lqx.fsf@HIDDEN> <87v8blzw89.fsf@HIDDEN>
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=breatheoutbreathe.in; 
 s=key1; t=1699821862;
 h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
 to:to:cc:mime-version:mime-version:content-type:content-type:
 in-reply-to:in-reply-to:references:references;
 bh=wjfaOKqLoIojGmabAfO68eRzqwXmkvjCPVZgoiS2zyo=;
 b=GXOGM6BRXYSDqqx9pB8AjVJCbKgXYYkCOKs3ZwaYcPr0h7qelEjqwYQkT+RFp70pA2G+m2
 cFA5qoQOmoNrm+l7r6WhsADaO1+D/ITC0ikJ9jiqFtY7Jb2F0X80RKUSno9eqm9YznIvu+
 cuXUpjTC7bevt6vsRQSSm3kduX4OlBo=
X-Report-Abuse: Please report any abuse attempt to abuse@HIDDEN and
 include these headers.
From: Joseph Turner <joseph@HIDDEN>
Date: Sun, 12 Nov 2023 12:42:42 -0800
In-reply-to: <87v8blzw89.fsf@HIDDEN>
Message-ID: <87il66og65.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: text/plain
X-Migadu-Flow: FLOW_OUT
X-Spam-Score: 0.0 (/)
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)


Joseph Turner <joseph@HIDDEN> writes:

> Michael Heerdegen <michael_heerdegen@HIDDEN> writes:
>
>> Joseph Turner via "Bug reports for GNU Emacs, the Swiss army knife of
>> text editors" <bug-gnu-emacs@HIDDEN> writes:
>>
>>> I'm not sure what you mean. In both of the following examples, PREDICATE
>>> is used to narrow the completion candidates to only empty directories:
>>>
>>> (read-directory-name "Prompt: " "~/" nil t nil #'directory-empty-p)
>>> (read-directory-name "Prompt: " "~/" nil nil nil #'directory-empty-p)
>>
>> In the second version also non-empty directories will be accepted.
>
> Yes, PREDICATE narrows the completion candidates but doesn't determine a
> valid return value.

Ping!  I'm happy to keep discussing this patch if others are interested.




Message sent to bug-gnu-emacs@HIDDEN:


X-Loop: help-debbugs@HIDDEN
Subject: bug#66224: [PATCH] Add optional PREDICATE argument to read-directory-name
Resent-From: Stefan Kangas <stefankangas@HIDDEN>
Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
Resent-CC: bug-gnu-emacs@HIDDEN
Resent-Date: Sat, 13 Jan 2024 10:54:01 +0000
Resent-Message-ID: <handler.66224.B66224.170514323926311 <at> debbugs.gnu.org>
Resent-Sender: help-debbugs@HIDDEN
X-GNU-PR-Message: followup 66224
X-GNU-PR-Package: emacs
X-GNU-PR-Keywords: patch
To: Joseph Turner <joseph@HIDDEN>
Cc: michael_heerdegen@HIDDEN, philipk@HIDDEN, 66224 <at> debbugs.gnu.org
Received: via spool by 66224-submit <at> debbugs.gnu.org id=B66224.170514323926311
          (code B ref 66224); Sat, 13 Jan 2024 10:54:01 +0000
Received: (at 66224) by debbugs.gnu.org; 13 Jan 2024 10:53:59 +0000
Received: from localhost ([127.0.0.1]:38535 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1rObeJ-0006qJ-3D
	for submit <at> debbugs.gnu.org; Sat, 13 Jan 2024 05:53:59 -0500
Received: from mail-ed1-x534.google.com ([2a00:1450:4864:20::534]:46098)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <stefankangas@HIDDEN>) id 1rObeH-0006q6-33
 for 66224 <at> debbugs.gnu.org; Sat, 13 Jan 2024 05:53:57 -0500
Received: by mail-ed1-x534.google.com with SMTP id
 4fb4d7f45d1cf-555e07761acso8730375a12.0
 for <66224 <at> debbugs.gnu.org>; Sat, 13 Jan 2024 02:53:58 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=gmail.com; s=20230601; t=1705143232; x=1705748032; darn=debbugs.gnu.org;
 h=cc:to:subject:message-id:date:mime-version:references:in-reply-to
 :from:from:to:cc:subject:date:message-id:reply-to;
 bh=yLbGgvEvMjTbjTML7Zxglk78bg33sCvUbTRXOkx1seU=;
 b=HvexdRORkQSq3DrsIeTIC91hI2Itnz8ugT29lYx0tVi6xzcvoAEpT2kNNadZHGJz8h
 kmgo5KcnYz4wZHWAb1x+WDIMtTPJOnbESVFfmNcVcIBWwHjbg8TofW0l9kMY98i3R64V
 Mo+dUwn8iiJ6IMDnprY0d3f8thWnl8ejxIceNZDtlJ9s2D+P2UYZ8OOWZy6SKGb3t+pL
 oED5GLPTgIZlLvoHpVkPn7bGqdua+W5f6Q+mkoJBqJ2MMgh2eFzHmhNJU13cjieo/lQ/
 q5x1KJpsCKYVdIhqBdbJQP8qa/jLQE/c/ku50m/b3CW6K2EGWoTuujJZNLv/xk8vvqij
 xEZA==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20230601; t=1705143232; x=1705748032;
 h=cc:to:subject:message-id:date:mime-version:references:in-reply-to
 :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to;
 bh=yLbGgvEvMjTbjTML7Zxglk78bg33sCvUbTRXOkx1seU=;
 b=XLQ//9ubPmn7zsCtxmenUn7DFpdOhM/2rgm0LEnAXyvX4v+XGXcR9e4ymhbmv8sE7H
 crwfaUS8r/C05hQOYqJmHkrHMiELQXGrit7duQVxbtzVKSl/Wz2cOOGc/ig2C38KqWVH
 QSJYwXBjLYbonHbhEtE4EtIwnLCjc0frNg1+xzq9t9YzbzYC+WhgjK5xG4C7T9j1iHvw
 6RUtsJfSA7Mw6+PabbbW5mIxcdhgJZnWO9sbHOzETquvJ9FPyOzdk+pI93yRgTrjCibU
 rcr0ht3AHcN53sJedCm9pUMmngHHX+B1fZB6NaUlPu159DNRpH+g2SLOKIi3QyqsrUCt
 2l/g==
X-Gm-Message-State: AOJu0YxXRsZdgs8krOzhNwLDpgJ4UvraD0FxiciD577/HD73QcStdcuK
 PNCCtkEl3I0CqvyI/zPFpEIps3gSRf9oyqZ3vcn2ngEF
X-Google-Smtp-Source: AGHT+IEAJxCv91umGdzw2HaCWRwlORitd4ltTd8wkPjiu0hhqgXb5qt+IQpZ7RnuWgdJrbbgsCbwwM5M1CEFkBxzDao=
X-Received: by 2002:a05:6402:78a:b0:559:e97:c967 with SMTP id
 d10-20020a056402078a00b005590e97c967mr74790edy.77.1705143232649; Sat, 13 Jan
 2024 02:53:52 -0800 (PST)
Received: from 753933720722 named unknown by gmailapi.google.com with
 HTTPREST; Sat, 13 Jan 2024 04:53:52 -0600
From: Stefan Kangas <stefankangas@HIDDEN>
In-Reply-To: <87il66og65.fsf@HIDDEN> (Joseph Turner's message of
 "Sun, 12 Nov 2023 12:42:42 -0800")
References: <877coch0q7.fsf@HIDDEN> <874jje1xds.fsf@HIDDEN>
 <87bkdly7t4.fsf@HIDDEN> <871qehr5vs.fsf@HIDDEN>
 <877co9y5jt.fsf@HIDDEN> <877co4tmav.fsf@HIDDEN>
 <87bkdf47g5.fsf@HIDDEN> <87pm1t3lqx.fsf@HIDDEN>
 <87v8blzw89.fsf@HIDDEN> <87il66og65.fsf@HIDDEN>
MIME-Version: 1.0
Date: Sat, 13 Jan 2024 04:53:52 -0600
Message-ID: <CADwFkmk-efLbBxjGWcfthiN-0pLWAtmqEyCAw_0pw_79LhOHvg@HIDDEN>
Content-Type: text/plain; charset="UTF-8"
X-Spam-Score: -0.0 (/)
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

Joseph Turner <joseph@HIDDEN> writes:

> Joseph Turner <joseph@HIDDEN> writes:
>
>> Michael Heerdegen <michael_heerdegen@HIDDEN> writes:
>>
>>> Joseph Turner via "Bug reports for GNU Emacs, the Swiss army knife of
>>> text editors" <bug-gnu-emacs@HIDDEN> writes:
>>>
>>>> I'm not sure what you mean. In both of the following examples, PREDICATE
>>>> is used to narrow the completion candidates to only empty directories:
>>>>
>>>> (read-directory-name "Prompt: " "~/" nil t nil #'directory-empty-p)
>>>> (read-directory-name "Prompt: " "~/" nil nil nil #'directory-empty-p)
>>>
>>> In the second version also non-empty directories will be accepted.
>>
>> Yes, PREDICATE narrows the completion candidates but doesn't determine a
>> valid return value.
>
> Ping!  I'm happy to keep discussing this patch if others are interested.

Could you please send the latest version of your patch?




Message received at control <at> debbugs.gnu.org:


Received: (at control) by debbugs.gnu.org; 13 Jan 2024 10:54:11 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sat Jan 13 05:54:11 2024
Received: from localhost ([127.0.0.1]:38539 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1rObeV-0006rB-EP
	for submit <at> debbugs.gnu.org; Sat, 13 Jan 2024 05:54:11 -0500
Received: from mail-ed1-x52e.google.com ([2a00:1450:4864:20::52e]:44424)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <stefankangas@HIDDEN>) id 1rObeS-0006qu-W1
 for control <at> debbugs.gnu.org; Sat, 13 Jan 2024 05:54:10 -0500
Received: by mail-ed1-x52e.google.com with SMTP id
 4fb4d7f45d1cf-558fc54e28eso306489a12.1
 for <control <at> debbugs.gnu.org>; Sat, 13 Jan 2024 02:54:10 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=gmail.com; s=20230601; t=1705143244; x=1705748044; darn=debbugs.gnu.org;
 h=to:subject:message-id:date:mime-version:from:from:to:cc:subject
 :date:message-id:reply-to;
 bh=qfY+BOyRVAMMVLscdKXiWlxqniAJYiGQGIurAxmYQFo=;
 b=NcxxInDgFEW9jQ9sIIQVJw12WjXLGyWGejlIox18PwpIx6brfPtGfE+iZzynz1ZxRk
 HA8Czjn5ShNgxpQzMf7X43ldAin+Ox5v9CqNfT8xBhL1G1td2E/sLYHyEWrztcxJADVh
 Ztv28zqOw68cLgnVxepdGulJaQUe6RzEzB/W50hPouNFrhr2Um5ZvnKRCh2hsm29Cjn1
 jovnZuFnH24n5UVttAno98FQUcjt4e48nVyTEVTuqGab7P/xofE2uPdwKFqb/CRwoo9S
 O4y/ZDSaHUzfHT+y72XL8YlBG5k4FJaWPf0uQgnY/cJSpBbeJ+zs+5nKCxpHH9JH5XLH
 8Ebw==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20230601; t=1705143244; x=1705748044;
 h=to:subject:message-id:date:mime-version:from:x-gm-message-state
 :from:to:cc:subject:date:message-id:reply-to;
 bh=qfY+BOyRVAMMVLscdKXiWlxqniAJYiGQGIurAxmYQFo=;
 b=uiwwkCs+HVP6AxU0BGlBbynzQiZASqB7IudLIfHpB2RXOsz2mgzAFLPRb1ZY5wQ3yH
 h7LzcH56VtzpmCejzoXw+KRgfCX64wg2DbGWkA02Je6zR7H+a63ie5QpeMojdAD0v2D6
 Bq3l4N9jESv6wsnoBovxDPzLCPp4P0FyagvFOJLE6+wQQY+bqCHq/Iy2Baazt+JqhIWC
 xjz+1UBbmx2abt20OTDtsIa5F0p+RRQ83r7wLbM2B4ye/RGOJ9Xly0jtXpDPiHqIxkgd
 h6XuoIKnqi7GSsh+El3gcLR2llzeL1ECX8ovVle1ZTh7rVb6TlJ2i4qxq86kWkaKLDzb
 zSVg==
X-Gm-Message-State: AOJu0YykjYKjuJkeQIsRkSzUkUbzF8okOKD/7fXIUAvsnm9PtzMkZgJL
 tD0DNTE5Tr0T52TLeuPoLHEEX48TE2KTIKWZGE9+zcn7
X-Google-Smtp-Source: AGHT+IHEwKGeX7tCbmrjt2i78J2BhZiPax7GNR2rfDlsdfe3rBv91D07O4MyVJwkf7UIZty1su2BKEHGp/NwUodhNu4=
X-Received: by 2002:aa7:d605:0:b0:559:4c0:9e5a with SMTP id
 c5-20020aa7d605000000b0055904c09e5amr180535edr.31.1705143244665; Sat, 13 Jan
 2024 02:54:04 -0800 (PST)
Received: from 753933720722 named unknown by gmailapi.google.com with
 HTTPREST; Sat, 13 Jan 2024 04:54:04 -0600
From: Stefan Kangas <stefankangas@HIDDEN>
MIME-Version: 1.0
Date: Sat, 13 Jan 2024 04:54:04 -0600
Message-ID: <CADwFkm=QYh53r8oWc+RPWCkfT_+-T0AX476aXgLCLH2kMtsV8A@HIDDEN>
Subject: control message for bug #66224
To: control <at> debbugs.gnu.org
Content-Type: text/plain; charset="UTF-8"
X-Spam-Score: -0.0 (/)
X-Debbugs-Envelope-To: control
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

severity 66224 wishlist
quit




Message sent to bug-gnu-emacs@HIDDEN:


X-Loop: help-debbugs@HIDDEN
Subject: bug#66224: [PATCH] Add optional PREDICATE argument to read-directory-name
Resent-From: Joseph Turner <joseph@HIDDEN>
Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
Resent-CC: bug-gnu-emacs@HIDDEN
Resent-Date: Sat, 13 Jan 2024 19:29:01 +0000
Resent-Message-ID: <handler.66224.B66224.170517411214597 <at> debbugs.gnu.org>
Resent-Sender: help-debbugs@HIDDEN
X-GNU-PR-Message: followup 66224
X-GNU-PR-Package: emacs
X-GNU-PR-Keywords: patch
To: Stefan Kangas <stefankangas@HIDDEN>
Cc: michael_heerdegen@HIDDEN, philipk@HIDDEN, 66224 <at> debbugs.gnu.org
Received: via spool by 66224-submit <at> debbugs.gnu.org id=B66224.170517411214597
          (code B ref 66224); Sat, 13 Jan 2024 19:29:01 +0000
Received: (at 66224) by debbugs.gnu.org; 13 Jan 2024 19:28:32 +0000
Received: from localhost ([127.0.0.1]:41165 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1rOjgG-0003nM-4v
	for submit <at> debbugs.gnu.org; Sat, 13 Jan 2024 14:28:32 -0500
Received: from out-177.mta1.migadu.com ([95.215.58.177]:64672)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <joseph@HIDDEN>) id 1rOjgC-0003nB-Vg
 for 66224 <at> debbugs.gnu.org; Sat, 13 Jan 2024 14:28:30 -0500
References: <877coch0q7.fsf@HIDDEN>
 <874jje1xds.fsf@HIDDEN> <87bkdly7t4.fsf@HIDDEN>
 <871qehr5vs.fsf@HIDDEN> <877co9y5jt.fsf@HIDDEN>
 <877co4tmav.fsf@HIDDEN> <87bkdf47g5.fsf@HIDDEN>
 <87pm1t3lqx.fsf@HIDDEN> <87v8blzw89.fsf@HIDDEN>
 <87il66og65.fsf@HIDDEN>
 <CADwFkmk-efLbBxjGWcfthiN-0pLWAtmqEyCAw_0pw_79LhOHvg@HIDDEN>
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=breatheoutbreathe.in; 
 s=key1; t=1705174108;
 h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
 to:to:cc:cc:mime-version:mime-version:content-type:content-type:
 in-reply-to:in-reply-to:references:references;
 bh=mXRe+v/epM0QEzhHcyyDE8hiqD1+H2STDTUjxxKUqYc=;
 b=Gj+kSWbM8XrK8TpxnU+ZDtA+e7uoGo5QlrqYtpm6sZf/O2WS3oG4PZMei0M5S3yIzi78KT
 Z3IouC8Cf/yZJyyABpxEdDAf7lO9twhYDmc+3virTmi6oacoRmFh5t1oiRr0PrX81U6nwC
 kruGFG2EJb0IKEOO0+tK+fFcyWiZvQQ=
X-Report-Abuse: Please report any abuse attempt to abuse@HIDDEN and
 include these headers.
From: Joseph Turner <joseph@HIDDEN>
Date: Sat, 13 Jan 2024 11:26:25 -0800
In-reply-to: <CADwFkmk-efLbBxjGWcfthiN-0pLWAtmqEyCAw_0pw_79LhOHvg@HIDDEN>
Message-ID: <87r0ilav8m.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="=-=-="
X-Migadu-Flow: FLOW_OUT
X-Spam-Score: -0.0 (/)
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

--=-=-=
Content-Type: text/plain

Stefan Kangas <stefankangas@HIDDEN> writes:

> Joseph Turner <joseph@HIDDEN> writes:
>
>> Joseph Turner <joseph@HIDDEN> writes:
>>
>>> Michael Heerdegen <michael_heerdegen@HIDDEN> writes:
>>>
>>>> Joseph Turner via "Bug reports for GNU Emacs, the Swiss army knife of
>>>> text editors" <bug-gnu-emacs@HIDDEN> writes:
>>>>
>>>>> I'm not sure what you mean. In both of the following examples, PREDICATE
>>>>> is used to narrow the completion candidates to only empty directories:
>>>>>
>>>>> (read-directory-name "Prompt: " "~/" nil t nil #'directory-empty-p)
>>>>> (read-directory-name "Prompt: " "~/" nil nil nil #'directory-empty-p)
>>>>
>>>> In the second version also non-empty directories will be accepted.
>>>
>>> Yes, PREDICATE narrows the completion candidates but doesn't determine a
>>> valid return value.
>>
>> Ping!  I'm happy to keep discussing this patch if others are interested.
>
> Could you please send the latest version of your patch?

Here you go!


--=-=-=
Content-Type: text/x-diff
Content-Disposition: inline;
 filename=0001-Add-optional-PREDICATE-argument-to-read-directory-na.patch

From 894e44bce60cf30c9e8bc8c5323eaed91d135bbb Mon Sep 17 00:00:00 2001
From: Joseph Turner <joseph@HIDDEN>
Date: Thu, 28 Sep 2023 20:27:47 -0700
Subject: [PATCH] Add optional PREDICATE argument to read-directory-name

* lisp/files.el (read-directory-name): Add optional PREDICATE arg.
* doc/lispref/minibuf.texi (Reading File Names): Document change.
* etc/NEWS: Note change.
---
 doc/lispref/minibuf.texi |  7 +++++--
 etc/NEWS                 |  5 +++++
 lisp/files.el            | 13 ++++++++++---
 3 files changed, 20 insertions(+), 5 deletions(-)

diff --git a/doc/lispref/minibuf.texi b/doc/lispref/minibuf.texi
index 620c58ec6e9..bf4d6e13d3a 100644
--- a/doc/lispref/minibuf.texi
+++ b/doc/lispref/minibuf.texi
@@ -1709,7 +1709,7 @@ If this variable is non-@code{nil}, @code{read-file-name} ignores case
 when performing completion.
 @end defopt
 
-@defun read-directory-name prompt &optional directory default require-match initial
+@defun read-directory-name prompt &optional directory default require-match initial predicate
 This function is like @code{read-file-name} but allows only directory
 names as completion alternatives.
 
@@ -1719,7 +1719,10 @@ combining @var{directory} (or the current buffer's default directory
 if @var{directory} is @code{nil}) and @var{initial}.  If both
 @var{default} and @var{initial} are @code{nil}, this function uses
 @var{directory} as substitute default, or the current buffer's default
-directory if @var{directory} is @code{nil}.
+directory if @var{directory} is @code{nil}.  When optional sixth
+argument @code{predicate} is non-nil, the union of @code{predicate}
+and @code{file-directory-p} is passed as the @code{predicate} argument
+to @code{read-file-name}.
 @end defun
 
 @defopt insert-default-directory
diff --git a/etc/NEWS b/etc/NEWS
index 1b3532b5657..fb9f6a0b43f 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -3541,6 +3541,11 @@ This function is called to see whether what the user has typed is a
 match.  This is also available from functions that call
 'completing-read', like 'read-file-name'.
 
+** 'read-directory-name' now accepts an optional PREDICATE argument.
+When optional sixth argument PREDICATE is non-nil, the union of
+PREDICATE and 'file-directory-p' is passed as the PREDICATE argument
+to 'read-file-name'.
+
 ** 'posn-col-row' can now give position data based on windows.
 Previously, it reported data only based on the frame.
 
diff --git a/lisp/files.el b/lisp/files.el
index b72f141c0ee..68855cd1c6d 100644
--- a/lisp/files.el
+++ b/lisp/files.el
@@ -807,7 +807,7 @@ See Info node `(elisp)Standard File Names' for more details."
     (dos-convert-standard-filename filename))
    (t filename)))
 
-(defun read-directory-name (prompt &optional dir default-dirname mustmatch initial)
+(defun read-directory-name (prompt &optional dir default-dirname mustmatch initial predicate)
   "Read directory name, prompting with PROMPT and completing in directory DIR.
 Value is not expanded---you must call `expand-file-name' yourself.
 Default name to DEFAULT-DIRNAME if user exits with the same
@@ -821,14 +821,21 @@ Fourth arg MUSTMATCH non-nil means require existing directory's name.
  Non-nil and non-t means also require confirmation after completion.
 Fifth arg INITIAL specifies text to start with.
 DIR should be an absolute directory name.  It defaults to
-the value of `default-directory'."
+the value of `default-directory'.
+When sixth arg PREDICATE is non-nil, the union of PREDICATE and
+`file-directory-p' is passed as the PREDICATE argument to
+`read-file-name'. Otherwise, only `file-directory-p' is passed."
   (unless dir
     (setq dir default-directory))
   (read-file-name prompt dir (or default-dirname
 				 (if initial (expand-file-name initial dir)
 				   dir))
 		  mustmatch initial
-		  'file-directory-p))
+                  (if predicate
+                      (lambda (filename)
+                        (and (file-directory-p filename)
+                             (funcall predicate filename)))
+                    #'file-directory-p)))
 
 
 (defun pwd (&optional insert)
-- 
2.41.0


--=-=-=--





Last modified: Sat, 20 Jan 2024 12:30:02 UTC

GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997 nCipher Corporation Ltd, 1994-97 Ian Jackson.