]> git.eshelyaron.com Git - emacs.git/commitdiff
Fix usage reporting for Eshell commands
authorJim Porter <jporterbugs@gmail.com>
Mon, 9 Dec 2024 04:23:46 +0000 (20:23 -0800)
committerEshel Yaron <me@eshelyaron.com>
Mon, 9 Dec 2024 12:51:51 +0000 (13:51 +0100)
* lisp/eshell/esh-cmd.el (eshell-exec-lisp): Call
'elisp-get-fnsym-args-string'; the old function was renamed to this.

(cherry picked from commit 6df535788a20c9047d33dd8a0c62258597632647)

lisp/eshell/esh-cmd.el

index 0927fd8f08740f14922ce2e9bceff8f074039227..594d8781e35092f307d95161f2d0e254dda9a9b8 100644 (file)
@@ -1501,11 +1501,13 @@ case."
      (when (memq eshell-in-pipeline-p '(nil last))
        (eshell-set-exit-info 1))
      (let ((msg (error-message-string err)))
-       (if (and (not form-p)
-                (string-match "^Wrong number of arguments" msg)
-                (fboundp 'eldoc-get-fnsym-args-string))
-           (let ((func-doc (eldoc-get-fnsym-args-string func-or-form)))
-             (setq msg (format "usage: %s" func-doc))))
+       (unless form-p
+         (let ((prog-name (string-trim-left (symbol-name func-or-form)
+                                            "eshell/")))
+           (if (eq (car err) 'wrong-number-of-arguments)
+               (setq msg (format "%s usage: %s" prog-name
+                                 (elisp-get-fnsym-args-string func-or-form)))
+             (setq msg (format "%s: %s" prog-name msg)))))
        (funcall errprint msg))
      nil)))