From: Theodor Thornhill <theo@thornhill.no>
To: Andrii Kolomoiets <andreyk.mad@gmail.com>
Cc: 41879@debbugs.gnu.org
Subject: bug#41879: 28.0.50; [Patch]: Add project-switch-to-buffer in project.el
Date: Thu, 18 Jun 2020 10:26:05 +0000 [thread overview]
Message-ID: <87zh90n008.fsf@thornhill.no> (raw)
In-Reply-To: <m2v9jon22d.fsf@gmail.com>
[-- Attachment #1: Type: text/plain, Size: 234 bytes --]
On the other hand, what do you think about this one?
Now you will get buffers such as '*xref*' and I assume your inferior buffers as well. Could you try this? I added your 'other-buffer' thing also for good measure :)
Theo
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: project-switch-to-buffer.patch --]
[-- Type: text/x-patch; name=project-switch-to-buffer.patch, Size: 1787 bytes --]
diff --git a/lisp/progmodes/project.el b/lisp/progmodes/project.el
index e24d81c1b4..e935cae280 100644
--- a/lisp/progmodes/project.el
+++ b/lisp/progmodes/project.el
@@ -714,11 +714,20 @@ project-vc-dir
;;;###autoload
(defun project-shell ()
- "Open Shell in the current project."
+ "Open Shell in the current project.
+With \\[universal-argument] prefix, create subsequent shell buffers
+with uniquified names."
(interactive)
- (let ((default-directory (project-root (project-current t))))
- ;; Use ‘create-file-buffer’ to uniquify shell buffer names.
- (shell (create-file-buffer "*shell*"))))
+ (let* ((default-directory (project-root (project-current t)))
+ (default-project-shell-name
+ (concat "*" (file-name-nondirectory
+ (directory-file-name
+ (file-name-directory default-directory)))
+ "-shell*"))
+ (shell-buffer (get-buffer default-project-shell-name)))
+ (if (and shell-buffer (not current-prefix-arg))
+ (pop-to-buffer shell-buffer)
+ (shell (generate-new-buffer-name default-project-shell-name)))))
;;;###autoload
(defun project-eshell ()
@@ -779,10 +788,12 @@ project-switch-to-buffer
(let ((root (project-root (project-current t))))
(switch-to-buffer
(read-buffer
- "Switch to buffer: " nil t
+ "Switch to buffer: "
+ (buffer-name (other-buffer (current-buffer)))
+ t
(lambda (buffer)
;; BUFFER is an entry (BUF-NAME . BUF-OBJ) of Vbuffer_alist.
- (when-let ((file (buffer-file-name (cdr buffer))))
+ (when-let ((file (buffer-local-value 'default-directory (cdr buffer))))
(file-in-directory-p file root)))))))
(defcustom project-kill-buffers-skip-conditions
next prev parent reply other threads:[~2020-06-18 10:26 UTC|newest]
Thread overview: 47+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-06-15 17:45 bug#41879: 28.0.50; [Patch]: Add project-switch-to-buffer in project.el Theodor Thornhill
2020-06-15 18:29 ` Philip K.
2020-06-15 20:55 ` Dmitry Gutov
2020-06-15 22:05 ` Theodor Thornhill
2020-06-15 23:38 ` Dmitry Gutov
2020-06-16 5:45 ` Theodor Thornhill
2020-06-16 6:11 ` Philip K.
2020-06-16 6:49 ` Theodor Thornhill
2020-06-16 10:26 ` Basil L. Contovounesios
2020-06-16 13:29 ` Theodor Thornhill
2020-06-16 14:02 ` Basil L. Contovounesios
2020-06-16 16:53 ` Theodor Thornhill
2020-06-16 18:19 ` Basil L. Contovounesios
2020-06-16 18:58 ` Theodor Thornhill
2020-06-16 20:37 ` Basil L. Contovounesios
2020-06-16 22:39 ` Dmitry Gutov
2020-06-17 23:10 ` Dmitry Gutov
2020-06-16 21:40 ` Dmitry Gutov
2020-06-16 21:58 ` Basil L. Contovounesios
2020-06-16 22:11 ` Dmitry Gutov
2020-06-15 23:10 ` Juri Linkov
2020-06-16 0:21 ` Dmitry Gutov
2020-06-18 9:41 ` Andrii Kolomoiets
2020-06-18 10:11 ` Theodor Thornhill
2020-06-18 10:26 ` Theodor Thornhill [this message]
2020-06-18 10:31 ` Theodor Thornhill
2020-06-18 10:48 ` Andrii Kolomoiets
2020-06-18 11:07 ` Dmitry Gutov
2020-06-18 11:30 ` Andrii Kolomoiets
2020-06-18 11:35 ` Dmitry Gutov
2020-06-18 11:47 ` Andrii Kolomoiets
2020-06-18 13:00 ` Dmitry Gutov
2020-06-18 18:03 ` Andrii Kolomoiets
2020-06-18 18:49 ` Theodor Thornhill
2020-06-18 19:35 ` Basil L. Contovounesios
2020-06-19 0:43 ` Dmitry Gutov
2020-06-19 4:50 ` Andrii Kolomoiets
2020-06-19 0:45 ` Dmitry Gutov
2020-06-19 4:59 ` Andrii Kolomoiets
2020-06-19 5:27 ` Theodor Thornhill
2020-06-19 11:00 ` Dmitry Gutov
2020-06-20 8:35 ` Andrii Kolomoiets
2020-06-21 1:04 ` Dmitry Gutov
2020-06-22 9:30 ` Andrii Kolomoiets
2020-06-22 13:46 ` Dmitry Gutov
2020-06-22 13:54 ` Andrii Kolomoiets
2020-06-22 14:59 ` Dmitry Gutov
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87zh90n008.fsf@thornhill.no \
--to=theo@thornhill.no \
--cc=41879@debbugs.gnu.org \
--cc=andreyk.mad@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.