1
0
mirror of https://git.savannah.gnu.org/git/emacs.git synced 2024-11-28 07:45:00 +00:00

New command: project-switch-to-buffer

* lisp/progmodes/project.el (project-switch-to-buffer): New command.
This commit is contained in:
Theodor Thornhill 2020-06-18 02:09:41 +03:00 committed by Dmitry Gutov
parent 2f231fcfb7
commit eb3b03c1c6

View File

@ -768,6 +768,19 @@ Arguments the same as in `compile'."
(default-directory (project-root pr))) (default-directory (project-root pr)))
(compile command comint))) (compile command comint)))
;;;###autoload
(defun project-switch-to-buffer ()
"Switch to a buffer in the current project."
(interactive)
(let ((root (project-root (project-current t))))
(switch-to-buffer
(read-buffer
"Switch to buffer: " nil t
(lambda (buffer)
;; BUFFER is an entry (BUF-NAME . BUF-OBJ) of Vbuffer_alist.
(when-let ((file (buffer-file-name (cdr buffer))))
(file-in-directory-p file root)))))))
;;; Project list ;;; Project list