From: Martin B. <bl...@fu...> - 2006-04-27 05:57:15
|
On 4/19/06, Stefan Merten <sm...@oe...> wrote: > >> [...] Emacs probably can too. If Emacs can't do all you want, it can > >> be added. > > > > Of course, given unlimited time, knowledge, and willpower, you can add > > everything. > > Which gathers over the years you use this editor ;-) . The best time investment I've done in my computing life (apart from reading SICP). > > I would expect that it's very difficult to add folding > > support for reST though. > > > > The last time I tried folding in Emacs for Python code, it was pathetic= , > > really. And reST folding is probably even more difficult because you > > cannot rely on the indentation level, as you can with Python code. > > Folding for reST *is* difficult. Font-locking is difficult enough. > That is if you want to do folding automatically without using any > special markup for it. > > The reason for it is one of reST's greatest strength: It is a syntax > which can be easily understood by humans - but is rather difficult to > understand for machines. > > Well, in ``rst.el`` there is some functionality already which is > probably useful for automatic folding. I love to use folding because > otherwise bigger texts are difficult to maintain and in other modes I > wrote I configured ``outline-mode`` to work. So I'd love if someone > could give it a try for reST on Emacs ;-) . I provide functions that will compute the hierarchy of sections and subsections. If you have the TOC hooks, these are already invoked every time you "adjust" a decoration (pretty much every time you edit or add one). We could easily add a hook to recylce and store the last hierarchy computed along with markers for each decoration, as a side-effect, and then that could be used by the folding code. I don't see any major hurdles with this. Should be relatively easy. (I can't be bothered with folding, personnally, so I won't code it. C-s and registers are your best friends.) cheers, |