From nicolas.sceaux at free.fr Sat Apr 19 13:03:08 2008 From: nicolas.sceaux at free.fr (Nicolas Sceaux) Date: Sat, 19 Apr 2008 15:03:08 +0200 Subject: [climacs-devel] Changing a syntax command table on the fly Message-ID: Hi, I'm writing a syntax, which associated command table would be changed by the user, to switch between a normal editing mode, where character keys can be used to insert the characters, and a special edit mode, where character keys are bound to other commands, the later table inheriting from the former. My question is: what is the way to change the command table associated to a syntax on the fly? I see that COMMAND-TABLE is a :reader method for a syntax %COMMAND-TABLE slot, not an :accessor, so I guess there is a reason why changing a syntax command table may not be a good idea, although I could not find it. Nicolas From athas at sigkill.dk Sat Apr 19 13:20:57 2008 From: athas at sigkill.dk (Troels Henriksen) Date: Sat, 19 Apr 2008 15:20:57 +0200 Subject: [climacs-devel] Changing a syntax command table on the fly In-Reply-To: (Nicolas Sceaux's message of "Sat, 19 Apr 2008 15:03:08 +0200") References: Message-ID: <873api2d6u.fsf@lambda.athas.dyndns.dk> Nicolas Sceaux writes: > My question is: what is the way to change the command table > associated to a syntax on the fly? You cannot. I can't fully remember why, but I just don't think it sounds elegant. Instead, you could just define a method on the COMMAND-TABLE generic function for your syntax and return a different command table based on the value of some slot in your syntax. A more general (and complicated) approach is to define a syntax-command-table (a hack connecting a CLIM command table to a CLOS class), which is what I do to enable additional commands in Lisp syntax when running in Climacs. -- \ Troels /\ Henriksen From nicolas.sceaux at free.fr Sat Apr 19 14:08:17 2008 From: nicolas.sceaux at free.fr (Nicolas Sceaux) Date: Sat, 19 Apr 2008 16:08:17 +0200 Subject: [climacs-devel] Changing a syntax command table on the fly In-Reply-To: <873api2d6u.fsf@lambda.athas.dyndns.dk> References: <873api2d6u.fsf@lambda.athas.dyndns.dk> Message-ID: <288DD259-76FA-46E4-95C3-30BD28475C6B@free.fr> Le 19 avr. 08 ? 15:20, Troels Henriksen a ?crit : > Nicolas Sceaux writes: > >> My question is: what is the way to change the command table >> associated to a syntax on the fly? > > You cannot. I can't fully remember why, but I just don't think it > sounds elegant. Instead, you could just define a method on the > COMMAND-TABLE generic function for your syntax and return a different > command table based on the value of some slot in your syntax. A more > general (and complicated) approach is to define a syntax-command-table > (a hack connecting a CLIM command table to a CLOS class), which is > what I do to enable additional commands in Lisp syntax when running in > Climacs. Thanks for your quick answer.