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

From: John Hind <john.hind.att.zen.co.uk>
Date: Thu, 27 Feb 2014 15:18:09 -0000

Thanks Richard,

 

I'm using Textadept on Windows 8.1 (mainly). I normally do not bother with
the JIT because I'm used to Lua 5.2 for my own projects, but no reason why I
should not if it is essential.

 

Would be happy to give it a go and report back, even if it does involve a
bit of work.

 

- John

 

From: Richard Philips [mailto:richard.philips.att.gmail.com]
Sent: 27 February 2014 09:10
To: code.att.foicica.com
Subject: Re: [code][textadept] Advanced use of Textadept Lexers

 

Hello John,

 

 

I do not mind at all and in fact, I just wrote an e-mail to Mitchell about
how to contribute code.

 

 

You should understand that the code I write for textadept is part of a whole
suite of applications and so it is not so easy for me to separate.

 

But first let me give you some idea what the spellchecker is about:

 

- it is based on hunspell: the hunspell libraries and dictionaries should be
available on your system

- it is tested/used on Ubuntu 13.10 (but I think it should work on OSX en
Windows as well)

- You have to use textadeptjit (so, there is no compilation involved!)

- you can easily add your own words (these are kept in a text file which is
shared - by Dropbox - over all computers I work with)

- support for multiple languages in one file

- underline bad words, search bad words, double click for a pop-up with
alternatives, goto-next-bad-word

 

I'll try to come up with a solution to provide you with the code.

(The simplest solution would be that I give you my ~/.textadept directory)

 

On which platform are you using textadept ?

 

 

Richard

 

 

 

 

 

 

 

 

On Thursday, February 27, 2014, John Hind <john.hind.att.zen.co.uk> wrote:

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.

 

John.

 

From: Richard Philips [mailto:richard.philips.att.gmail.com
<javascript:_e(%7B%7D,'cvml','richard.philips.att.gmail.com');> ]
Sent: 27 February 2014 06:02
To: code.att.foicica.com <javascript:_e(%7B%7D,'cvml','code.att.foicica.com');>
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.

 

 

Mitchell,

 

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

 

Thank you for listening to this,

 

Richard

 

 

 

 

 

On Thursday, February 27, 2014, Mitchell <m.att.foicica.com
<javascript:_e(%7B%7D,'cvml','m.att.foicica.com');> > wrote:

Hi Richard,

On Wed, 26 Feb 2014, Richard Philips wrote:

Hi,

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

Cheers,
Mitchell

-- 
You are subscribed to code.att.foicica.com
<javascript:_e(%7B%7D,'cvml','code.att.foicica.com');> .
To change subscription settings, send an e-mail to code+help.att.foicica.com
<javascript:_e(%7B%7D,'cvml','code%2Bhelp.att.foicica.com');> .
To unsubscribe, send an e-mail to code+unsubscribe.att.foicica.com
<javascript:_e(%7B%7D,'cvml','code%2Bunsubscribe.att.foicica.com');> .
 
  _____  
 <http://www.avast.com/> Image removed by sender.
This email is free from viruses and malware because avast! Antivirus
<http://www.avast.com/>  protection is active. 
 
---
This email is free from viruses and malware because avast! Antivirus protection is active.
http://www.avast.com

-- 
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.
_WRD000.jpg
Received on Thu 27 Feb 2014 - 10:18:09 EST

This archive was generated by hypermail 2.2.0 : Fri 28 Feb 2014 - 06:36:11 EST