GNU bug report logs - #66224
[PATCH] Add optional PREDICATE argument to read-directory-name

Previous Next

Package: emacs;

Reported by: Joseph Turner <joseph <at> breatheoutbreathe.in>

Date: Wed, 27 Sep 2023 01:20:02 UTC

Severity: wishlist

Tags: patch

Fixed in version 31.1

Done: Stefan Kangas <stefankangas <at> gmail.com>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Joseph Turner <joseph <at> breatheoutbreathe.in>
To: Michael Heerdegen <michael_heerdegen <at> web.de>
Cc: 66224 <at> debbugs.gnu.org, philipk <at> posteo.net
Subject: bug#66224: [PATCH] Add optional PREDICATE argument to read-directory-name
Date: Thu, 28 Sep 2023 21:19:24 -0700
[Message part 1 (text/plain, inline)]
Michael Heerdegen <michael_heerdegen <at> web.de> writes:

> Joseph Turner via "Bug reports for GNU Emacs, the Swiss army knife of
> text editors" <bug-gnu-emacs <at> gnu.org> 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
[0001-Add-optional-PREDICATE-argument-to-read-directory-na.patch (text/x-diff, attachment)]

This bug report was last modified 158 days ago.

Previous Next


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