RE: [code][textadept] Advanced use of Textadept Lexers

From: John Hind <>
Date: Thu, 27 Feb 2014 08:46:55 -0000

Richard, Mitchell,


Any chance of making the spell checker available either as part of Textadept
or as an add-on? As you can probably tell from my previous postings, I could
really do with this! Something (computer) language sensitive would be ideal,
so it only flags spelling in comments and text strings.




From: Richard Philips []
Sent: 27 February 2014 06:02
Subject: Re: [code][textadept] Advanced use of Textadept Lexers


Hello Mitchell,


let us forget - for the time being - about coloring the code: it is too much
related to style and I realise that it just confounds things.


I give another application of the idea:


A few months back I wrote a spelling checker for textadept. One of its
features is scanning the text and red underlining the bad words.


I would like to use the same feature in code as well but it should be
restricted to strings and comments.


I think this problem is not so different as how textadept is styling code;
textadept associates styling information with tokens. In much the same
manner I would like to associate actions with tokens.


Transformations is one usage but others are feasable as well. In the
spelling checker example, the 'M._tokenstyles' alike structure I would use,
is loaded with functions that either do nothing or spellcheck the token.





Again I want to stress that I am not looking for the solution to a specific
problem I have: for both the coloring problem and the spelling problem I
came up with adequate solutions I am quite happy about.


It is just that I noticed that both these problems could be solved in a more
elegant way by using one of the main strengths of textadept: its lexing


Thank you for listening to this,








On Thursday, February 27, 2014, Mitchell <> wrote:

Hi Richard,

On Wed, 26 Feb 2014, Richard Philips wrote:


last week I implemented HTML-ization of source code in textadept.

For documentation purposes, I needed to capture code fragments together
with its colorization and to format it in HTML.

I took a short-cut :-)

Together with the new multiple field ui.dialogs.inputbox (thanks again,
Mitchell :-),
I brought the relevant code fragments and formatting info
outside textadept and worked with the phenomenal Pygments software.
Then I brought the result (HTML) back into textadept and put the HTML in
the clipboard.

But I think I can do better:

I looked into the code of lexer.load and lexer.lex and I think
it should be possible to populate M._tokenstyles with functions instead of
These functions could transform the tokens to text (e.g. HTML).

Is this something worthwhile to pursue? Any ideas about how to proceed?

I'm not sure I follow. Do you have an example that might help me understand?
What would an example transformation be?


You are subscribed to
To change subscription settings, send an e-mail to
To unsubscribe, send an e-mail to
This email is free from viruses and malware because avast! Antivirus protection is active.
You are subscribed to
To change subscription settings, send an e-mail to
To unsubscribe, send an e-mail to
Received on Thu 27 Feb 2014 - 03:46:55 EST

This archive was generated by hypermail 2.2.0 : Thu 27 Feb 2014 - 06:36:05 EST