Commit 23af6499e6ad
Changed files (2)
tools
emacs
config
lisp
tools/emacs/config/config-projects.el
@@ -32,6 +32,25 @@ It will search for README.org, README.md or README in that order"
(?s "Vterm" vde-project-vterm)
(?R "README" vde/open-readme)))
+ (defun vde-project-run-in-vterm (command &optional directory)
+ "Run the given `COMMAND' in a new vterm buffer in `project-root' or the
+given `DIRECTORY'.
+
+This is similar to `compile' but with vterm.
+One reason for this is to be able to run commands that needs a TTY."
+ (interactive "sCommand: ")
+ (let* ((cwd (or directory (vde-project--project-root-or-default-directory)))
+ (default-directory cwd)
+ (buffer-name (format "*vterm %s: %s*" cwd command))
+ (buffer (get-buffer buffer-name))
+ (vterm-kill-buffer-on-exit nil)
+ (vterm-shell (concat "bash -c '" command ";exit'")))
+ (when buffer
+ (kill-buffer buffer))
+ (let ((buffer (generate-new-buffer buffer-name)))
+ (pop-to-buffer buffer)
+ (with-current-buffer buffer
+ (vterm-mode)))))
(defun vde/project-try-local (dir)
"Determine if DIR is a non-VC project."
(if-let ((root (if (listp vde/project-local-identifier)
tools/emacs/lisp/project-func.el
@@ -18,26 +18,5 @@
(project-root (project-current)))
(t default-directory)))
-;;;##autoload
-(defun vde-project-run-in-vterm (command &optional directory)
- "Run the given `COMMAND' in a new vterm buffer in `project-root' or the
-given `DIRECTORY'.
-
-This is similar to `compile' but with vterm.
-One reason for this is to be able to run commands that needs a TTY."
- (interactive "sCommand: ")
- (let* ((cwd (or directory (vde-project--project-root-or-default-directory)))
- (default-directory cwd)
- (buffer-name (format "*vterm %s: %s*" cwd command))
- (buffer (get-buffer buffer-name))
- (vterm-kill-buffer-on-exit nil)
- (vterm-shell (concat "bash -c '" command ";exit'")))
- (when buffer
- (kill-buffer buffer))
- (let ((buffer (generate-new-buffer buffer-name)))
- (pop-to-buffer buffer)
- (with-current-buffer buffer
- (vterm-mode)))))
-
(provide 'project-func)
;;; project-func.el ends here