doomemacs/modules/emacs/term/autoload.el
Henrik Lissner 53fe7a1f04 Refactor Project API to reflect changes upstream
projectile-project-root no longer returns `default-directory` if not in
a project (it returns nil). As such, doom-project-* functions (and their
uses) have been refactored.

+ doom-project-p & doom-project-root are aliases for
  projectile-project-p & projectile-project-root.
+ doom-project-{p,root,name,expand} now has a DIR argument (for
  consistency, since projectile-project-name and
  projectile-project-expand do not).
+ The nocache parameter is no longer necessary, as projectile's caching
  behavior is now more sane.
+ Removed some projectile advice/hacks that are no longer necessary.
+ Updated unit tests
2018-09-28 21:13:27 -04:00

34 lines
1.2 KiB
EmacsLisp

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