On Fri, Aug 6, 2010 at 10:42, Lex Trotman <[email protected]> wrote: > On 6 August 2010 17:46, John Yeung <[email protected]> wrote: >> On Thu, Aug 5, 2010 at 6:54 PM, Jiří Techet <[email protected]> wrote: >>> By coincidence, I have been playing with TextMate under MacOS and it >>> has an extremely elegant system of indent detection, see: >>> >>> http://manual.macromates.com/en/appendix#indentation_rules >> >> It does seem elegant. I actually have wondered why there aren't more >> editors that do this, and I had always thought maybe it was just not >> as fast to use regexes. But I could be wrong, and even if regexes are >> indeed slower, they might certainly be Fast Enough (tm) on today's >> computers. > > Glib regex uses PCRE which seems to have reasonable performance (From > Boost Regex performance comparisons with other regex engines) where > times are sub .001 sec for files about the length of Geany source > files. I'd say that was Fast Enough (C).
That sounds really good. Of course the exact numbers depend on for how long the regex is a candidate to match a line - the results will be better if it fails on the first character in every line than on the last character. But since we will be matching against a single line, this should be a non-issue. > >> >>> Some observations from playing with TextMate: >>> 1. increaseNextLinePattern is not normally used, see >>> >>> http://ticket.macromates.com/show?ticket_id=425D3D1C >>> >>> so we could drop it. >> >> I disagree. The bracketless if-statement (or other single-line >> "blocks") is extremely common, and SciTE has relatively ugly code just >> to handle that case. >> >>> 2. decreaseIndentPattern appears to be matched against the current >>> line after every single keypress (e.g. once you type ':' in "elsif:" >>> in python, the line containing it unindents). Apparently regex >>> matching is fast enough to do this. The other patterns are matched >>> only when enter is pressed. >> >> Well, Python uses elif, not elsif. But aside from that, Python is a >> very special case. It would be more natural for Python to not have >> any automatic decreases, since your elif might apply to not the latest >> if but rather a previous one (more than one level deep). In Python, >> it really makes sense for the programmer to explicitly decide the >> amount of de-indentation, > > I agree with that, Geany does my Python fine because it doesn't get in > the way, but some may like additional "help". So long as I can turn > it off per language too. > > and Python programmers are used to making >> this decision for every single block. It would be very weird to have >> elif be an oddball that doesn't fall in line with everything else in >> the language. >> >> For the record, Python should be a very easy language to get right >> with the autoindentation, and it is kind of surprising how many >> editors still manage to mess it up. If I recall correctly, last time >> I used Geany (several versions ago), it handled Python quite well >> (either perfectly, or only quite unlikely situations could mess it >> up). >> >>> I wonder how much illegal/unethical it is to copy >>> configuration options from a commercial editor... >> >> In my opinion, it is not unethical at all. I would not want to be a >> part of copying or stealing someone else's not-open-source source >> code, but I have no problem with the idea of reimplementing a >> published spec. I don't know if the law agrees with me. > > Too complicated since it is likely that it depends on which country > you are in as to legality. But I would observe that there is likely > to be only one optimal regex for each language for each setting so > even from first principles you will likely get the same answer ;-) Well, after some more exploration this looks quite good. The bundles SVN for TextMate is here: http://svn.textmate.org/trunk/ and the license says this: http://svn.textmate.org/trunk/LICENSE Under tags you can find settings for all the files: http://svn.textmate.org/tags/release_1.1b5/ including indentation settings. So I think we could use it, at least as a base for further customization if we are not satisfied with the settings. Cheers, Jiri > > Cheers > Lex > >> >> John >> _______________________________________________ >> Geany mailing list >> [email protected] >> http://lists.uvena.de/cgi-bin/mailman/listinfo/geany >> > _______________________________________________ > Geany mailing list > [email protected] > http://lists.uvena.de/cgi-bin/mailman/listinfo/geany > _______________________________________________ Geany mailing list [email protected] http://lists.uvena.de/cgi-bin/mailman/listinfo/geany
