From 62737769caebe82ed8cf286eb51a322fa52d7cc6 Mon Sep 17 00:00:00 2001 From: bd Date: Thu, 13 Feb 2025 23:34:52 -0500 Subject: Add vterm package and integrate with eshell-visual-commands --- .config/emacs/modules/bd--shells.el | 38 ++++++++++++++++++++++++++++++--- .config/guix/modules/services/base.scm | 2 +- .config/guix/modules/services/emacs.scm | 1 + 3 files changed, 37 insertions(+), 4 deletions(-) (limited to '.config') diff --git a/.config/emacs/modules/bd--shells.el b/.config/emacs/modules/bd--shells.el index 22860b3..9a8301f 100644 --- a/.config/emacs/modules/bd--shells.el +++ b/.config/emacs/modules/bd--shells.el @@ -3,10 +3,41 @@ ;;; Code: -(with-eval-after-load "term" (defalias 'term 'ansi-term)) - (add-to-list 'exec-path "/home/bdunahu/.local/bin") +(use-package vterm + :config + (with-eval-after-load "term" (defalias 'term 'vterm)) + ;; use vterm for visual visual commands + (defun bd/eshell-exec-visual (&rest args) + "Run the specified PROGRAM in a vterm emulation buffer. +ARGS are passed to the program. At the moment, no piping of input is +allowed." + (let* (eshell-interpreter-alist + (interp (eshell-find-interpreter (car args) (cdr args))) + (program (car interp)) + (args (mapconcat #'shell-quote-argument + (flatten-tree + (eshell-stringify-list (append (cdr interp) + (cdr args)))) " ")) + (term-buf + (generate-new-buffer + (concat "*" (file-name-nondirectory program) "*"))) + (eshell-buf (current-buffer)) + (vterm-shell (concat (shell-quote-argument + (file-local-name program)) + " " args))) + (save-current-buffer + (switch-to-buffer term-buf) + (vterm-mode) + (setq-local eshell-parent-buffer eshell-buf) + (let ((proc (get-buffer-process term-buf))) + (if (and proc (eq 'run (process-status proc))) + (set-process-sentinel proc #'eshell-term-sentinel) + (error "Failed to invoke visual command"))))) + nil) + (advice-add #'eshell-exec-visual :override #'bd/eshell-exec-visual)) + (use-package esh-module :config (add-to-list 'eshell-modules-list 'eshell-smart)) @@ -22,7 +53,8 @@ (use-package em-term :config (add-to-list 'eshell-visual-commands "nethack") - (add-to-list 'eshell-visual-commands "r2")) + (add-to-list 'eshell-visual-commands "r2") + (setopt eshell-destroy-buffer-when-process-dies t)) (use-package em-prompt :config diff --git a/.config/guix/modules/services/base.scm b/.config/guix/modules/services/base.scm index b246820..4b410b9 100644 --- a/.config/guix/modules/services/base.scm +++ b/.config/guix/modules/services/base.scm @@ -133,7 +133,7 @@ alias | sed -E \"s/^alias ([^=]+)='(.*)'$/alias \\1 \\2 \\$*/g; s/'\\\\\\''/'/g; home-files-service-type `((".gdbinit" ,(plain-file "gdbinit" "set disassembly-flavor intel")) - ("./.radare2rc" + (".radare2rc" ,(plain-file "radare2rc" "e bin.relocs.apply=true")))) (service home-mcron-service-type diff --git a/.config/guix/modules/services/emacs.scm b/.config/guix/modules/services/emacs.scm index 7514168..b65cc3c 100644 --- a/.config/guix/modules/services/emacs.scm +++ b/.config/guix/modules/services/emacs.scm @@ -39,6 +39,7 @@ emacs-pinentry emacs-rainbow-delimiters emacs-rainbow-mode + emacs-vterm aspell aspell-dict-en -- cgit v1.2.3