Re: [code] [textadept]

From: Mitchell <m.att.foicica.com>
Date: Sat, 24 Oct 2015 10:33:49 -0400 (EDT)

Hi,

On Sat, 24 Oct 2015, Robert Gieseke wrote:

> Hi Jay,
>
> I think you need to add to the editing.api_files table for your language
> module.
>
> http://foicica.com/textadept/api.html#textadept.editing.api_files
>
> For example in the built-in "ansi_c" module there is
>
> textadept.editing.api_files.ansi_c = {
> _HOME..'/modules/ansi_c/api', _HOME..'/modules/ansi_c/lua_api',
> _USERHOME..'/modules/ansi_c/api'
> }
>
> If you wanted to add to this table you would need to do this in a
> "post_init.lua" file, search for "Language Module Preferences" in the
> manual.
>
> I think (untested), something like
>
> events.connect(events.LEXER_LOADED, function(lang)
> if lang == 'ansi_c' then
> local api_files = textadept.editing.api_files.ansi_c
> api_files[#api_files + 1] = _USERHOME..'/modules/ansi_c/jay_api'
> end
> end)

There's no need to connect to an event from `post_init.lua`, as that file
is loaded when the ansi_c module is loaded, and only once (think of it as
being appended to the end of Textadept's existing ansi_c module). By
connecting it to the lexer loaded event, you'll be adding that API file
each and every time you open a C file.

All that is needed is to create ~/.textadept/modules/ansi_c/post_init.lua
and put in the following lines:

     local api_files = textadept.editing.api_files.ansi_c
     api_files[#api_files + 1] = _USERHOME..'/modules/ansi_c/jay_api'

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 Sat 24 Oct 2015 - 10:33:49 EDT

This archive was generated by hypermail 2.2.0 : Sun 25 Oct 2015 - 06:26:30 EDT