Function: eshell-source-file
eshell-source-file is a byte-compiled function defined in
em-script.el.gz.
Signature
(eshell-source-file FILE &optional ARGS SUBCOMMAND-P)
Documentation
Execute a series of Eshell commands in FILE, passing ARGS.
Comments begin with #.
Source Code
;; Defined in /usr/src/emacs/lisp/eshell/em-script.el.gz
(defun eshell-source-file (file &optional args subcommand-p)
"Execute a series of Eshell commands in FILE, passing ARGS.
Comments begin with `#'."
(let ((orig (point))
(here (point-max))
(inhibit-point-motion-hooks t))
(goto-char (point-max))
(with-silent-modifications
;; FIXME: Why not use a temporary buffer and avoid this
;; "insert&delete" business? --Stef
(insert-file-contents file)
(goto-char (point-max))
(throw 'eshell-replace-command
(prog1
(list 'let
(list (list 'eshell-command-name (list 'quote file))
(list 'eshell-command-arguments
(list 'quote args)))
(let ((cmd (eshell-parse-command (cons here (point)))))
(if subcommand-p
(setq cmd (list 'eshell-as-subcommand cmd)))
cmd))
(delete-region here (point))
(goto-char orig))))))