emacs/term: minor refactor of universal args
This commit is contained in:
parent
2605a3938e
commit
fbdbd26851
1 changed files with 7 additions and 9 deletions
|
@ -1,12 +1,12 @@
|
||||||
;;; emacs/term/autoload.el -*- lexical-binding: t; -*-
|
;;; emacs/term/autoload.el -*- lexical-binding: t; -*-
|
||||||
|
|
||||||
;;;###autoload
|
;;;###autoload
|
||||||
(defun +term/open (&optional project-root)
|
(defun +term/open (arg)
|
||||||
"Open a terminal buffer in the current window. If PROJECT-ROOT (C-u) is
|
"Open a terminal buffer in the current 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")
|
||||||
(let ((default-directory
|
(let ((default-directory
|
||||||
(if project-root
|
(if arg
|
||||||
(doom-project-root 'nocache)
|
(doom-project-root 'nocache)
|
||||||
default-directory)))
|
default-directory)))
|
||||||
;; Doom's switch-buffer hooks prevent themselves from triggering when
|
;; Doom's switch-buffer hooks prevent themselves from triggering when
|
||||||
|
@ -27,9 +27,7 @@ non-nil, cd into the current project's root."
|
||||||
(pop-to-buffer (save-window-excursion (multi-term)))))
|
(pop-to-buffer (save-window-excursion (multi-term)))))
|
||||||
|
|
||||||
;;;###autoload
|
;;;###autoload
|
||||||
(defun +term/open-popup-in-project (arg)
|
(defun +term/open-popup-in-project ()
|
||||||
"Open a terminal popup window in the root of the current project.
|
"Open a terminal popup window in the root of the current project."
|
||||||
|
(interactive)
|
||||||
If ARG (universal argument) is non-nil, open it in `default-directory' instead."
|
(+term/open-popup t))
|
||||||
(interactive "P")
|
|
||||||
(+term/open-popup (not arg)))
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue