[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How should I make the USER command-table inherit from another one?



My desire was somewhat different, but similar to what you did.  I have a
frame in which I wanted to inherit all the standard commands but also
use my own commands.  That's standard enough.  However, some of the
commands are only appropriate at the top level loop of my frame (ie, in
a known state) and others are appropriate anytime (eg, changing the
trace level in the middle of running).  So I rebind the command table
for the normal READ-EVAL-PRINT loop and debugger loop to a command table
that inherits both from Global and my Basic-Tacitus command table while
my command table for my top level loop also inherits from that.

If the user types C-M-Suspend or M-Suspend during running he still has
the appropriate commands available to him.  (The command menu that I fabricate
will have some items mouse-sensitive and some not.)

;;;1 This will also have the commands that are usable other than at the top level
0(defvar 2*BASIC-TACITUS-COMMAND-TABLE* 
0	(cp:make-command-table "BASIC-TACITUS"
			       :INHERIT-FROM nil))

;;;1 This will have all the commands that are usable at the top leve of Tacitus
0(defvar 2*TACITUS-COMMAND-TABLE* 
0	(cp:make-command-table "TACITUS"
			       :INHERIT-FROM '("global" "BASIC-TACITUS"
					       #|| "Modified full command" ||#
					       "standard arguments" "standard scrolling")
			       :KBD-ACCELERATOR-P 'T))

;;;1 This will be the one used in the debugger inside Tacitus.  Add some tacitus commands
0;;;1 to the debugger
0(defvar 2*TACITUS-DBG-COMMAND-TABLE* 
0	(cp:make-command-table "TACITUS-DBG"
			       :inherit-from (if (status feature rel7.2-beta)
						 '("BASIC-TACITUS" "Lisp-Debugger")
						 '("BASIC-TACITUS" "Debugger"))))

;;;1 This command table is like GLOBAL but it has the tacitus commands in it.  Useful in
0;;;1 SUSPENDs under the tacitus window
0(defvar 2*TACITUS-GLOBAL-COMMAND-TABLE*
0	(cp:make-command-table "TACITUS-GLOBAL"
			       :inherit-from '("global" "Basic-Tacitus")))

Here's the code that binds things....

    ;;3 Bind the command tables used by an inferior command-loop or the debugger to use theirs plus ours
0    (sys:standard-value-let ((cp:*command-table* *tacitus-global-command-table*))
    (let-if (status feature rel7.2-beta) ((dbg:*lisp-debugger-comtab* *tacitus-dbg-command-table*))
      (let-if (not (status feature rel7.2-beta))  ((dbg:*debugger-cp-comtab* *tacitus-dbg-command-table*))
    (error-restart-loop ((error sys:abort) "Tacitus Command Loop")
      (setq inputLine (multiple-value-list (TOPLEVEL-Read interaction-pane)))	;3 Read & catch mouse and
0						;3 menu blips
0etc...