aboutsummaryrefslogtreecommitdiffstats
path: root/lisp/eshell
diff options
context:
space:
mode:
authorJohn Wiegley2001-05-10 03:50:53 +0000
committerJohn Wiegley2001-05-10 03:50:53 +0000
commit3cb27fd7cda5593e8924ec827ea00d7f0fbb83b2 (patch)
tree77ebad68bc015cb201ac2d9ed84d6d1793b710a0 /lisp/eshell
parent127fd3c222486a6349564cb23c21db95f6d3da11 (diff)
downloademacs-3cb27fd7cda5593e8924ec827ea00d7f0fbb83b2.tar.gz
emacs-3cb27fd7cda5593e8924ec827ea00d7f0fbb83b2.zip
(eshell-lisp-command): Don't perform numeric conversions if a Lisp
function has the property `eshell-no-numeric-conversions' set to a non-nil value.
Diffstat (limited to 'lisp/eshell')
-rw-r--r--lisp/eshell/esh-cmd.el32
1 files changed, 19 insertions, 13 deletions
diff --git a/lisp/eshell/esh-cmd.el b/lisp/eshell/esh-cmd.el
index fee5ea0c3c3..ef64fa95867 100644
--- a/lisp/eshell/esh-cmd.el
+++ b/lisp/eshell/esh-cmd.el
@@ -1265,6 +1265,8 @@ be finished later after the completion of an asynchronous subprocess."
1265 name (getenv "PATH"))) 1265 name (getenv "PATH")))
1266 (eshell-printn program))))) 1266 (eshell-printn program)))))
1267 1267
1268(put 'eshell/which 'eshell-no-numeric-conversions t)
1269
1268(defun eshell-named-command (command &optional args) 1270(defun eshell-named-command (command &optional args)
1269 "Insert output from a plain COMMAND, using ARGS. 1271 "Insert output from a plain COMMAND, using ARGS.
1270COMMAND may result in an alias being executed, or a plain command." 1272COMMAND may result in an alias being executed, or a plain command."
@@ -1383,23 +1385,27 @@ messages, and errors."
1383 1385
1384(defun eshell-lisp-command (object &optional args) 1386(defun eshell-lisp-command (object &optional args)
1385 "Insert Lisp OBJECT, using ARGS if a function." 1387 "Insert Lisp OBJECT, using ARGS if a function."
1386 ;; if any of the arguments are flagged as numbers waiting for
1387 ;; conversion, convert them now
1388 (let ((a args) arg)
1389 (while a
1390 (setq arg (car a))
1391 (if (and (stringp arg)
1392 (> (length arg) 0)
1393 (get-text-property 0 'number arg))
1394 (setcar a (string-to-number arg)))
1395 (setq a (cdr a))))
1396 (setq eshell-last-arguments args
1397 eshell-last-command-name "#<Lisp>")
1398 (catch 'eshell-external ; deferred to an external command 1388 (catch 'eshell-external ; deferred to an external command
1399 (let* ((eshell-ensure-newline-p (eshell-interactive-output-p)) 1389 (let* ((eshell-ensure-newline-p (eshell-interactive-output-p))
1400 (result 1390 (result
1401 (if (functionp object) 1391 (if (functionp object)
1402 (eshell-apply object args) 1392 (progn
1393 (setq eshell-last-arguments args
1394 eshell-last-command-name
1395 (concat "#<function " (symbol-name object) ">"))
1396 ;; if any of the arguments are flagged as numbers
1397 ;; waiting for conversion, convert them now
1398 (unless (get object 'eshell-no-numeric-conversions)
1399 (while args
1400 (let ((arg (car args)))
1401 (if (and (stringp arg)
1402 (> (length arg) 0)
1403 (get-text-property 0 'number arg))
1404 (setcar a (string-to-number arg))))
1405 (setq args (cdr args))))
1406 (eshell-apply object eshell-last-arguments))
1407 (setq eshell-last-arguments args
1408 eshell-last-command-name "#<Lisp object>")
1403 (eshell-eval object)))) 1409 (eshell-eval object))))
1404 (if (and eshell-ensure-newline-p 1410 (if (and eshell-ensure-newline-p
1405 (save-excursion 1411 (save-excursion