From: Lin Sun Date: Mon, 21 Sep 2020 15:33:13 +0000 (+0200) Subject: Fix problem with ede-mode bugging out on non-existent files X-Git-Tag: emacs-28.0.90~5952 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=fa560bea191033e8af6bf3dc49cb6f6d94611535;p=emacs.git Fix problem with ede-mode bugging out on non-existent files * lisp/cedet/ede/emacs.el: Check whether the directory exists in ede-emacs-find-in-directories before using it (bug#43547). --- diff --git a/lisp/cedet/ede/emacs.el b/lisp/cedet/ede/emacs.el index bfcbd40fcce..a052c5c61e7 100644 --- a/lisp/cedet/ede/emacs.el +++ b/lisp/cedet/ede/emacs.el @@ -234,20 +234,19 @@ All files need the macros from lisp.h!" (let* ((D (car dirs)) (ed (expand-file-name D base)) (ef (expand-file-name name ed))) - (if (file-exists-p ef) - (setq ans ef) - ;; Not in this dir? How about subdirs? - (let ((dirfile (directory-files ed t)) - (moredirs nil) - ) - ;; Get all the subdirs. - (dolist (DF dirfile) - (when (and (file-directory-p DF) - (not (string-match "\\.$" DF))) - (push DF moredirs))) - ;; Try again. - (setq ans (ede-emacs-find-in-directories name ed moredirs)) - )) + (when (file-exists-p ed) + (if (file-exists-p ef) + (setq ans ef) + ;; Not in this dir? How about subdirs? + (let ((dirfile (directory-files ed t)) + (moredirs nil)) + ;; Get all the subdirs. + (dolist (DF dirfile) + (when (and (file-directory-p DF) + (not (string-match "\\.$" DF))) + (push DF moredirs))) + ;; Try again. + (setq ans (ede-emacs-find-in-directories name ed moredirs))))) (setq dirs (cdr dirs)))) ans))