From 6a6ac8f315cdf7aba13480c7ede2724ae98d81e0 Mon Sep 17 00:00:00 2001 From: Henrik Lissner Date: Sun, 1 Jun 2025 00:25:58 +0200 Subject: [PATCH] fix(eshell): disable undo while process is executing After further experimentation these will be replaced with named functions. --- modules/term/eshell/config.el | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/modules/term/eshell/config.el b/modules/term/eshell/config.el index 8228df5d3..fc5adab49 100644 --- a/modules/term/eshell/config.el +++ b/modules/term/eshell/config.el @@ -85,6 +85,16 @@ You should use `set-eshell-alias!' to change this.") (add-hook 'eshell-mode-hook #'+eshell-init-h) (add-hook 'eshell-exit-hook #'+eshell-cleanup-h) + ;; UX: Temporarily disable undo history between command executions. Undo can + ;; destroy output while it's being printed to stdout. + (let (old-undo-list) + (add-hook! 'eshell-pre-command-hook + (setq old-undo-list buffer-undo-list + buffer-undo-list nil)) + (add-hook! 'eshell-post-command-hook + (setq buffer-undo-list old-undo-list) + (clrhash undo-equiv-table))) + ;; Enable autopairing in eshell (add-hook 'eshell-mode-hook #'smartparens-mode)