[code] [textadept] Custom lexer + theme + file extension, all portable

From: Procházka Lukáš Ing. <LPr.att.pontex.cz>
Date: Thu, 30 May 2019 11:17:00 +0200


I am struggling a bit with lexer and theme.

I'm using TA as portable, so my all extensions, experiments, tests and so are located in dir "d:\Lukas\Miscell\TextAdept".

Also, I'm always running TA with -u option, i.e. "textadept.exe -u d:\Lukas\Miscell\TextAdept".
So here I have init.lua (d:\Lukas\Miscell\TextAdept\init.lua).

Suppose I'd like to create a lexer "MyLexer" to be associated with extension ".MyExt" and buffers with "MyLexer" to be shown using "MyTheme" colors.

1. Where should I put the lexer? Into:

        a) d:\Lukas\Miscell\TextAdept\lexers\MyLexer.lua or
        b) d:\Lukas\Miscell\TextAdept\modules\MyLexer.lua or
        c) whereever, but 'package.path' must be adopted so that TA is able to locate "MyLexer.lua"?

2. Do I have load MyLexer explicitly (in the scope of d:\Lukas\Miscell\TextAdept\init.lua) or does TA load MyLexer automatically due to its placing in d:\Lukas\Miscell\TextAdept\lexers (or another dir)?

3. How do I associate MyLexer with files with .MyExt extension?

        Note that in https://foicica.com/textadept/api.html , section "Using Lexers", "Textadept", before "Migrating Legacy Lexers", there is a broken link https://foicica.com/textadept/textadept.file_types.html .

        a) Somehow in d:\Lukas\Miscell\TextAdept\init.lua working with textadept.file_types.patterns?
        b) Handling events.BUFFER_NEW event in d:\Lukas\Miscell\TextAdept\init.lua?

4. How do I apply MyTheme to buffer of a file of .MyExt?

        - Is the theme related to lexer, so when I associate MyTheme with MyLexer (how?), buffers are colored appropriately?

(Sorry for so basic questions, but I'm struggling with these things and I'm not able to deduce them from web manuals.)

Best regards,


Ing. Lukáš Procházka | mailto:LPr.att.pontex.cz
Pontex s. r. o.      | mailto:pontex@pontex.cz | http://www.pontex.cz | IDDS: nrpt3sn | IČO: 40763439
Bezová 1658
147 14 Praha 4
Mob.: +420 702 033 396
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 Thu 30 May 2019 - 05:17:00 EDT

This archive was generated by hypermail 2.2.0 : Thu 30 May 2019 - 06:27:25 EDT