Re: [code] [textadept] Inheriting from global key mode

From: Robert Gieseke <rob.g.att.web.de>
Date: Tue, 20 May 2014 14:07:11 +0200

Am 20/05/14 13:45, schrieb Robert Gieseke:
> Am 20/05/14 13:09, schrieb Chris Emerson:
>> Hi,
>>
>> On Tue, May 20, 2014 at 01:03:26PM +0200, Robert Gieseke wrote:
>>> Hi,
>>>
>>> is there a way to have a key mode 'inherit' from the global key mode?
>>>
>>> The following setting of a __index metatable does not work:
>>>
>>> keys.TESTMODE = {
>>> ['esc'] = function()
>>> keys.MODE = nil
>>> ui.statusbar_text = 'default keys'
>>> end
>>> }
>>>
>>> setmetatable(keys.TESTMODE, keys)
>>
>> I think this should be:
>>
>> semetatable(keys.TESTMODE, { __index=keys })
>
> Thanks, that was a copy-and-not-quite-paste error -- now it works. I'm
> trying to migrate Textredux to use keys.MODE but the problem seems to
> lie elsewhere
>
> Off to investigate,
> Robert
>
Ok, found it (was already using __index somewhere else :-)

Chris, in textadept-vi, how are you using Textredux? Only from one mode?
When returning from a Textredux buffer, would it be necessary to store
the previous mode or okay to always set keys.MODE to nil (or something
else? When you switch between buffers, do you already keep track of modes?

I hope to release my updates soon

Robert

-- 
You are subscribed to code.att.foicica.com.
To change subscription settings, send an e-mail to code+help.att.foicica.com.
To unsubscribe, send an e-mail to code+unsubscribe.att.foicica.com.
Received on Tue 20 May 2014 - 08:07:11 EDT

This archive was generated by hypermail 2.2.0 : Wed 21 May 2014 - 06:36:01 EDT