diff options
author | Tom Willemsen | 2013-03-23 16:37:41 +0100 |
---|---|---|
committer | Tom Willemsen | 2013-03-23 16:37:41 +0100 |
commit | fdce2ed81ca73cc67abffc88615da1ed58b3f502 (patch) | |
tree | c6a0caa014e89ec77290fb9e356213f2f32b40fa /lisp/clark.lisp | |
parent | c7f9d276387028026bfa274e3e6b51e56a9bff5e (diff) | |
download | clark-fdce2ed81ca73cc67abffc88615da1ed58b3f502.tar.gz clark-fdce2ed81ca73cc67abffc88615da1ed58b3f502.zip |
Hide command detail
Hide the fact that a command is just of the form NAME-command by
abstracting it away into a macro.
Diffstat (limited to 'lisp/clark.lisp')
-rw-r--r-- | lisp/clark.lisp | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/lisp/clark.lisp b/lisp/clark.lisp index ed7743f..e85c5c9 100644 --- a/lisp/clark.lisp +++ b/lisp/clark.lisp @@ -30,6 +30,10 @@ (defvar *max-command-name-length* 0 "Lenght of the longest command name.") +(defmacro call-command (name &rest args) + (let ((command-name (make-command-name (symbol-name name)))) + `(,command-name ,@args))) + (defmacro defcommand (name sdoc ldoc &body body) "Define a new command usable on the command-line." (let* ((sname (symbol-name name)) @@ -140,7 +144,7 @@ The executable name should already have been removed." (funcall cmd-name (cdr args)) (progn (format t "Unknown command: ~A~%" (car args)) - (help-command nil))))) + (call-command help nil))))) (defun print-bookmark (bm) "Print information about bookmark BM. @@ -187,7 +191,7 @@ otherwise." ((null ldoc) (format t "Unkown command: ~A~%" (car args))) ((and (symbolp ldoc) (fboundp ldoc)) (funcall ldoc)) (t (format t "~A~%" ldoc)))) - (help-command '("help")))) + (call-command help '("help")))) (defcommand search "Search through bookmarks." |