Re: Is it OK to use 'compile' and 'run' for hypertext documents?

From: mitchell <mforal.n....at.gmail.com>
Date: Tue, 6 Apr 2010 19:33:31 -0700 (PDT)

Brian,

On Apr 6, 7:19 pm, Brian Schott <briancsch....at.gmail.com> wrote:
> It would be possible. I've considered making modifications to the code there
> to put the error messages from the compiler in-line in the file through
> Scintilla's annotations:http://www.scintilla.org/ScintillaDoc.html#Annotations

Annotations are tricky. I tried implementing styling for them in
lexers/lexer.lua and modifying run.lua to use annotations. My results
were

1) huge performance penalty: annotations start with a style offset
(scintilla suggests 512). The lexer styles table only has elements up
to [38]. Having annotations starting at [512] makes Lua do a lot of
things internally to support a table up to that size resulting in SLOW
lexer initializations. Having an offset smaller than 256 (or 128; I
don't remember) could clash with lexer styles. An offset smaller than
512 could clash with margin styles. I'm not terribly worried about
margin styles, but I am concerned about lexer styles. Even starting
annotations at [256] or [128] still probably incurs a performance
penalty.

2) Messages for files other than the current one are tricky to deal
with. For each message you have to check if that file is open
(iterating through textadept.buffers), open the buffer if necessary,
then set the annotations. Then when you recompile the original file,
you have to clear all annotations. But what if other files have
annotations from different runs or compiles? Now you have to keep
track of what annotations belong to which run/compile. etc. etc. big
mess I didn't want to deal with.

The solution to (1) would be no styling or doing it from script
(http://www.scintilla.org/ScintillaDoc.html#SCI_ANNOTATIONSETSTYLES
maybe?). (2) is a more complicated beast that I don't have much of a
coherent idea about how to approach.

Don't let this discourage you, but I just wanted to share some info on
what work I've already spent :)

Best,
Mitchell

>
> Does Tidy have a predictable format for its error messages? (That is,
> something that could be matched with a regex to find the line numbers?)
>
> - Brian
>
> On Tue, Apr 6, 2010 at 3:01 PM, phayz <russelldicken....at.gmail.com> wrote:
> > In browsing Textadept's source code - specifically "run.lua" I
> > discovered the customisation options for the 'run' and 'compile' menu
> > options. I wonder if these could be applied to hypertext documents?
> > For example, the 'compile' option could run the Tidy utility, which
> > checks the validity of the document, and the 'run' option could open
> > the document in the user's default web browser. I know that someone
> > recently contributed code for the "open active buffer in user's
> > default web browser" function. My hope is that the Tidy utility's
> > messages could be output to the message buffer and errors on specific
> > lines would allow the user to double click on the message and be taken
> > to the line in which the warning or error occurs. If I understand
> > "run.lua" correctly, this behaviour is native for the 'compile' option
> > for files in various languages.
>
> > Of course anything's possible - particularly with Textadept (:P) - but
> > my main reason for asking was to check if this as an "abuse" of these
> > options. Might there be some sort of horrible side effect in using
> > 'compile' in the way I'm thinking of using it?
>
> > Regards,
>
> > Russell Dickenson
>
> > --
> > You received this message because you are subscribed to the Google Groups
> > "textadept" group.
> > To post to this group, send email to textadept.at.googlegroups.com.
> > To unsubscribe from this group, send email to
> > textadept+unsubscribe.at.googlegroups.com<textadept%2Bunsubscribe.at.googlegroups.com>
> > .
> > For more options, visit this group at
> >http://groups.google.com/group/textadept?hl=en.
Received on Tue 06 Apr 2010 - 22:33:31 EDT

This archive was generated by hypermail 2.2.0 : Thu 08 Mar 2012 - 11:42:26 EST