]> git.eshelyaron.com Git - emacs.git/commitdiff
; * lisp/eshell/esh-cmd.el (eshell-lisp-command): Simplify.
authorJim Porter <jporterbugs@gmail.com>
Sun, 20 Jul 2025 23:05:00 +0000 (16:05 -0700)
committerEshel Yaron <me@eshelyaron.com>
Fri, 25 Jul 2025 08:10:47 +0000 (10:10 +0200)
(cherry picked from commit cb2de766149e47a7ffe245f7c78ff414ead69d78)

lisp/eshell/esh-cmd.el

index a666228572269a347e03d7dfa28c10fa7eaeb068..64724e5ee9b373f52a3fa194b9564c581d1854ce 100644 (file)
@@ -1585,36 +1585,30 @@ a string naming a Lisp function."
     (setq eshell-last-arguments args)
     (let* ((eshell-ensure-newline-p t)
            (command-form-p (functionp object))
-           (result
-            (if command-form-p
-                (let ((numeric (not (get object
-                                         'eshell-no-numeric-conversions)))
-                      (fname-args (get object 'eshell-filename-arguments)))
-                  (when (or numeric fname-args)
-                    (while args
-                      (let ((arg (car args)))
-                        (cond
-                         ((and numeric (eshell--numeric-string-p arg))
-                          ;; If any of the arguments are flagged as
-                          ;; numbers waiting for conversion, convert
-                          ;; them now.
-                          (setcar args (string-to-number arg)))
-                         ((and fname-args (stringp arg)
-                               (string-equal arg "~"))
-                          ;; If any of the arguments match "~",
-                          ;; prepend "./" to treat it as a regular
-                          ;; file name.
-                          (setcar args (concat "./" arg)))))
-                      (setq args (cdr args))))
-                  (setq eshell-last-command-name
-                        (concat "#<function " (symbol-name object) ">"))
-                  (eshell-apply* #'eshell-print-maybe-n
-                                 #'eshell-error-maybe-n
-                                 object eshell-last-arguments))
-              (setq eshell-last-command-name "#<Lisp object>")
-              (eshell-eval* #'eshell-print-maybe-n
-                            #'eshell-error-maybe-n
-                            object))))
+           result)
+      (if command-form-p
+          (let ((numeric (not (get object 'eshell-no-numeric-conversions)))
+                (fname-args (get object 'eshell-filename-arguments)))
+            (when (or numeric fname-args)
+              (while args
+                (let ((arg (car args)))
+                  (cond
+                   ((and numeric (eshell--numeric-string-p arg))
+                    ;; If any of the arguments are flagged as numbers
+                    ;; waiting for conversion, convert them now.
+                    (setcar args (string-to-number arg)))
+                   ((and fname-args (stringp arg)
+                         (string-equal arg "~"))
+                    ;; If any of the arguments match "~", prepend "./"
+                    ;; to treat it as a regular file name.
+                    (setcar args (concat "./" arg)))))
+                (setq args (cdr args))))
+            (setq eshell-last-command-name
+                  (concat "#<function " (symbol-name object) ">")))
+        (setq eshell-last-command-name "#<Lisp object>"))
+      (setq result (eshell-exec-lisp
+                    #'eshell-print-maybe-n #'eshell-error-maybe-n
+                    object eshell-last-arguments (not command-form-p)))
       (when (memq eshell-in-pipeline-p '(nil last))
         (eshell-set-exit-info
          ;; If `eshell-lisp-form-nil-is-failure' is non-nil, Lisp forms