emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

master 6df535788a2 2/2: Fix usage reporting for Eshell commands


From: Jim Porter
Subject: master 6df535788a2 2/2: Fix usage reporting for Eshell commands
Date: Sun, 8 Dec 2024 23:24:48 -0500 (EST)

branch: master
commit 6df535788a20c9047d33dd8a0c62258597632647
Author: Jim Porter <jporterbugs@gmail.com>
Commit: Jim Porter <jporterbugs@gmail.com>

    Fix usage reporting for Eshell commands
    
    * lisp/eshell/esh-cmd.el (eshell-exec-lisp): Call
    'elisp-get-fnsym-args-string'; the old function was renamed to this.
---
 lisp/eshell/esh-cmd.el | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/lisp/eshell/esh-cmd.el b/lisp/eshell/esh-cmd.el
index 7a146944145..eb922b59a31 100644
--- a/lisp/eshell/esh-cmd.el
+++ b/lisp/eshell/esh-cmd.el
@@ -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)))
 



reply via email to

[Prev in Thread] Current Thread [Next in Thread]