From 2243b1e4effdeda0cec9cde4a49fd9ac8a5f9271 Mon Sep 17 00:00:00 2001 From: Case Duckworth Date: Sun, 16 Jan 2022 23:13:11 -0600 Subject: Dammit, lots of changes --- lisp/+eshell.el | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'lisp/+eshell.el') diff --git a/lisp/+eshell.el b/lisp/+eshell.el index bd92b03..1f8677c 100644 --- a/lisp/+eshell.el +++ b/lisp/+eshell.el @@ -76,5 +76,25 @@ any directory proferred by `consult-dir'." (add-hook 'eshell-post-command-hook #'eshell-record-args nil t) (remove-hook 'eshell-post-command-hook #'eshell-record-args t))) +;;;###autoload +(defmacro +eshell-eval-after-load (&rest forms) + "Execute FORMS after Eshell is loaded. +If Eshell is already loaded in the session, immediately execute +forms. + +I wrote this because Eshell doesn't properly do loading or +something, it's really annoying to work with." + (declare (indent 0)) + `(progn + (defun +eshell@setup () + "Setup the Eshell session." + ,@forms) + (when (featurep 'eshell) + `(dolist (buf (buffer-list)) + (with-current-buffer buf + (when (derived-mode-p 'eshell-mode) + (+eshell@setup))))) + '(add-hook 'eshell-mode-hook #'+eshell@setup))) + (provide '+eshell) ;;; +eshell.el ends here -- cgit 1.4.1-21-gabe81