diff options
| author | Theodor Thornhill | 2020-06-18 02:09:41 +0300 |
|---|---|---|
| committer | Dmitry Gutov | 2020-06-18 02:09:41 +0300 |
| commit | eb3b03c1c686e20c55eeaa21652b318251e16458 (patch) | |
| tree | e66cd8ee0ad9ba035fa8f3c41dbde49b7fb5331d | |
| parent | 2f231fcfb763626b8a4ede7da0f80da14a122ca9 (diff) | |
| download | emacs-eb3b03c1c686e20c55eeaa21652b318251e16458.tar.gz emacs-eb3b03c1c686e20c55eeaa21652b318251e16458.zip | |
New command: project-switch-to-buffer
* lisp/progmodes/project.el (project-switch-to-buffer): New command.
| -rw-r--r-- | lisp/progmodes/project.el | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/lisp/progmodes/project.el b/lisp/progmodes/project.el index 14aafdf2899..d8f56acedf3 100644 --- a/lisp/progmodes/project.el +++ b/lisp/progmodes/project.el | |||
| @@ -768,6 +768,19 @@ Arguments the same as in `compile'." | |||
| 768 | (default-directory (project-root pr))) | 768 | (default-directory (project-root pr))) |
| 769 | (compile command comint))) | 769 | (compile command comint))) |
| 770 | 770 | ||
| 771 | ;;;###autoload | ||
| 772 | (defun project-switch-to-buffer () | ||
| 773 | "Switch to a buffer in the current project." | ||
| 774 | (interactive) | ||
| 775 | (let ((root (project-root (project-current t)))) | ||
| 776 | (switch-to-buffer | ||
| 777 | (read-buffer | ||
| 778 | "Switch to buffer: " nil t | ||
| 779 | (lambda (buffer) | ||
| 780 | ;; BUFFER is an entry (BUF-NAME . BUF-OBJ) of Vbuffer_alist. | ||
| 781 | (when-let ((file (buffer-file-name (cdr buffer)))) | ||
| 782 | (file-in-directory-p file root))))))) | ||
| 783 | |||
| 771 | 784 | ||
| 772 | ;;; Project list | 785 | ;;; Project list |
| 773 | 786 | ||