Commit 1ecf65ff7ac5

Vincent Demeester <vincent@sbr.pm>
2025-12-10 13:38:46
feat(emacs): Add eat terminal emulator with TRAMP support
- Enable modern terminal emulation in eshell for better compatibility - Support remote shells via TRAMP with automatic zsh detection - Improve terminal workflow with yank-to-terminal capability Signed-off-by: Vincent Demeester <vincent@sbr.pm>
1 parent b772cf6
Changed files (2)
tools
tools/emacs/site-lisp/project-func.el
@@ -2,10 +2,27 @@
 ;;; Commentary:
 ;;; Code:
 (require 'project)
-(require 'vterm)
 (require 'json)
 (require 'vc)
 
+;; Declare vterm functions and variables for byte-compiler
+(declare-function vterm "vterm")
+(declare-function vterm-mode "vterm")
+(declare-function vterm-send-string "vterm")
+(declare-function vterm-send-return "vterm")
+(defvar vterm-kill-buffer-on-exit)
+(defvar vterm-shell)
+
+;; Declare eat functions for byte-compiler
+(declare-function eat "eat")
+
+;; Declare magit functions for byte-compiler
+(declare-function magit-status "magit")
+
+;; Project local identifier variable
+(defvar vde/project-local-identifier nil
+  "Identifier for local projects (file name or list of file names).")
+
 (defun in-git-repo-p ()
   "Check if current directory is in a git repository."
   (eq (vc-backend (or buffer-file-name default-directory))
@@ -148,10 +165,16 @@ if one already exists."
   (defvar eat-buffer-name)
   (let* ((default-directory (project-root (project-current t)))
 	 (eat-buffer-name (project-prefixed-buffer-name "eat"))
-	 (eat-buffer (get-buffer eat-buffer-name)))
+	 (eat-buffer (get-buffer eat-buffer-name))
+	 (shell (if (file-remote-p default-directory)
+		    ;; For TRAMP, find zsh on remote host or fall back to /bin/zsh
+		    (or (executable-find "zsh" t)
+			"/bin/zsh")
+		  ;; For local, use shell-file-name
+		  shell-file-name)))
     (if (and eat-buffer (not current-prefix-arg))
 	(pop-to-buffer eat-buffer (bound-and-true-p display-comint-buffer-action))
-      (eat shell-file-name))))
+      (eat shell))))
 
 ;;;###autoload
 (defun vde/project-magit-status ()
tools/emacs/init.el
@@ -66,6 +66,7 @@ It is shared with iOS and replace the deprecated `org-journal-file' below.")
 (setq confirm-kill-emacs #'y-or-n-p)
 
 (setq custom-file (locate-user-emacs-file "custom.el"))
+(require 'cus-edit)
 (setq
  custom-buffer-done-kill nil          ; Kill when existing
  custom-buffer-verbose-help nil       ; Remove redundant help text
@@ -130,6 +131,7 @@ It is shared with iOS and replace the deprecated `org-journal-file' below.")
   (set-fontset-font t 'symbol "Symbola" nil 'append)
 
   (require 'modus-themes)
+  (defvar modus-themes-preset-overrides-cooler)
   (setopt modus-themes-common-palette-overrides
 	  `((border-mode-line-active unspecified)
             (border-mode-line-inactive unspecified)
@@ -732,6 +734,16 @@ minibuffer, even without explicitly focusing it."
   ("C-x p G" . checkout-github-pr)
   ("C-x p F" . flymake-show-project-diagnostics))
 
+(use-package eat
+  :commands (eat)
+  :init
+  (setq-default explicit-shell-file-name "zsh"
+                shell-file-name "zsh")
+  (setq eat-kill-buffer-on-exit t
+        eat-enable-yank-to-terminal t)
+  :hook ((eshell-mode . eat-eshell-mode)
+         (eshell-mode . eat-eshell-visual-command-mode)))
+
 ;; TODO adapt this to my needs
 ;; (defun tkj/vc-git-grep-current-line ()
 ;;   "Search Git project for the current line."