Re: [code] cpp post_init.lua

From: Mitchell <m.att.foicica.com>
Date: Fri, 14 Mar 2014 17:01:30 -0400 (Eastern Daylight Time)

Hi Ryan,

On Fri, 14 Mar 2014, Ryan Pusztai wrote:

> Hi Mitchell,
>
> On Fri, Mar 14, 2014 at 4:17 PM, Mitchell <m.att.foicica.com> wrote:
>
>> I am sure I am doing something wrong, but I don't get my C++ files (i.e.
>>> *.cpp, *.h, *.hpp. and *.cxx) to load a cpp post_init.lua file anymore. I
>>> think that the I saw in 7.1 that
>>> * Split C/C++ lexer into separate lexers and replaced default "cpp"
>>> module with "ansi_c".
>>> happened. I have the post_init.lua file in "~/.textadept/cpp/post_init.
>>> lua".
>>>
>>> Did I miss anything? I thought this would still load after the change
>>> referred to above.
>>> Any ideas? Does the 'cpp' directory need to be renamed 'ansi_c'? I though
>>> that was only for C.
>>>
>>
>> Since Textadept's `modules/cpp/` module was renamed to `modules/ansi_c/`,
>> there is no more "cpp" module and thus your `post_init.lua` will not load.
>> If you rename it to `init.lua`, it should load as a full blown module. You
>> might have to tweak it if it depended on tables like "keys.cpp" to exist,
>> though. Let me know if that doesn't help.
>>
>
> So to be clear I will:
> - rename ~/.textadept/cpp/post_init.lua -> ~/.textadept/ansi_c/init.lua

Sorry for the confusion. No, you will simply rename `post_init.lua` to
`init.lua` such that you have:

    ~/.textadept/cpp/init.lua

The original cpp module does not exist anymore. Thus, when you load a .cpp
file or similar, Textadept cannot find a `modules/cpp/init.lua` to load.
Therefore, it will not load your `modules/cpp/post_init.lua` because it
never loaded the main `init.lua` in the first place.

On a side note: If you were to create an
`~/.textadept/modules/ansi_c/post_init.lua`, then since Textadept has a
`modules/ansi_c/init.lua`, it would load your `post_init.lua` upon
loading an ANSI C file (.c).

I hope this makes a bit more sense. It's Friday afternoon and I'm tired :(

> but I do use "keys.cpp" heavily, so should it be changed to "keys.ansi_c"?

Nope, if you have something like:

    keys.cpp.foo = bar

Just put a 'keys.cpp = {}' first:

    keys.cpp = {}
    keys.cpp.foo = bar

> Does "post_init.lua" support still exist? Did I miss this change in the
> manual?

Yes it does. The manual (I think) states somewhere that post_init.lua will
ONLY be loaded if an init.lua was loaded first.

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 Fri 14 Mar 2014 - 17:01:30 EDT

This archive was generated by hypermail 2.2.0 : Sat 15 Mar 2014 - 06:30:51 EDT