home

My NixOS systems configurations.
Log | Files | Refs | LICENSE

commit 64329962c7996441bd432587b85555ce1b90d2db
parent fb4dbdc72c46c4d0e44a142bf138200ab3663d16
Author: Vincent Demeester <vincent@sbr.pm>
Date:   Tue,  6 Aug 2024 19:03:34 +0200

tools/emacs: trying something with eshell

Signed-off-by: Vincent Demeester <vincent@sbr.pm>

Diffstat:
Mtools/emacs/config/config-shells.el | 12++++++++++++
1 file changed, 12 insertions(+), 0 deletions(-)

diff --git a/tools/emacs/config/config-shells.el b/tools/emacs/config/config-shells.el @@ -14,11 +14,23 @@ (unbind-key "C-c C-l" shell-mode-map) (bind-key "C-c C-l" #'counsel-shell-history shell-mode-map)) +(defun run-in-compile (base-cmd &rest ARGS) + "Use `compile' to run the BASE-CMD and ARGS, from eshell." + (compile (concat base-cmd " " (apply #'concat ARGS)))) + ;; TODO: understand and rework eshell completion (use-package eshell :commands (eshell eshell-here) :bind* ("C-x m t" . eshell-here) :config + (defun eshell/make (&rest ARGS) + "Shortcut to more easily run builds in a compile buffer" + (cond ((or (file-exists-p "Makefile") + (file-exists-p "makefile")) + (run-in-compile "make" ARGS)) + ((file-exists-p "build.zig") + (run-in-compile "zig build")) + (t "No supported build system found."))) (defun eshell-here () "Open EShell in the directory associated with the current buffer's file. The EShell is renamed to match that directory to make multiple windows easier."