Thank you for the answer. I understand that the way Geany find a folding point is to parse the syntax.
I wonder if Geany had an option to make a folding point *according to the indentation*. This will enable .txt files to be folded in a very sensible way. I also think this would not be technically challenging too much, since Geany already detects indentation fairly well.
Some editors like EditPlus (proprietary, www.editplus.com) have that option, and it is great to get a neat folded view, not only of the code, but also of the results of a program, which often have an arbitrary structure.
Furthermore, you don't even need a syntax file to fold a file of a new type, if you only indented it appropriately.
Maybe I should suggest this as a feature request.
HR Kang.
On Thu, 12 Nov 2009 20:16:53 +0900 Hyoung-Ryul Kang ohthere@gmail.com wrote:
Thank you for the answer. I understand that the way Geany find a folding point is to parse the syntax.
I wonder if Geany had an option to make a folding point *according to the indentation*. This will enable .txt files to be folded in a very sensible way. I also think this would not be technically challenging too much, since Geany already detects indentation fairly well.
Some editors like EditPlus (proprietary, www.editplus.com) have that option, and it is great to get a neat folded view, not only of the code, but also of the results of a program, which often have an arbitrary structure.
Furthermore, you don't even need a syntax file to fold a file of a new type, if you only indented it appropriately.
Maybe I should suggest this as a feature request.
HR Kang.
Hi. One day I wrote some code to achieve this. I don't think the attached patch will be accepted (as it's dirty and ugly :-) ), but it may be useful to someone. The patch is for r4409.
Best regards, Eugene.
On Thursday 12 November 2009 06:16:53 am Hyoung-Ryul Kang wrote:
I wonder if Geany had an option to make a folding point *according to the indentation*. This will enable .txt files to be folded in a very sensible way. I also think this would not be technically challenging too much, since Geany already detects indentation fairly well.
I'm not as familiar with Geany as with SciTE and Scintilla (which is the edit thingie used by Geany)--I know that some of the lexers available for Scintilla do fold based on indentation, and I think that Geany uses (all?) those same lexers.
I share your desire to fold almost plain text files with the extension .txt (I say almost plain text because the ones that I write usually have indentation or other syntax clues that would let a lexer fold them appropriately, and someday I'd expect to make that work for me. (Someday might be a while, as I have a lexer I want / need to write first, and I've been procrastinating lately.)
Anyway, what I might do in your shoes is experiment with the other lexers available in Geany (or SciTE)--identify a lexer, find out what file types (extensions) it "recognizes", then rename your .txt file to use that extension--load it into Geany (or SciTE) and see if the folding meets your expectations. (BTW, the C/C++ lexer--I'll dig out the name in a minute--ahh, LexCpp.cxx) does, iirc, in addition to folding based on C/C++ syntax, also fold based on indentation, so any of the other lexers is worth trying.
If you find a lexer that meets your needs, ask another question on this list, ask how to add the extension ".txt" to the list of extensions that a particular lexer will "recognize". I don't think there's any real reason such a modification could not be made--I suspect it might require a recompilation, and it might be something that you customize for yourself as it may be that no one else is interested (I could be wrong).
I intend that my .txt files will be parsed by my LexTWiki.cxx lexer (which might be renamed before it is written to LexFoswiki.cxx or LexAskRhk..cxx).
BTW, those names are for the lexers in SciTE / Scintilla, I'm not 100% sure that they are not renamed or modified (slightly?) for use in Geany. Somewhere in the documentation there must be a list of the lexers available for Geany and the extensions they recognize.
Hope this helps! Randy Kramer
Some editors like EditPlus (proprietary, www.editplus.com) have that option, and it is great to get a neat folded view, not only of the code, but also of the results of a program, which often have an arbitrary structure.
Furthermore, you don't even need a syntax file to fold a file of a new type, if you only indented it appropriately.
Maybe I should suggest this as a feature request.
HR Kang.
Le Thu, 12 Nov 2009 20:16:53 +0900, Hyoung-Ryul Kang ohthere@gmail.com s'exprima ainsi:
Thank you for the answer. I understand that the way Geany find a folding point is to parse the syntax.
I wonder if Geany had an option to make a folding point *according to the indentation*. This will enable .txt files to be folded in a very sensible way. I also think this would not be technically challenging too much, since Geany already detects indentation fairly well.
Some editors like EditPlus (proprietary, www.editplus.com) have that option, and it is great to get a neat folded view, not only of the code, but also of the results of a program, which often have an arbitrary structure.
Furthermore, you don't even need a syntax file to fold a file of a new type, if you only indented it appropriately.
Maybe I should suggest this as a feature request.
HR Kang.
I find this proposal really sensible.
Denis ------ la vita e estrany