From: Jim Porter Date: Mon, 9 Dec 2024 04:23:46 +0000 (-0800) Subject: Fix usage reporting for Eshell commands X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=b9c9bd78f1e4f3574de7a47f2d35eee728ea7765;p=emacs.git 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) --- 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)))