From 383c79316bbd91cc9a17ce53f9947438731c232f Mon Sep 17 00:00:00 2001 From: Lin Sun Date: Sat, 27 Apr 2024 06:55:49 +0000 Subject: [PATCH] Only run 'eshell-first-time-mode-hook' once per Emacs session * lisp/eshell/esh-mode.el (eshell-mode): Set 'eshell-first-time-p' to nil (bug#70610). (cherry picked from commit a2ccda71c15f75edef0711f94351af0dd7241beb) --- lisp/eshell/esh-mode.el | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lisp/eshell/esh-mode.el b/lisp/eshell/esh-mode.el index b15f99a0359..5de200ce4b5 100644 --- a/lisp/eshell/esh-mode.el +++ b/lisp/eshell/esh-mode.el @@ -418,8 +418,10 @@ and the hook `eshell-exit-hook'." (add-hook 'kill-buffer-hook #'eshell-kill-buffer-function t t) - (if eshell-first-time-p - (run-hooks 'eshell-first-time-mode-hook)) + (when eshell-first-time-p + (setq eshell-first-time-p nil) + (run-hooks 'eshell-first-time-mode-hook)) + (run-hooks 'eshell-post-command-hook)) (put 'eshell-mode 'mode-class 'special) -- 2.39.5