Received: (at 66224) by debbugs.gnu.org; 3 Oct 2023 03:32:04 +0000 From debbugs-submit-bounces <at> debbugs.gnu.org Mon Oct 02 23:32:03 2023 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> To: Joseph Turner via "Bug reports for GNU Emacs, the Swiss army knife of text editors" <bug-gnu-emacs@HIDDEN> Subject: Re: bug#66224: [PATCH] Add optional PREDICATE argument to read-directory-name 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-Debbugs-Envelope-To: 66224 Cc: philipk@HIDDEN, 66224 <at> debbugs.gnu.org, Joseph Turner <joseph@HIDDEN> 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.
bug-gnu-emacs@HIDDEN
:bug#66224
; Package emacs
.
Full text available.Received: (at submit) by debbugs.gnu.org; 3 Oct 2023 03:32:09 +0000 From debbugs-submit-bounces <at> debbugs.gnu.org Mon Oct 02 23:32:09 2023 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> To: Joseph Turner via "Bug reports for GNU Emacs, the Swiss army knife of text editors" <bug-gnu-emacs@HIDDEN> Subject: Re: bug#66224: [PATCH] Add optional PREDICATE argument to read-directory-name 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-Debbugs-Envelope-To: submit Cc: philipk@HIDDEN, 66224 <at> debbugs.gnu.org, Joseph Turner <joseph@HIDDEN> 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.
bug-gnu-emacs@HIDDEN
:bug#66224
; Package emacs
.
Full text available.Received: (at 66224) by debbugs.gnu.org; 29 Sep 2023 12:06:34 +0000 From debbugs-submit-bounces <at> debbugs.gnu.org Fri Sep 29 08:06:34 2023 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> To: Joseph Turner <joseph@HIDDEN> In-Reply-To: <877coch0q7.fsf@HIDDEN> (bug-gnu-emacs@HIDDEN) Subject: Re: bug#66224: [PATCH] Add optional PREDICATE argument to read-directory-name 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-Debbugs-Envelope-To: 66224 Cc: 66224 <at> debbugs.gnu.org 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.
bug-gnu-emacs@HIDDEN
:bug#66224
; Package emacs
.
Full text available.Received: (at 66224) by debbugs.gnu.org; 29 Sep 2023 04:20:16 +0000 From debbugs-submit-bounces <at> debbugs.gnu.org Fri Sep 29 00:20:16 2023 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> To: Michael Heerdegen <michael_heerdegen@HIDDEN> Subject: Re: bug#66224: [PATCH] Add optional PREDICATE argument to read-directory-name 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-Debbugs-Envelope-To: 66224 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> 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 --=-=-=--
bug-gnu-emacs@HIDDEN
:bug#66224
; Package emacs
.
Full text available.Received: (at submit) by debbugs.gnu.org; 29 Sep 2023 04:20:28 +0000 From debbugs-submit-bounces <at> debbugs.gnu.org Fri Sep 29 00:20:28 2023 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> To: Michael Heerdegen <michael_heerdegen@HIDDEN> Subject: Re: bug#66224: [PATCH] Add optional PREDICATE argument to read-directory-name 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-Debbugs-Envelope-To: submit 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> 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 --=-=-=--
bug-gnu-emacs@HIDDEN
:bug#66224
; Package emacs
.
Full text available.Received: (at submit) by debbugs.gnu.org; 29 Sep 2023 03:55:15 +0000 From debbugs-submit-bounces <at> debbugs.gnu.org Thu Sep 28 23:55:15 2023 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> To: Joseph Turner via "Bug reports for GNU Emacs, the Swiss army knife of text editors" <bug-gnu-emacs@HIDDEN> Subject: Re: bug#66224: [PATCH] Add optional PREDICATE argument to read-directory-name 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-Debbugs-Envelope-To: submit Cc: Philip Kaludercic <philipk@HIDDEN>, 66224 <at> debbugs.gnu.org, Joseph Turner <joseph@HIDDEN> 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.
bug-gnu-emacs@HIDDEN
:bug#66224
; Package emacs
.
Full text available.Received: (at 66224) by debbugs.gnu.org; 29 Sep 2023 03:55:01 +0000 From debbugs-submit-bounces <at> debbugs.gnu.org Thu Sep 28 23:55:01 2023 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> To: Joseph Turner via "Bug reports for GNU Emacs, the Swiss army knife of text editors" <bug-gnu-emacs@HIDDEN> Subject: Re: bug#66224: [PATCH] Add optional PREDICATE argument to read-directory-name 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-Debbugs-Envelope-To: 66224 Cc: Philip Kaludercic <philipk@HIDDEN>, 66224 <at> debbugs.gnu.org, Joseph Turner <joseph@HIDDEN> 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.
bug-gnu-emacs@HIDDEN
:bug#66224
; Package emacs
.
Full text available.Received: (at 66224) by debbugs.gnu.org; 29 Sep 2023 03:31:24 +0000 From debbugs-submit-bounces <at> debbugs.gnu.org Thu Sep 28 23:31:23 2023 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> To: Philip Kaludercic <philipk@HIDDEN> Subject: Re: bug#66224: [PATCH] Add optional PREDICATE argument to read-directory-name 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-Debbugs-Envelope-To: 66224 Cc: 66224 <at> debbugs.gnu.org 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 --=-=-=--
bug-gnu-emacs@HIDDEN
:bug#66224
; Package emacs
.
Full text available.Received: (at 66224) by debbugs.gnu.org; 29 Sep 2023 03:31:17 +0000 From debbugs-submit-bounces <at> debbugs.gnu.org Thu Sep 28 23:31:17 2023 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> To: Philip Kaludercic <philipk@HIDDEN> Subject: Re: bug#66224: [PATCH] Add optional PREDICATE argument to read-directory-name 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-Debbugs-Envelope-To: 66224 Cc: 66224 <at> debbugs.gnu.org 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 --=-=-=--
bug-gnu-emacs@HIDDEN
:bug#66224
; Package emacs
.
Full text available.Received: (at 66224) by debbugs.gnu.org; 28 Sep 2023 09:05:30 +0000 From debbugs-submit-bounces <at> debbugs.gnu.org Thu Sep 28 05:05:30 2023 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> To: Joseph Turner <joseph@HIDDEN> Subject: Re: bug#66224: [PATCH] Add optional PREDICATE argument to read-directory-name 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-Debbugs-Envelope-To: 66224 Cc: 66224 <at> debbugs.gnu.org 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)
bug-gnu-emacs@HIDDEN
:bug#66224
; Package emacs
.
Full text available.Received: (at submit) by debbugs.gnu.org; 27 Sep 2023 01:19:45 +0000 From debbugs-submit-bounces <at> debbugs.gnu.org Tue Sep 26 21:19:45 2023 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> To: Emacs Bugs Mailing List <bug-gnu-emacs@HIDDEN> Subject: [PATCH] Add optional PREDICATE argument to read-directory-name 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-Debbugs-Envelope-To: submit 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 --=-=-=--
Joseph Turner <joseph@HIDDEN>
:bug-gnu-emacs@HIDDEN
.
Full text available.bug-gnu-emacs@HIDDEN
:bug#66224
; Package emacs
.
Full text available.
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997 nCipher Corporation Ltd,
1994-97 Ian Jackson.