From d4a0312e126e4e67fe07d32802e1887f0f16b410 Mon Sep 17 00:00:00 2001 From: Trevor Murphy Date: Tue, 11 Feb 2025 15:08:19 -0800 Subject: [PATCH] Set the vterm buffer's major mode before displaying the buffer. This ensures that display-buffer actions that condition on a buffer's major mode (see the documentation of `display-buffer-alist` and `buffer-match-p`) properly catch the buffer when it is displayed for the first time. This aligns with the behavior of other terminal emulator modes (e.g. term and ansi-term) and comint-derived modes (e.g. ielm, SQLi, and inferior Python). --- vterm.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vterm.el b/vterm.el index 9bc0d16..3a2c44c 100644 --- a/vterm.el +++ b/vterm.el @@ -1503,10 +1503,10 @@ value of `vterm-buffer-name'." (t (get-buffer-create vterm-buffer-name))))) (cl-assert (and buf (buffer-live-p buf))) - (funcall pop-to-buf-fun buf) (with-current-buffer buf (unless (derived-mode-p 'vterm-mode) (vterm-mode))) + (funcall pop-to-buf-fun buf) buf)) ;;; Internal