diff --git a/lisp/eshell/esh-cmd.el b/lisp/eshell/esh-cmd.el index 0f506c7664a..5292acb964a 100644 --- a/lisp/eshell/esh-cmd.el +++ b/lisp/eshell/esh-cmd.el @@ -1584,7 +1584,8 @@ a string naming a Lisp function." (eshell-set-exit-info 0)) (setq eshell-last-arguments args) (let* ((eshell-ensure-newline-p t) - (command-form-p (functionp object)) + (command-form-p (and (functionp object) + (symbolp object))) result) (if command-form-p (let ((numeric (not (get object 'eshell-no-numeric-conversions))) diff --git a/test/lisp/eshell/esh-cmd-tests.el b/test/lisp/eshell/esh-cmd-tests.el index 1d03becb9d9..fd7df7e1d81 100644 --- a/test/lisp/eshell/esh-cmd-tests.el +++ b/test/lisp/eshell/esh-cmd-tests.el @@ -60,6 +60,11 @@ Test that trailing arguments outside the S-expression are ignored. e.g. \"(+ 1 2) 3\" => 3" (eshell-command-result-equal "(+ 1 2) 3" 3)) +(ert-deftest esh-cmd-test/literal-lambda () + "Test that a lambda isn't immediately invoked." + (eshell-command-result-equal "(lambda (i) (+ i 1))" + (eval '(lambda (i) (+ i 1))))) + (ert-deftest esh-cmd-test/subcommand () "Test invocation with a simple subcommand." (eshell-command-result-equal "{+ 1 2}" 3))