;;; Code:
-(require 'eshell)
+(require 'esh-mode)
;;;###autoload
(progn
(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))
: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
(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)
;;; 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
;;; 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
;;; 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)
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
;;; Code:
-(require 'esh-util)
-(require 'esh-arg)
-(eval-when-compile (require 'eshell))
+(require 'esh-mode)
;;;###autoload
(progn
(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))
;;; 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)
;;; 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)
;;; Code:
-(require 'eshell)
-(require 'esh-opt)
+(require 'esh-mode)
;;;###autoload
(progn
;;; 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
;; 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
;;; 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
;;; 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
: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
;;; Code:
-(require 'eshell)
-(require 'esh-opt)
+(require 'esh-mode)
(require 'pcomplete)
;;;###autoload
;;; 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
;;; 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.
"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)
;;; 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))
;;; 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)
(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
(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
(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))
;;; 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.