Re: [code] cpp post_init.lua

From: Ryan Pusztai <rpusztai.att.gmail.com>
Date: Mon, 17 Mar 2014 09:27:28 -0400

Hi Mitchell,

On Fri, Mar 14, 2014 at 5:01 PM, Mitchell <m.att.foicica.com> wrote:

> 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
>

I did that and it doesn't seem to load my "init.lua" file. Should it be
'~/.textadept/module/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 :(

This makes sense.

 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

OK. I changed this in my updated "init.lua". But I have not been able to
test this because it does not get "loaded" yet.

> 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.

OK.

I also have another part of the file that I think needs to change and that
is the context_menu per language. I read the manual, but it is not clear to
me how to show a specific right-click menu based on what file type is
loaded.

I was using
  _M.cpp.context_menu =
  {
  }
and that doesn't work either. Can you help me with that too?

Thanks.

--
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 Mon 17 Mar 2014 - 09:27:28 EDT

This archive was generated by hypermail 2.2.0 : Tue 18 Mar 2014 - 06:50:32 EDT