Integrate term toggle commands w/ persp-mode #1492

By namespacing the dedicated term buffers you get perspective-local
popup terminals.
This commit is contained in:
Henrik Lissner 2019-06-16 18:53:45 +02:00
parent 5e9c020c21
commit 43615c4d64
No known key found for this signature in database
GPG key ID: 5F6C0EA160557395
3 changed files with 46 additions and 31 deletions

View file

@ -8,7 +8,10 @@ If prefix ARG is non-nil, recreate vterm buffer in the current project's root."
(interactive "P")
(unless (fboundp 'module-load)
(user-error "Your build of Emacs lacks dynamic modules support and cannot load vterm"))
(let ((buffer-name "*doom:vterm-popup*")
(let ((buffer-name (format "*doom:vterm-popup:%s*"
(if (bound-and-true-p persp-mode)
(safe-persp-name (get-current-persp))
"main")))
confirm-kill-processes
current-prefix-arg)
(when arg
@ -29,6 +32,7 @@ If prefix ARG is non-nil, recreate vterm buffer in the current project's root."
(let* ((default-directory (or (doom-project-root) default-directory))
(buffer (get-buffer-create buffer-name)))
(with-current-buffer buffer
(doom|mark-buffer-as-real)
(vterm-mode))
(pop-to-buffer buffer)))))