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

From: Mitchell <m.att.foicica.com>
Date: Tue, 6 May 2014 08:14:13 -0400 (Eastern Daylight Time)

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.

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.

I hope this makes more sense now.

Cheers,
Mitchell

-- 
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 - 08:14:13 EDT

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