Re: SOLVED - problem loading personal init.lua under Windows XP

From: mitchell <mforal.n....at.gmail.com>
Date: Tue, 23 Mar 2010 18:40:23 -0700 (PDT)

Hi,

> In another thread (about the future of the Project Manager) I asked
> how the PM might be hidden. To do this required a line be added to a
> personal copy of init.lua. As I describe below I had trouble with this
> and couldn't work out why. I couldn't get much in the way of an error
> message because a GTK error dialog was appearing but I couldn't see
> the very bottom of the dialog box. To cut a long story short, though I
> finally realised what the problem was - my personal init.lua file (an
> exact copy of the distributed one) had the following line:
>
> local user_init = _USERHOME..'/init.lua'
>
> When I ran TA it was concatenating the contents of _USERHOME (which
> was a valid folder path) with text that contained a forward slash,
> which is invalid in a Windows path. I changed the line to the
> following and TA now starts as expected.
>
> local user_init = _USERHOME..'\init.lua'
>
> I don't know whether or not this is a bug but I thought I would
> document my solution here rather than continue it in the "Future plans
> for the Project Manager" thread so that it's more obvious and in case
> it helps someone else.

Actually, _USERHOME..'\init.lua' doesn't exist and isn't loaded, thus
giving no error. This is because of how escape characters are handled
in lua. '\\' counts for one '\', so '\\init.lua' would be interpreted
as a windows path. The fault lies in your init.lua. You do not want to
copy ta's init.lua verbatim, only the 'require' statements if they
differ. Add the textadept.pm.width = 0 line in ta's init.lua, not your
own. A future version of ta will not have the pane, and this line
will no longer be needed.

Mitchell

>
> Note that as I am a complete newbie when it comes to TA, I can't
> guarantee that this is the right solution, nor that it won't cause
> other problems.
>
> For completeness sake I have included below what I hope is a relevant
> extract from the other thread in which I described my problem.
>
> >>> EXTRACT STARTS HERE
>
> On Mar 12, 2:00 pm, mitchell <mforal.n....at.gmail.com>  wrote:
>
> > Hi,
> > > Ummm... where would I add the line "pm.width = 0"? I copied the
> > > original init.lua into my ~.textadept directory and tried adding the
> > > line in several locations but couldn't find the right spot.
> > Oops I was wrong. If you set its width to zero and close ta, it is
> > stored in the session. If you modify ta's init.lua at the end of the
> > command line section and add textadept.pm.width = 0, any session width
> > will be overridden.
> > Mitchell
>
> Mitchell,
>
> Sorry, but I need more help with this. If I modify the init.lua
> shipped with TA as follows, I get the desired result -
>
>     -- read only the Project Manager session settings
>     if not _m.textadept.session.load(nil, true) then
>       textadept.pm.entry_text = 'buffers'
>       textadept.pm.activate()
>     end
>   end
>   textadept.pm.width = 0
>
> But if copy the init.lua shipped with TA and make add the
> "textadept.pm.width = 0" line in the same position, I get a LONG GTK
> error dialog box filled with the following text - "C:\z\downloads
> \textadept\init.lua:19". Note that the TA window still appears, but
> it's obscured by the GTK error dialog box. I am trying to make the
> change to the copy of the init.lua as per the instructions on the
> following page -http://caladbolg.net/luadoc/textadept2/manual/6_Startup.html
>
> After looking at the distributed init.lua file and line 19, I'm
> guessing that something's going wrong with the call to the personal
> init.lua but I don't understand just what.
>
> Any advice would be welcome.
>
> Regards,
>
> Russell Dickenson
Received on Tue 23 Mar 2010 - 21:40:23 EDT

This archive was generated by hypermail 2.2.0 : Thu 08 Mar 2012 - 11:40:45 EST