From a03c5807a3b781f963c249ee2c7d55ef1633eac6 Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Tue, 30 Sep 2008 12:52:46 +0000 Subject: [PATCH] (locate-dominating-file): Wrap directory-files with condition-case, instead of calling file-directory-p, which stats the directory one more time. --- lisp/ChangeLog | 4 ++++ lisp/files.el | 5 +++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 0cc37745e43..844fff225ab 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,5 +1,9 @@ 2008-09-30 Eli Zaretskii + * files.el (locate-dominating-file): Wrap directory-files with + condition-case, instead of calling file-directory-p, which stats + the directory one more time. + * mail/mail-utils.el (mail-unquote-printable-region): Use insert-byte instead of insert-char, when the UNIBYTE arg is non-nil. diff --git a/lisp/files.el b/lisp/files.el index f00c265ed6e..090556663e6 100644 --- a/lisp/files.el +++ b/lisp/files.el @@ -734,8 +734,9 @@ PATH-AND-SUFFIXES is a pair of lists, (DIRECTORIES . SUFFIXES)." (let ((prev-user user)) (setq user (nth 2 (file-attributes dir))) (or (null prev-user) (equal user prev-user)))) - (if (setq files (and (file-directory-p dir) - (directory-files dir 'full regexp))) + (if (setq files (condition-case nil + (directory-files dir 'full regexp) + (error nil))) (throw 'found (car files)) (if (equal dir (setq dir (file-name-directory -- 2.39.5