Re: [code] io.snapopen() not working in Textadept 7.2

From: Ryan Pusztai <rpusztai.att.gmail.com>
Date: Tue, 6 May 2014 14:28:27 -0400

On Tue, May 6, 2014 at 8:14 AM, Mitchell <m.att.foicica.com> wrote:

> Hi Ryan,
>
>
> On Mon, 5 May 2014, Ryan Pusztai wrote:
>
> Hi,
>>
>> I am not able to use
>> `io.snapopen( nil, nil, nil, { title = "Open Current Project", width =
>> ui.size[1] - 100 } )`
>> in the latest version. I tried to debug it and the logic seems good, but
>> "paths" is not getting set. It is always nil even after you set it to
>> "io.get_project_root()". I can't figure out why.
>> I change the code from:
>> if not paths then paths = io.get_project_root() end
>> to:
>> local paths = paths or io.get_project_root()
>> and it works. Can anyone explain why paths is not able to be set? And if I
>> am using io.snapopen() wrong or is this a bug in Textadept?
>>
>
> If you're on Linux or Mac OSX, you can call `_G.print()` from within
> `io.snapopen()` to inspect the arguments passed in order to fully
> understand what is going on; I'm not sure what is wrong.
>

Yes I am doing that. I put a print() before and directly after the `if not
paths then paths = io.get_project_root() end` and 'paths' is still nil. It
is really crazy. I am using TA 7.2 amd64 Ubuntu 13.10 amd64. It seems like
an _ENV issue or a global named "paths" or something. Have you checked it
on your box?

As a follow up to the question in your subsequent e-mail, if you call
> `io.snapopen()` with a `nil` first argument, the current buffer's filename
> or the current directory MUST be under version control, else
> `io.get_project_root()` will return `nil`. The documentation is accurate.
>

Ok. I was not sure which part was accurate, because the parameter docs talk
about it using the buffers.filename path or the current working directory
and so I thought maybe it just passed it through.

> I hope this makes more sense now.
>

Yes

--
Regards,
Ryan
-- 
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 06 May 2014 - 14:28:27 EDT

This archive was generated by hypermail 2.2.0 : Wed 07 May 2014 - 06:26:24 EDT