Fix up Eshell 'require's after previous dependency reshuffle.

* lisp/eshell/em-unix.el:
* lisp/eshell/em-script.el:
* lisp/eshell/em-pred.el:
* lisp/eshell/em-dirs.el:
* lisp/eshell/em-alias.el:
Fix up 'require's to silence byte-compiler.

* lisp/eshell/esh-util.el (eshell-read-hosts-file): Don't limit number
of entries per line.  Preserve the structure.
(eshell-read-hosts): Adjust accordingly.
This commit is contained in:
Stefan Monnier 2019-04-09 14:57:29 -04:00
parent 1055eee692
commit a017927c9f
22 changed files with 41 additions and 51 deletions

View file

@ -90,7 +90,7 @@
;;; Code:
(require 'eshell)
(require 'esh-mode)
;;;###autoload
(progn
@ -141,12 +141,12 @@ file named by `eshell-aliases-file'.")
(defvar eshell-failed-commands-alist nil
"An alist of command name failures.")
(defun eshell-alias-initialize ()
(defun eshell-alias-initialize () ;Called from `eshell-mode' via intern-soft!
"Initialize the alias handling code."
(make-local-variable 'eshell-failed-commands-alist)
(add-hook 'eshell-alternate-command-hook 'eshell-fix-bad-commands t t)
(add-hook 'eshell-alternate-command-hook #'eshell-fix-bad-commands t t)
(eshell-read-aliases-list)
(add-hook 'eshell-named-command-hook 'eshell-maybe-replace-by-alias t t)
(add-hook 'eshell-named-command-hook #'eshell-maybe-replace-by-alias t t)
(make-local-variable 'eshell-complex-commands)
(add-to-list 'eshell-complex-commands 'eshell-command-aliased-p))

View file

@ -71,7 +71,7 @@ This can be any sexp, and should end with at least two newlines."
:type 'hook
:group 'eshell-banner)
(defun eshell-banner-initialize ()
(defun eshell-banner-initialize () ;Called from `eshell-mode' via intern-soft!
"Output a welcome banner on initialization."
;; it's important to use `eshell-interactive-print' rather than
;; `insert', because `insert' doesn't know how to interact with the

View file

@ -244,7 +244,7 @@ to writing a completion function."
(let ((completion-at-point-functions '(lisp-completion-at-point)))
(completion-at-point)))
(defun eshell-cmpl-initialize ()
(defun eshell-cmpl-initialize () ;Called from `eshell-mode' via intern-soft!
"Initialize the completions module."
(set (make-local-variable 'pcomplete-command-completion-function)
eshell-command-completion-function)

View file

@ -42,15 +42,11 @@
;;; Code:
(require 'eshell)
(require 'esh-mode) ;For eshell-directory-name
(require 'esh-var) ;For eshell-variable-aliases-list
(require 'ring)
(require 'esh-opt)
(declare-function eshell-apply-indices "esh-var")
(defvar eshell-variable-aliases-list)
(defvar eshell-directory-name)
(defvar eshell-mode)
;;;###autoload
(progn
(defgroup eshell-dirs nil
@ -174,9 +170,8 @@ Thus, this does not include the current directory.")
;;; Functions:
(defun eshell-dirs-initialize ()
(defun eshell-dirs-initialize () ;Called from `eshell-mode' via intern-soft!
"Initialize the builtin functions for Eshell."
(require 'esh-var)
(make-local-variable 'eshell-variable-aliases-list)
(setq eshell-variable-aliases-list
(append

View file

@ -125,7 +125,7 @@ This option slows down recursive glob processing by quite a bit."
;;; Functions:
(defun eshell-glob-initialize ()
(defun eshell-glob-initialize () ;Called from `eshell-mode' via intern-soft!
"Initialize the extended globbing code."
;; it's important that `eshell-glob-chars-list' come first
(when (boundp 'eshell-special-chars-outside-quoting)

View file

@ -216,7 +216,7 @@ Returns non-nil if INPUT is blank."
Returns nil if INPUT is prepended by blank space, otherwise non-nil."
(not (string-match-p "\\`\\s-+" input)))
(defun eshell-hist-initialize ()
(defun eshell-hist-initialize () ;Called from `eshell-mode' via intern-soft!
"Initialize the history management code for one Eshell buffer."
(when (eshell-using-module 'eshell-cmpl)
(add-hook 'pcomplete-try-first-hook

View file

@ -46,9 +46,7 @@
;;; Code:
(require 'esh-util)
(require 'esh-arg)
(eval-when-compile (require 'eshell))
(require 'esh-mode)
;;;###autoload
(progn
@ -247,10 +245,10 @@ EXAMPLES:
(lambda ()
(insert eshell-modifier-help-string)))))
(defun eshell-pred-initialize ()
(defun eshell-pred-initialize () ;Called from `eshell-mode' via intern-soft!
"Initialize the predicate/modifier code."
(add-hook 'eshell-parse-argument-hook
'eshell-parse-arg-modifier t t)
#'eshell-parse-arg-modifier t t)
(define-key eshell-command-map [(meta ?q)] 'eshell-display-predicate-help)
(define-key eshell-command-map [(meta ?m)] 'eshell-display-modifier-help))

View file

@ -99,7 +99,7 @@ arriving, or after."
;;; Functions:
(defun eshell-prompt-initialize ()
(defun eshell-prompt-initialize () ;Called from `eshell-mode' via intern-soft!
"Initialize the prompting code."
(unless eshell-non-interactive-p
(add-hook 'eshell-post-command-hook 'eshell-emit-prompt nil t)

View file

@ -145,7 +145,7 @@ This is default behavior of shells like bash."
;;; Functions:
(defun eshell-rebind-initialize ()
(defun eshell-rebind-initialize () ;Called from `eshell-mode' via intern-soft!
"Initialize the inputting code."
(unless eshell-non-interactive-p
(add-hook 'eshell-mode-hook 'eshell-setup-input-keymap nil t)

View file

@ -23,8 +23,7 @@
;;; Code:
(require 'eshell)
(require 'esh-opt)
(require 'esh-mode)
;;;###autoload
(progn
@ -57,7 +56,7 @@ This includes when running `eshell-command'."
;;; Functions:
(defun eshell-script-initialize ()
(defun eshell-script-initialize () ;Called from `eshell-mode' via intern-soft!
"Initialize the script parsing code."
(make-local-variable 'eshell-interpreter-alist)
(setq eshell-interpreter-alist
@ -73,13 +72,14 @@ This includes when running `eshell-command'."
;; to ruin it for other modules
(let (eshell-inside-quote-regexp
eshell-outside-quote-regexp)
(and (not eshell-non-interactive-p)
(and (not (bound-and-true-p eshell-non-interactive-p))
eshell-login-script
(file-readable-p eshell-login-script)
(eshell-do-eval
(list 'eshell-commands
(catch 'eshell-replace-command
(eshell-source-file eshell-login-script))) t))
(eshell-source-file eshell-login-script)))
t))
(and eshell-rc-script
(file-readable-p eshell-rc-script)
(eshell-do-eval

View file

@ -166,7 +166,7 @@ The options are `begin', `after' or `end'."
;;; Functions:
(defun eshell-smart-initialize ()
(defun eshell-smart-initialize () ;Called from `eshell-mode' via intern-soft!
"Setup Eshell smart display."
(unless eshell-non-interactive-p
;; override a few variables, since they would interfere with the

View file

@ -147,7 +147,7 @@ behavior for short-lived processes, see bug#18108."
;;; Functions:
(defun eshell-term-initialize ()
(defun eshell-term-initialize () ;Called from `eshell-mode' via intern-soft!
"Initialize the `term' interface code."
(make-local-variable 'eshell-interpreter-alist)
(setq eshell-interpreter-alist

View file

@ -46,7 +46,7 @@
:tag "TRAMP Eshell features"
:group 'eshell-module))
(defun eshell-tramp-initialize ()
(defun eshell-tramp-initialize () ;Called from `eshell-mode' via intern-soft!
"Initialize the TRAMP-using commands code."
(when (eshell-using-module 'eshell-cmpl)
(add-hook 'pcomplete-try-first-hook

View file

@ -35,8 +35,7 @@
;;; Code:
(require 'eshell)
(require 'esh-opt)
(require 'esh-mode)
(require 'pcomplete)
;;;###autoload
@ -140,7 +139,7 @@ Otherwise, Emacs will attempt to use rsh to invoke du on the remote machine."
;;; Functions:
(defun eshell-unix-initialize ()
(defun eshell-unix-initialize () ;Called from `eshell-mode' via intern-soft!
"Initialize the UNIX support/emulation code."
(when (eshell-using-module 'eshell-cmpl)
(add-hook 'pcomplete-try-first-hook

View file

@ -157,7 +157,7 @@ treated as a literal character."
;;; Functions:
(defun eshell-arg-initialize ()
(defun eshell-arg-initialize () ;Called from `eshell-mode' via intern-soft!
"Initialize the argument parsing code."
;; This is supposedly run after enabling esh-mode, when eshell-mode-map
;; already exists.

View file

@ -287,7 +287,7 @@ otherwise t.")
"Return currently running command process, if non-Lisp."
eshell-last-async-proc)
(defun eshell-cmd-initialize ()
(defun eshell-cmd-initialize () ;Called from `eshell-mode' via intern-soft!
"Initialize the Eshell command processing module."
(set (make-local-variable 'eshell-current-command) nil)
(set (make-local-variable 'eshell-command-name) nil)

View file

@ -172,7 +172,7 @@ external version."
;;; Functions:
(defun eshell-ext-initialize ()
(defun eshell-ext-initialize () ;Called from `eshell-mode' via intern-soft!
"Initialize the external command handling code."
(add-hook 'eshell-named-command-hook #'eshell-explicit-command nil t))

View file

@ -169,7 +169,7 @@ not be added to this variable."
;;; Functions:
(defun eshell-io-initialize ()
(defun eshell-io-initialize () ;Called from `eshell-mode' via intern-soft!
"Initialize the I/O subsystem code."
(add-hook 'eshell-parse-argument-hook
'eshell-parse-redirection nil t)

View file

@ -412,7 +412,7 @@ and the hook `eshell-exit-hook'."
(when (and load-hook (boundp load-hook))
(if (memq initfunc (symbol-value load-hook)) (setq initfunc nil))
(run-hooks load-hook))
;; So we don't need the -initialize functions on the hooks (b#5375).
;; So we don't need the -initialize functions on the hooks (bug#5375).
(and initfunc (fboundp initfunc) (funcall initfunc))))
(if eshell-send-direct-to-subprocesses

View file

@ -121,7 +121,7 @@ PROC and STATUS to functions on the latter."
(eshell-reset-after-proc status)
(run-hook-with-args 'eshell-kill-hook proc status))
(defun eshell-proc-initialize ()
(defun eshell-proc-initialize () ;Called from `eshell-mode' via intern-soft!
"Initialize the process handling code."
(make-local-variable 'eshell-process-list)
;; This is supposedly run after enabling esh-mode, when eshell-command-map

View file

@ -478,24 +478,22 @@ list."
(insert-file-contents (or filename eshell-hosts-file))
(goto-char (point-min))
(while (re-search-forward
"^\\([^#[:space:]]+\\)\\s-+\\(\\S-+\\)\\(\\s-*\\(\\S-+\\)\\)?" nil t)
(if (match-string 1)
(cl-pushnew (match-string 1) hosts :test #'equal))
(if (match-string 2)
(cl-pushnew (match-string 2) hosts :test #'equal))
(if (match-string 4)
(cl-pushnew (match-string 4) hosts :test #'equal))))
(sort hosts #'string-lessp)))
;; "^ \t\\([^# \t\n]+\\)[ \t]+\\([^ \t\n]+\\)\\([ \t]*\\([^ \t\n]+\\)\\)?"
"^[ \t]*\\([^# \t\n]+\\)[ \t]+\\([^ \t\n].+\\)" nil t)
(push (cons (match-string 1)
(split-string (match-string 2)))
hosts)))
(nreverse hosts)))
(defun eshell-read-hosts (file result-var timestamp-var)
"Read the contents of /etc/passwd for user names."
"Read the contents of /etc/hosts for host names."
(if (or (not (symbol-value result-var))
(not (symbol-value timestamp-var))
(time-less-p
(symbol-value timestamp-var)
(file-attribute-modification-time (file-attributes file))))
(progn
(set result-var (eshell-read-hosts-file file))
(set result-var (apply #'nconc (eshell-read-hosts-file file)))
(set timestamp-var (current-time))))
(symbol-value result-var))

View file

@ -199,7 +199,7 @@ function), and the arguments passed to this function would be the list
;;; Functions:
(defun eshell-var-initialize ()
(defun eshell-var-initialize () ;Called from `eshell-mode' via intern-soft!
"Initialize the variable handle code."
;; Break the association with our parent's environment. Otherwise,
;; changing a variable will affect all of Emacs.