Re: [textadept] Close buffer and unsplit view

From: HyperHacker <hyperhac....at.gmail.com>
Date: Wed, 22 Feb 2012 18:43:04 -0700

On Wed, Feb 22, 2012 at 05:58, mitchell <c....at.caladbolg.net> wrote:
> On Wed, 22 Feb 2012, HyperHacker wrote:
>
>> On Wed, Feb 22, 2012 at 05:26, mitchell <c....at.caladbolg.net> wrote:
>>>
>>> Hi,
>>>
>>>
>>> On Wed, 22 Feb 2012, HyperHacker wrote:
>>>
>>>> I'm trying to make a hotkey to close the current buffer and then
>>>> unsplit the view. This seems simple enough:
>>>>
>>>> keys['csw'] = function() view.buffer:close() view:unsplit() end
>>>>
>>>> But what that ends up doing is closing *all* buffers and not
>>>> unsplitting the view at all! Why is this?
>>>
>>>
>>>
>>> csw is the normal key command to close all buffers. Perhaps your function
>>> is
>>> not being called at all. I ran your code using the command entry and it
>>> worked as expected.
>>>
>>> mitchell
>>>
>>> --
>>> You received this message because you are subscribed to the Google Groups
>>> "textadept" group.
>>> To post to this group, send email to textadept.at.googlegroups.com.
>>> To unsubscribe from this group, send email to
>>> textadept+unsubscribe.at.googlegroups.com.
>>> For more options, visit this group at
>>> http://groups.google.com/group/textadept?hl=en.
>>>
>>
>> Aha, I see, it's defined as cW rather than csw.
>> When I try it now, I get:
>> ...rena/dev/pc/src/textadept/textadept_5.0/core/file_io.lua:267:
>> calling 'check_global' on bad self
>> But it does work in the command entry... strange... I don't see a
>> "local view" in keys.lua, so they should be referring to the same
>> variable?
>
>
> Use _G.view instead of view. view is actually local.
>
>
> mitchell
>
> --
> You received this message because you are subscribed to the Google Groups
> "textadept" group.
> To post to this group, send email to textadept.at.googlegroups.com.
> To unsubscribe from this group, send email to
> textadept+unsubscribe.at.googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/textadept?hl=en.
>

Thanks, that works great.

-- 
Sent from my toaster.
Received on Wed 22 Feb 2012 - 20:43:04 EST

This archive was generated by hypermail 2.2.0 : Thu 08 Mar 2012 - 12:31:47 EST