mirror of
git://git.sv.gnu.org/emacs.git
synced 2026-06-14 12:31:25 +00:00
Allow writing a lambda function as a command in Eshell
* lisp/eshell/esh-cmd.el (eshell-lisp-command): Don't try to call a literal lambda. * test/lisp/eshell/esh-cmd-tests.el (esh-cmd-test/literal-lambda): New test.
This commit is contained in:
parent
b72dcebdab
commit
47cda4ecac
2 changed files with 7 additions and 1 deletions
|
|
@ -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)))
|
||||
|
|
|
|||
|
|
@ -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))
|
||||
|
|
|
|||
Loading…
Reference in a new issue