Add project terminal launchers for Emacs

This commit is contained in:
Fabio Scotto di Santolo
2026-04-10 11:03:18 +02:00
parent 403d10b766
commit 88e4fb8cb8
4 changed files with 72 additions and 4 deletions

View File

@@ -23,6 +23,42 @@
(let ((default-directory (fscotto/project-root)))
(vterm)))
(defun fscotto/project-multi-vterm ()
"Open a new multi-vterm buffer in project root."
(interactive)
(let ((default-directory (fscotto/project-root)))
(multi-vterm)))
(defun fscotto/launch-external-terminal (&optional command)
"Launch external terminal in project root, optionally running COMMAND."
(let* ((default-directory (file-name-as-directory (fscotto/project-root)))
(terminal-program (or (executable-find fscotto/external-terminal-program)
fscotto/external-terminal-program))
(args (append
(list fscotto/external-terminal-working-directory-option
default-directory)
(when command
(append
(list fscotto/external-terminal-execute-option)
command)))))
(unless (file-executable-p terminal-program)
(user-error "External terminal not found: %s" fscotto/external-terminal-program))
(apply #'start-process
"fscotto-external-terminal"
nil
terminal-program
args)))
(defun fscotto/project-external-terminal ()
"Open the external terminal in project root."
(interactive)
(fscotto/launch-external-terminal))
(defun fscotto/project-opencode ()
"Open the external terminal in project root and run opencode."
(interactive)
(fscotto/launch-external-terminal '("opencode")))
(defun fscotto/project-magit-status ()
"Open magit-status in project root."
(interactive)