1 ;; Command related functions
6 ((name :type symbol
:initarg
:name
:accessor command-name
)
7 (args :type list
:initarg
:args
:accessor command-args
)
8 (fn :type function
:initarg
:fn
:accessor command-fn
)
9 (doc :type
(or null string
) :initarg
:doc
:accessor command-doc
))
10 (:documentation
"An interactive command."))
12 (defvar *commands
* (make-hash-table)
13 "A hash table of interactive commands")
15 (defmacro defcommand
(name (&optional args
&rest interactive-args
) &body body
)
16 "Create an interactive command named NAME."
21 (setf (gethash ',name
*commands
*)
25 :args
',interactive-args
26 :doc
,(when (typep (first body
) 'string
) (first body
))
29 (defgeneric lookup-command
(name)
30 (:documentation
"lookup the command named NAME."))
32 (defmethod lookup-command ((name symbol
))
33 (gethash name
*commands
*))
35 (defmethod lookup-command ((name string
))
36 ;; FIXME: this can fill the keyword package with lots of junk
38 (gethash (intern (string-upcase name
) "KEYWORD") *commands
*))
40 (defvar *command-arg-type-hash
* (make-hash-table)
41 "A hash table of symbols. each symbol is an interactive argument
42 type whose value is a function that is called to gather input from the
43 user (or somewhere else) and return the result. For instance,
44 :BUFFER's value is read-buffer which prompts the user for a buffer and
47 This variable is here to allow modules to add new argument types easily.")
49 (defvar mark-even-if-inactive nil
50 "*Non-nil means you can use the mark even when inactive.
51 This option makes a difference in Transient Mark mode.
52 When the option is non-nil, deactivation of the mark
53 turns off region highlighting, but commands that use the mark
54 behave as if the mark were still active.")