From fdce2ed81ca73cc67abffc88615da1ed58b3f502 Mon Sep 17 00:00:00 2001 From: Tom Willemsen Date: Sat, 23 Mar 2013 16:37:41 +0100 Subject: [PATCH] Hide command detail Hide the fact that a command is just of the form NAME-command by abstracting it away into a macro. --- lisp/clark.lisp | 8 ++++++-- 1 file 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."