project-switch-to-buffer: Improve Ido compatibility

* lisp/progmodes/project.el (project-switch-to-buffer):
Check that the entry contains a non-nil CDR.
This commit is contained in:
Dmitry Gutov 2020-06-22 16:58:02 +03:00
parent 2be719827f
commit bea5eb77b3

View file

@ -810,7 +810,8 @@ is inside the directory hierarchy of the project's root."
(predicate
(lambda (buffer)
;; BUFFER is an entry (BUF-NAME . BUF-OBJ) of Vbuffer_alist.
(and (not (eq (cdr buffer) current-buffer))
(and (cdr buffer)
(not (eq (cdr buffer) current-buffer))
(when-let ((file (buffer-local-value 'default-directory
(cdr buffer))))
(file-in-directory-p file root))))))