Fix multi-term buffers missing from buffer list
Caused because switch buffer hooks weren't triggering, due to multi-term's odd use of set-buffer before switch-to-buffer.
This commit is contained in:
parent
3027ed2f7f
commit
625a8a9056
1 changed files with 14 additions and 8 deletions
|
@ -5,20 +5,26 @@
|
||||||
"Open a terminal buffer in the current window. If PROJECT-ROOT (C-u) is
|
"Open a terminal buffer in the current window. If PROJECT-ROOT (C-u) is
|
||||||
non-nil, cd into the current project's root."
|
non-nil, cd into the current project's root."
|
||||||
(interactive "P")
|
(interactive "P")
|
||||||
(let ((default-directory (if project-root (doom-project-root 'nocache) default-directory)))
|
(let ((default-directory
|
||||||
(call-interactively #'multi-term)))
|
(if project-root
|
||||||
|
(doom-project-root 'nocache)
|
||||||
|
default-directory)))
|
||||||
|
;; Doom's switch-buffer hooks prevent themselves from triggering when
|
||||||
|
;; switching from buffer A back to A. Because `multi-term' uses `set-buffer'
|
||||||
|
;; before `switch-to-buffer', the hooks don't trigger, so we use this
|
||||||
|
;; roundabout way to trigger them properly.
|
||||||
|
(switch-to-buffer (save-window-excursion (multi-term)))))
|
||||||
|
|
||||||
;;;###autoload
|
;;;###autoload
|
||||||
(defun +term/open-popup (arg)
|
(defun +term/open-popup (arg)
|
||||||
"Open a terminal popup window. If ARG (universal argument) is
|
"Open a terminal popup window. If ARG (universal argument) is
|
||||||
non-nil, cd into the current project's root."
|
non-nil, cd into the current project's root."
|
||||||
(interactive "P")
|
(interactive "P")
|
||||||
(require 'multi-term)
|
(let ((default-directory
|
||||||
(let ((default-directory (if arg (doom-project-root 'nocache) default-directory))
|
(if arg
|
||||||
(buffer (multi-term-get-buffer current-prefix-arg)))
|
(doom-project-root 'nocache)
|
||||||
(pop-to-buffer buffer)
|
default-directory)))
|
||||||
(setq multi-term-buffer-list (nconc multi-term-buffer-list (list buffer)))
|
(pop-to-buffer (save-window-excursion (multi-term)))))
|
||||||
(multi-term-internal)))
|
|
||||||
|
|
||||||
;;;###autoload
|
;;;###autoload
|
||||||
(defun +term/open-popup-in-project (arg)
|
(defun +term/open-popup-in-project (arg)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue