From b9c9bd78f1e4f3574de7a47f2d35eee728ea7765 Mon Sep 17 00:00:00 2001 From: Jim Porter Date: Sun, 8 Dec 2024 20:23:46 -0800 Subject: [PATCH] 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. (cherry picked from commit 6df535788a20c9047d33dd8a0c62258597632647) --- 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 0927fd8f087..594d8781e35 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))) -- 2.39.2