2018-05-27 12:05:15 +02:00
|
|
|
;;; emacs/term/autoload.el -*- lexical-binding: t; -*-
|
2017-04-11 19:03:34 -04:00
|
|
|
|
|
|
|
;;;###autoload
|
2018-06-10 17:25:40 +02:00
|
|
|
(defun +term/open (arg)
|
|
|
|
"Open a terminal buffer in the current window. If ARG (universal argument) is
|
2017-05-15 14:08:04 +02:00
|
|
|
non-nil, cd into the current project's root."
|
|
|
|
(interactive "P")
|
2018-06-04 21:08:19 +02:00
|
|
|
(let ((default-directory
|
2018-06-10 17:25:40 +02:00
|
|
|
(if arg
|
2018-06-04 21:08:19 +02:00
|
|
|
(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)))))
|
2017-04-11 19:03:34 -04:00
|
|
|
|
|
|
|
;;;###autoload
|
2018-04-10 06:12:03 -04:00
|
|
|
(defun +term/open-popup (arg)
|
|
|
|
"Open a terminal popup window. If ARG (universal argument) is
|
|
|
|
non-nil, cd into the current project's root."
|
2017-05-15 14:08:04 +02:00
|
|
|
(interactive "P")
|
2018-06-04 21:08:19 +02:00
|
|
|
(let ((default-directory
|
|
|
|
(if arg
|
|
|
|
(doom-project-root 'nocache)
|
|
|
|
default-directory)))
|
|
|
|
(pop-to-buffer (save-window-excursion (multi-term)))))
|
2017-05-15 14:08:04 +02:00
|
|
|
|
|
|
|
;;;###autoload
|
2018-06-10 17:25:40 +02:00
|
|
|
(defun +term/open-popup-in-project ()
|
|
|
|
"Open a terminal popup window in the root of the current project."
|
|
|
|
(interactive)
|
|
|
|
(+term/open-popup t))
|