From 522f31164da4186af9d15b5608c721ca377ba3c0 Mon Sep 17 00:00:00 2001 From: Jim Porter Date: Sun, 12 Feb 2023 23:25:40 -0800 Subject: [PATCH 1/2] ; Don't require 'eshell' in other Eshell files This isn't necessary and just makes unloading Eshell harder. * lisp/eshell/em-banner.el: * lisp/eshell/em-basic.el: * lisp/eshell/em-cmpl.el: * lisp/eshell/em-glob.el: * lisp/eshell/em-prompt.el: * lisp/eshell/em-rebind.el: * lisp/eshell/em-smart.el: * lisp/eshell/em-term.el: * lisp/eshell/em-tramp.el: * lisp/eshell/em-xtra.el: Stop requiring 'eshell', and instead require specific subcomponents. * lisp/eshell/em-hist.el: Stop requiring 'eshell' and 'em-pred' (extension modules shouldn't require each other so they can be independent). (eshell-hist-parse-modifier): Ensure this can only be called when 'em-pred' is in use, and declare the relevant function. * lisp/eshell/eshell.el (eshell-non-interactive-p): Move from here... * lisp/eshell/esh-mode.el (eshell-non-interactive-p): ... to here. --- lisp/eshell/em-banner.el | 1 - lisp/eshell/em-basic.el | 5 +++-- lisp/eshell/em-cmpl.el | 4 +--- lisp/eshell/em-glob.el | 3 ++- lisp/eshell/em-hist.el | 4 ++-- lisp/eshell/em-prompt.el | 2 -- lisp/eshell/em-rebind.el | 1 - lisp/eshell/em-smart.el | 1 - lisp/eshell/em-term.el | 1 - lisp/eshell/em-tramp.el | 3 +-- lisp/eshell/em-xtra.el | 2 -- lisp/eshell/esh-mode.el | 5 +++++ lisp/eshell/eshell.el | 5 +---- 13 files changed, 15 insertions(+), 22 deletions(-) diff --git a/lisp/eshell/em-banner.el b/lisp/eshell/em-banner.el index 8bc497bdeb3..2bee50b80a4 100644 --- a/lisp/eshell/em-banner.el +++ b/lisp/eshell/em-banner.el @@ -43,7 +43,6 @@ (require 'esh-util) (require 'esh-mode) -(require 'eshell) ;;;###autoload (progn diff --git a/lisp/eshell/em-basic.el b/lisp/eshell/em-basic.el index bfff3bdf56e..016afe811b2 100644 --- a/lisp/eshell/em-basic.el +++ b/lisp/eshell/em-basic.el @@ -53,9 +53,10 @@ ;;; Code: -(require 'esh-util) -(require 'eshell) +(require 'esh-cmd) +(require 'esh-io) (require 'esh-opt) +(require 'esh-util) ;;;###autoload (progn diff --git a/lisp/eshell/em-cmpl.el b/lisp/eshell/em-cmpl.el index 2439f1ed804..af8ac4278f1 100644 --- a/lisp/eshell/em-cmpl.el +++ b/lisp/eshell/em-cmpl.el @@ -74,9 +74,7 @@ (require 'esh-util) (require 'em-dirs) -(eval-when-compile - (require 'cl-lib) - (require 'eshell)) +(eval-when-compile (require 'cl-lib)) ;;;###autoload (progn diff --git a/lisp/eshell/em-glob.el b/lisp/eshell/em-glob.el index 716f5c32b87..c7360fb246e 100644 --- a/lisp/eshell/em-glob.el +++ b/lisp/eshell/em-glob.el @@ -49,8 +49,9 @@ ;;; Code: +(require 'esh-arg) +(require 'esh-module) (require 'esh-util) -(eval-when-compile (require 'eshell)) ;;;###autoload (progn diff --git a/lisp/eshell/em-hist.el b/lisp/eshell/em-hist.el index 6e0e471d910..4796df1604e 100644 --- a/lisp/eshell/em-hist.el +++ b/lisp/eshell/em-hist.el @@ -59,8 +59,6 @@ (require 'ring) (require 'esh-opt) (require 'esh-mode) -(require 'em-pred) -(require 'eshell) ;;;###autoload (progn @@ -769,6 +767,8 @@ eshell-hist-parse-word-designator (defun eshell-hist-parse-modifier (hist reference) "Parse a history modifier beginning for HIST in REFERENCE." + (cl-assert (eshell-using-module 'em-pred)) + (declare-function eshell-parse-modifiers "em-pred" ()) (let ((here (point))) (insert reference) (prog1 diff --git a/lisp/eshell/em-prompt.el b/lisp/eshell/em-prompt.el index b3a0fadf618..9f9e58e83d7 100644 --- a/lisp/eshell/em-prompt.el +++ b/lisp/eshell/em-prompt.el @@ -27,8 +27,6 @@ ;;; Code: (require 'esh-mode) -(eval-when-compile (require 'eshell)) - (require 'text-property-search) ;;;###autoload diff --git a/lisp/eshell/em-rebind.el b/lisp/eshell/em-rebind.el index f147d432300..75a2848a9d5 100644 --- a/lisp/eshell/em-rebind.el +++ b/lisp/eshell/em-rebind.el @@ -24,7 +24,6 @@ ;;; Code: (require 'esh-mode) -(eval-when-compile (require 'eshell)) ;;;###autoload (progn diff --git a/lisp/eshell/em-smart.el b/lisp/eshell/em-smart.el index ca04c429785..154ff760212 100644 --- a/lisp/eshell/em-smart.el +++ b/lisp/eshell/em-smart.el @@ -69,7 +69,6 @@ ;;; Code: (require 'esh-mode) -(eval-when-compile (require 'eshell)) ;;;###autoload (progn diff --git a/lisp/eshell/em-term.el b/lisp/eshell/em-term.el index a4d777e4a0d..ab26da857b7 100644 --- a/lisp/eshell/em-term.el +++ b/lisp/eshell/em-term.el @@ -34,7 +34,6 @@ (require 'cl-lib) (require 'esh-util) (require 'esh-ext) -(eval-when-compile (require 'eshell)) (require 'term) ;;;###autoload diff --git a/lisp/eshell/em-tramp.el b/lisp/eshell/em-tramp.el index 13dd62e1617..94eb9797033 100644 --- a/lisp/eshell/em-tramp.el +++ b/lisp/eshell/em-tramp.el @@ -29,8 +29,7 @@ (require 'esh-cmd) (eval-when-compile - (require 'esh-mode) - (require 'eshell)) + (require 'esh-mode)) (require 'tramp) diff --git a/lisp/eshell/em-xtra.el b/lisp/eshell/em-xtra.el index defaa7b2887..45c3ea3c0fc 100644 --- a/lisp/eshell/em-xtra.el +++ b/lisp/eshell/em-xtra.el @@ -25,8 +25,6 @@ (require 'cl-lib) (require 'esh-util) -(eval-when-compile - (require 'eshell)) ;; There are no items in this custom group, but eshell modules (ab)use ;; custom groups. diff --git a/lisp/eshell/esh-mode.el b/lisp/eshell/esh-mode.el index 1b8f5ff8018..e0af3579edf 100644 --- a/lisp/eshell/esh-mode.el +++ b/lisp/eshell/esh-mode.el @@ -200,6 +200,11 @@ eshell-directory-name (defvar eshell-first-time-p t "A variable which is non-nil the first time Eshell is loaded.") +(defvar eshell-non-interactive-p nil + "A variable which is non-nil when Eshell is not running interactively. +Modules should use this variable so that they don't clutter +non-interactive sessions, such as when using `eshell-command'.") + ;; Internal Variables: ;; these are only set to nil initially for the sake of the diff --git a/lisp/eshell/eshell.el b/lisp/eshell/eshell.el index 7a7ece5cb7c..0bfc0413cbf 100644 --- a/lisp/eshell/eshell.el +++ b/lisp/eshell/eshell.el @@ -267,10 +267,7 @@ eshell-command-mode (define-obsolete-function-alias 'eshell-return-exits-minibuffer #'eshell-command-mode "28.1") -(defvar eshell-non-interactive-p nil - "A variable which is non-nil when Eshell is not running interactively. -Modules should use this variable so that they don't clutter -non-interactive sessions, such as when using `eshell-command'.") +(defvar eshell-non-interactive-p) ; Defined in esh-mode.el. (declare-function eshell-add-input-to-history "em-hist" (input)) -- 2.25.1