(and (memq (cdr buffer) buffers)
(not
(project--buffer-check
- (cdr buffer) project-ignore-buffer-conditions))))))
- (read-buffer
- "Switch to buffer: "
- (when (funcall predicate (cons other-name other-buffer))
- other-name)
- nil
- predicate)))
+ (cdr buffer) project-ignore-buffer-conditions)))))
+ (buffer (read-buffer
+ "Switch to buffer: "
+ (when (funcall predicate (cons other-name other-buffer))
+ other-name)
+ nil
+ predicate)))
+ ;; XXX: This check hardcodes the default buffer-belonging relation
+ ;; which `project-buffers' is allowed to override. Straighten
+ ;; this up sometime later. Or not. Since we can add a method
+ ;; `project-contains-buffer-p', but a separate method to create a
+ ;; new project buffer seems too much.
+ (if (or (get-buffer buffer)
+ (file-in-directory-p default-directory (project-root pr)))
+ buffer
+ (let ((default-directory (project-root pr)))
+ (get-buffer-create buffer)))))
;;;###autoload
(defun project-switch-to-buffer (buffer-or-name)