>>> Suraj Acharya <sacharya@...> seems to think that:
>Thanks for your answers.
>I've just checked out the code from CVS and it is neat. If you'd like
>I could take a shot at adding the addtional features from my code and
>creating a patch for semantic-fold.el.
I have not spent enough time to decide which is the better
implementation to start from... other than that mine crashes Emacs. ;)
If you think the baseline in semantic-cvs is better, feel free to
>On Fri, 18 Feb 2005 22:27:23 -0500, Eric M. Ludlam
>> That is quite nifty. I wrote one also which is in CEDET CVS only
>> right now, but yours is much niftier. I like the "highlight" that is
>> the line down the side. That is a nice effect. The pre-existing
>> function `semantic-momentary-unhighlight-tag' could do well to emulate
>> In CEDET cvs, you will find new utility functions to make folding
>> easier, including `semantic-set-tag-folded' which works well with
>> isearch. That is in CVS in semantic-decorate.el.
>I'll take a look. Btw, if you set the 'reveal-toggle-invisible
>property on 'semantic-fold you can make the fringe bitmaps when if the
>tag is opened by reveal-mode.
I'm not that familiar with that mode, but the doc makes it sound
>> I my version, if I click on the little + or - in the fringe too
>> much, my Emacs would crash, so I didn't persue it very far as I still
>> need to produce a good bug report.
>> >4) Once semantic-decoration-mode is up and running and all the tags
>> >have been decorated, if I make any edits in a tag it looks like all
>> >the decorations for the tag are deleted and it is sent to the
>> >highlight-default function again. Is there any way for the function to
>> >be called with the old decorations intact so it can remove them only
>> >if it wants to ?
>> [ ... ]
>> I'm not quite sure what you mean. Are you trying to prevent a folded
>> tag from being decorated by other decoration modes? That could be
>> tricky as you probably want to keep some, but disable others.
>What I'm trying to do is quite simple. Currently, if I unfold a tag,
>make some edits inside and then move outside it, then the next time
>the idle-timer kicks in and the tag is reparsed, it gets folded again.
>What I'd like is that it remember the fact that I unfolded the tag and
>not fold it. The simplest way to do this would be to somehow not clear
>the decorations on the tag at all, since any edits would not require
>them to be changed. Perhaps the <decoration-style>-highlight-default
>function could get called only for new tags, while something like
><decoration-style>-update-after-edits could get called when the tag is
>But I don't know much about semantic internals, so this might not make
>sense. In that case I just can store the fold state as an attribute
>on the tag overlay or somewhere else.
[ ... ]
Ah, I see. I used decoration mode to put the markers in the file, but
not to actually fold the tags. Having tag folded or not is a separate
attribute which I placed on the tags using the new function
`semantic-set-tag-folded'. The option of folding all the tags (or
not) is then part of the major mode initialization.
As my version doesn't start stuff out folded, doing so would have
conflicting goals. I've tried to set things up so files are not
parsed until after the buffer is shown, with the exception of tags
loaded in from a database. This conflicts with the goal of forcing
the tags to be folded when the minor-mode starts up.
Loading a file might look like this:
* If no tags from DB, setup a reparse hook
otherwise fold everything.
* file is displayed
* Decide if you want to fold all your new tags.
* remove hook from list.
Does that make sense?
One other thing I noticed:
>Here are a couple other comments I have about your code:
> "Returns non-nil if TAG is to be considered for folding. TAG
> has to have valid start and end locations in the
> buffer. Customize `semantic-tag-folding-allow-folding-of' to
> influence the output of this
> (let ((c (semantic-tag-class tag)))
> (semantic-tag-end tag)
> (semantic-tag-start tag)
You can use `semantic-tag-with-position-p' to find out if the tag has
Eric Ludlam: zappo@..., eric@...
Home: http://www.ludlam.net Siege: http://www.siege-engine.com
Emacs: http://cedet.sourceforge.net GNU: http://www.gnu.org