[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#66224: [PATCH] Add optional PREDICATE argument to read-directory-nam
From: |
Michael Heerdegen |
Subject: |
bug#66224: [PATCH] Add optional PREDICATE argument to read-directory-name |
Date: |
Fri, 29 Sep 2023 05:54:31 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) |
Joseph Turner via "Bug reports for GNU Emacs, the Swiss army knife of
text editors" <bug-gnu-emacs@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
Michael.