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).
This commit is contained in:
Lin Sun 2020-09-21 17:33:13 +02:00 committed by Lars Ingebrigtsen
parent 018278a8d0
commit fa560bea19

View file

@ -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))