From 4247ac77173b6f92f28af04f5a72ff68de19f057 Mon Sep 17 00:00:00 2001 From: Mohamad Taan <59320318+M-Taan@users.noreply.github.com> Date: Tue, 19 Sep 2023 09:46:09 +0300 Subject: [PATCH] [Fix #1835] Allow visiting existing vterm buffer in other window (#1863) --- CHANGELOG.md | 3 ++- projectile.el | 12 +++++++----- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2f2684cf3..170a36fee 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -19,9 +19,10 @@ * [#1831](https://github.com/bbatsov/projectile/issues/1831): Enable the project.el integration only when `projectile-mode` is active. * [#1847](https://github.com/bbatsov/projectile/issues/1847): Use literal directory name casing when toggling between impl and test. -### Bug fixed +### Bugs fixed * Fix `fd` inserting color control sequences when used over tramp. +* [#1835](https://github.com/bbatsov/projectile/issues/1835): Reopening existing vterm buffer in other window ## 2.7.0 (2022-11-22) diff --git a/projectile.el b/projectile.el index d6c6c24f5..8b650ed5d 100644 --- a/projectile.el +++ b/projectile.el @@ -4549,14 +4549,16 @@ be displayed in a different window. Switch to the project specific term buffer if it already exists." (let* ((project (projectile-acquire-root)) (buffer (projectile-generate-process-name "vterm" new-process project))) - (unless (buffer-live-p (get-buffer buffer)) - (unless (require 'vterm nil 'noerror) - (error "Package 'vterm' is not available")) + (unless (require 'vterm nil 'noerror) + (error "Package 'vterm' is not available")) + (if (buffer-live-p (get-buffer buffer)) + (if other-window + (switch-to-buffer-other-window buffer) + (switch-to-buffer buffer)) (projectile-with-default-dir project (if other-window (vterm-other-window buffer) - (vterm buffer)))) - (switch-to-buffer buffer))) + (vterm buffer)))))) ;;;###autoload (defun projectile-run-vterm (&optional arg)