doomemacs/modules/tools/vterm/autoload.el
Henrik Lissner fa98551d19
tools/vterm: minor refactor
Don't end warnings in punctuation, and throw error if modules support is
missing.
2019-03-13 20:41:48 -04:00

33 lines
1.2 KiB
EmacsLisp

;;; tools/vterm/autoload.el -*- lexical-binding: t; -*-
;;;###autoload
(defun +vterm/open (arg)
"Open a terminal buffer in the current window. If ARG (universal argument) is
non-nil, cd into 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 ((default-directory
(if arg
(or (doom-project-root) default-directory)
default-directory)))
(switch-to-buffer (save-window-excursion (vterm)))))
;;;###autoload
(defun +vterm/open-popup (arg)
"Open a terminal popup window. If ARG (universal argument) is
non-nil, cd into 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 ((default-directory
(if arg
(or (doom-project-root) default-directory)
default-directory)))
(pop-to-buffer (save-window-excursion (vterm)))))
;;;###autoload
(defun +vterm/open-popup-in-project ()
"Open a terminal popup window in the root of the current project."
(interactive)
(+vterm/open-popup t))