Re: [code] I need help adding a language-specific snippet

From: Russell Dickenson <russelldickenson.att.gmail.com>
Date: Wed, 8 May 2013 07:29:24 +1000

Mitchell,

You state "Note: under normal circumstances, nobody should be creating an
*init.lua* and a *post_init.lua*. The latter is to take advantage of
existing functionality. The former is for creating non-existant
functionality."

So....
 init.lua is used to *replace* an existing Textadept module's
 post_init.lua is used to *supplement* an existing Textadept module

In my case, where I want to define additional snippets which apply only to
files of type "XML", I create a module post_init.lua, with the code we
agreed on earlier in this thread, and name it "post_init.lua", stored in
<home>/.textadept/modules/xml (on Linux). This module is run *after*
existing Textadept module.

All this makes sense until I re-read your earlier statement, "Even if that
directory exists, Textadept will not recognize it as a module unless it has
an *init.lua* in it."

On 8 May 2013 07:14, Mitchell <m.att.foicica.com> wrote:

> Russell,
>
> On Wed, 8 May 2013, Russell Dickenson wrote:
>
> Mitchell,
>>
>> OK - I am confused again. :(
>>
>> In your latest email message you say that the use of post_init.lua is
>> custom modules which either supplement or replace functionality defined in
>> Textadept's own modules. You also make it clear that you should not create
>> an init.lua *and* an post_init.lua. But earlier in this thread you said :
>>
>> <quote> Sure. When you want to customize the behavior for specific
>> languages, you would normally create a language specific module in your
>> *~/.textadept/modules/[lang]/* folder. Such a module needs to have an
>> *init.lua* file (this is standard Lua practice) that is run when Textadept
>> loads the module. Even if that directory exists, Textadept will not
>> recognize it as a module unless it has an *init.lua* in it. Only when such
>> a module is detected does Textadept then run a *post_init.lua* file. In
>> your case, no XML module was detected so your *post_init.lua* file was
>> never run. </quote>
>>
>> So how can a post_init.lua file be loaded automatically by Textadept if
>> there is no init.lua in the same directory?
>>
>
> Sorry about the confusion. Textadept loads language-specific modules from
> one of two places: it's own *modules/* directory or your
> *~/.textadept/modules/* directory. As long as it finds a module in either
> one, you're good to go and any *post_init.lua* files are loaded.
>
> I hope that clears things up.
>
>
> 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.
>
>

-- 
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 07 May 2013 - 17:29:24 EDT

This archive was generated by hypermail 2.2.0 : Wed 08 May 2013 - 06:53:27 EDT