Re: [code] How to move from post_init.lua ?

From: Robert Gieseke <rob.g.att.web.de>
Date: Wed, 8 Mar 2017 16:59:20 +0100

Hi Pedro,

I think that's the only way in TA9, as per the docs:

Language Module Handling Changes

Textadept 9 no longer auto-loads a post_init.lua in language modules.
Instead, it must be loaded manually from an events.LEXER_LOADED event.
For example:

events.connect(events.LEXER_LOADED, function()
  if lang == 'ansi_c' then require('ansi_c.extras') end
end)

will load a ~/.textadept/modules/ansi_c/extras.lua “sub-module” for C
files. Keep in mind that Lua’s require() function will only execute
module code once.

If you have a number of post_init.lua files that you want Textadept 9 to
make use of, you can put the following in your ~/.textadept/init.lua:

events.connect(events.LEXER_LOADED, function(lexer)
  if lfs.attributes(_USERHOME..'/modules/'..lexer..'/post_init.lua') then
    require(lexer..'/post_init')
  end
end)

Cheers,
Robert

Am 08/03/17 um 15:54 schrieb Pedro Andres Aranda Gutierrez:
> Hi,
>
> I have a couple of customizations for existing modules. Currently I have
> them in post_init.lua files in my .textadept/modules tree using a hack
> from the WIKI in my .textadept/init.lua to load them. What would be the
> 'proper way' to load my customizations?
>
> /PA
>
> --
> Fragen sind nicht da um beantwortet zu werden,
> Fragen sind da um gestellet zu werden
> Georg Kreisler

-- 
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 Wed 08 Mar 2017 - 10:59:20 EST

This archive was generated by hypermail 2.2.0 : Thu 09 Mar 2017 - 06:32:14 EST