From: Stefan Monnier Date: Mon, 23 Sep 2013 23:23:32 +0000 (-0400) Subject: * lisp/eshell/esh-cmd.el (eshell--sep-terms): New var. X-Git-Tag: emacs-24.3.90~173^2^2~42^2~45^2~387^2~1464 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=84998447c3c9c37935a1dd948e3739cff5b9e71b;p=emacs.git * lisp/eshell/esh-cmd.el (eshell--sep-terms): New var. (eshell-parse-command, eshell-parse-pipeline): Use it since eshell-separate-commands requires a dynamic scoped var. Reported by Jan Moringen . --- diff --git a/lisp/ChangeLog b/lisp/ChangeLog index c25462dbe3a..1a9f6984d91 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,10 @@ +2013-09-23 Stefan Monnier + + * eshell/esh-cmd.el (eshell--sep-terms): New var. + (eshell-parse-command, eshell-parse-pipeline): Use it since + eshell-separate-commands requires a dynamic scoped var. + Reported by Jan Moringen . + 2013-09-23 Leo Liu * autoinsert.el (auto-insert-alist): Make the value of diff --git a/lisp/eshell/esh-cmd.el b/lisp/eshell/esh-cmd.el index 87c72d2caf5..baa8e7bafcf 100644 --- a/lisp/eshell/esh-cmd.el +++ b/lisp/eshell/esh-cmd.el @@ -339,13 +339,15 @@ otherwise t.") ;; Command parsing +(defvar eshell--sep-terms) + (defun eshell-parse-command (command &optional args toplevel) "Parse the COMMAND, adding ARGS if given. COMMAND can either be a string, or a cons cell demarcating a buffer region. TOPLEVEL, if non-nil, means that the outermost command (the user's input command) is being parsed, and that pre and post command hooks should be run before and after the command." - (let* (sep-terms + (let* (eshell--sep-terms (terms (append (if (consp command) @@ -365,16 +367,16 @@ hooks should be run before and after the command." (function (lambda (cmd) (setq cmd - (if (or (not (car sep-terms)) - (string= (car sep-terms) ";")) + (if (or (not (car eshell--sep-terms)) + (string= (car eshell--sep-terms) ";")) (eshell-parse-pipeline cmd) `(eshell-do-subjob (list ,(eshell-parse-pipeline cmd))))) - (setq sep-terms (cdr sep-terms)) + (setq eshell--sep-terms (cdr eshell--sep-terms)) (if eshell-in-pipeline-p cmd `(eshell-trap-errors ,cmd)))) - (eshell-separate-commands terms "[&;]" nil 'sep-terms)))) + (eshell-separate-commands terms "[&;]" nil 'eshell--sep-terms)))) (let ((cmd commands)) (while cmd (if (cdr cmd) @@ -586,9 +588,9 @@ For an external command, it means an exit code of 0." (defun eshell-parse-pipeline (terms) "Parse a pipeline from TERMS, return the appropriate Lisp forms." - (let* (sep-terms + (let* (eshell--sep-terms (bigpieces (eshell-separate-commands terms "\\(&&\\|||\\)" - nil 'sep-terms)) + nil 'eshell--sep-terms)) (bp bigpieces) (results (list t)) final) @@ -620,15 +622,15 @@ For an external command, it means an exit code of 0." results (nreverse results) final (car results) results (cdr results) - sep-terms (nreverse sep-terms)) + eshell--sep-terms (nreverse eshell--sep-terms)) (while results - (cl-assert (car sep-terms)) + (cl-assert (car eshell--sep-terms)) (setq final (eshell-structure-basic-command - 'if (string= (car sep-terms) "&&") "if" + 'if (string= (car eshell--sep-terms) "&&") "if" `(eshell-protect ,(car results)) `(eshell-protect ,final)) results (cdr results) - sep-terms (cdr sep-terms))) + eshell--sep-terms (cdr eshell--sep-terms))) final)) (defun eshell-parse-subcommand-argument ()