summary refs log tree commit diff
diff options
context:
space:
mode:
authorTerin Stock <terinjokes@gmail.com>2024-01-31 22:05:52 +0100
committerTerin Stock <terinjokes@gmail.com>2024-01-31 22:37:10 +0100
commit16db3bf96a8c738ba9f89e5771e79cb856bbc3a5 (patch)
tree4da93eafebeebd1e02de5d38c48979c0f2e0d870
parentede62d00dcda087f4610492d7e41f91cf115c7e6 (diff)
add module for eat
Swap out vterm for eat.
-rw-r--r--init.el3
-rw-r--r--modules/term/eat/autoload.el45
-rw-r--r--modules/term/eat/config.el7
-rw-r--r--modules/term/eat/packages.el12
4 files changed, 66 insertions, 1 deletions
diff --git a/init.el b/init.el
index ca4a178..6d81010 100644
--- a/init.el
+++ b/init.el
@@ -76,7 +76,8 @@
        eshell              ; the elisp shell that works everywhere
        ;;shell             ; simple shell REPL for Emacs
        ;;term              ; basic terminal emulator for Emacs
-       vterm               ; the best terminal emulation in Emacs
+       ;;vterm             ; the best terminal emulation in Emacs
+       eat                 ; Yo dawg, I herd you liked terminal emulators
 
        :checkers
        (syntax +childframe)            ; tasing you for every semicolon you forget
diff --git a/modules/term/eat/autoload.el b/modules/term/eat/autoload.el
new file mode 100644
index 0000000..d7107e6
--- /dev/null
+++ b/modules/term/eat/autoload.el
@@ -0,0 +1,45 @@
+;;; term/eat/autoload.el -*- lexical-binding: t; -*-
+
+;;;###autoload
+(defun +eat/toggle (arg &optional)
+  (interactive "P")
+  (let* ((default-directory (project-root (project-current t)))
+         (eat-kill-buffer-on-exit 't)
+         (eat-buffer-name (format "*doom:eat-popup:%s*"
+                                  (if (bound-and-true-p persp-mode)
+                                      (safe-persp-name (get-current-persp))
+                                    "main"))))
+    (eat-other-window nil arg)))
+
+;;;###autoload
+(defvar +eat-frame-parameters
+  `((name . "eat")
+    (width . 110)
+    (height . 35)
+    (transient . t)
+    ,@(when IS-LINUX
+        `((window-system . ,(if (boundp 'pgtk-initialized) 'pgtk 'x))
+          (display . ,(or (getenv "WAYLAND_DISPLAY")
+                          (getenv "DISPLAY")
+                          ":0"))))
+    ,(if IS-MAC '(menu-bar-lines . 1)))
+  "TODO")
+
+;;;###autoload
+(defun +eat/open-frame ()
+  (interactive)
+  (let* ((frame-title-format "")
+         (frame (make-frame +eat-frame-parameters)))
+    (select-frame-set-input-focus frame)
+    (with-selected-frame frame
+      (switch-to-buffer (doom-fallback-buffer))
+      (let* ((eat-kill-buffer-on-exit 't)
+             (default-directory "~")
+             (eat-mode-hook (cons (lambda () (add-hook 'eat-exit-hook (lambda (_process) (delete-frame)) 91 t)) eat-mode-hook)))
+        (eat nil t)))))
+
+;; These clobber vterm bindings, so will need to pick alternatives.
+(map! :leader
+      (:prefix-map ("o" . "open")
+       :desc "Toggle Eat popup" "t" #'+eat/toggle
+       :desc "Open Eat here" "T" #'eat-project))
diff --git a/modules/term/eat/config.el b/modules/term/eat/config.el
new file mode 100644
index 0000000..eac9649
--- /dev/null
+++ b/modules/term/eat/config.el
@@ -0,0 +1,7 @@
+;;; term/eat/config.el -*- lexical-binding: t; -*-
+
+(use-package! eat
+  :config
+
+  (when (modulep! :editor evil)
+    (evil-set-initial-state 'eat-mode 'emacs)))
diff --git a/modules/term/eat/packages.el b/modules/term/eat/packages.el
new file mode 100644
index 0000000..ab7127f
--- /dev/null
+++ b/modules/term/eat/packages.el
@@ -0,0 +1,12 @@
+;; -*- no-byte-compile: t; -*-
+;;; term/eat/packages.el
+
+(package! eat
+  :pin "c91451f2d17453c19d3fa76faa4945cbe54e14ce"
+  :recipe (:host codeberg
+           :repo "akib/emacs-eat"
+           :files ("*.el" ("term" "term/*.el") "*.texi"
+                   "*.ti" ("terminfo/e" "terminfo/e/*")
+                   ("terminfo/65" "terminfo/65/*")
+                   ("integration" "integration/*")
+                   (:exclude ".dir-locals.el" "-tests.el"))))