From 8ba3b1eb5ef4e1b14732bdfc961b6756c0123641 Mon Sep 17 00:00:00 2001 From: Scott Wolchok Date: Thu, 8 May 2008 17:13:21 -0400 Subject: [PATCH] Fixed describe-command; help when called with argument runs describe-command. --- user.lisp | 22 ++++++++++++++++++---- 1 files changed, 18 insertions(+), 4 deletions(-) diff --git a/user.lisp b/user.lisp index c3b3f89..517f0c0 100644 --- a/user.lisp +++ b/user.lisp @@ -1035,7 +1035,7 @@ string between them." finally (return c)))) (defun call-interactively (command &optional (input "")) - "Parse the command's arguments from inputgiven the command's + "Parse the command's arguments from input given the command's argument specifications then execute it. Returns a string or nil if user aborted." (declare (type (or string symbol) command) @@ -1203,9 +1203,19 @@ is using the number, then the windows swap numbers. Defaults to current group." (mapcar 'print-key-seq (search-kmap kmap-var *top-map*)) (columnize data cols)))) -(defcommand help () () +(defun get-command-structure-or-die (command) + "Return the command structure for COMMAND; throw an error if not +found." + (or (get-command-structure command) + (throw 'error (format nil "Command '~a' not found." command)))) + +(defcommand help (&optional com) (:rest) "Display all the bindings in @var{*root-map*}." - (display-keybinding '*root-map*)) + (if com + (progn + (check-type com string) + (describe-command com)) + (display-keybinding '*root-map*))) (defcommand commands () () (let* ((screen (current-screen)) @@ -1946,7 +1956,11 @@ command prints the command bound to the specified key sequence." (defcommand describe-command (com) ((:command "Describe Command: ")) "Print the online help associated with the specified command." (message-no-timeout "Command \"~a\":~%~a" com - (documentation (get-command-structure com) 'function))) + (documentation (progn + ;is it really a command? + (get-command-structure-or-die com) + (get-command-symbol com)) + 'function))) (defcommand where-is (cmd) ((:rest "Where is command: ")) "Print the key sequences bound to the specified command." -- 1.5.5.1