I've been working on a semantic-decoration style which allows tags to
be folded and unfolded, and uses fringe bitmaps to indicate where the
tags are.

http://www.emacswiki.org/elisp/semantic-tag-folding.el

>From the commentary :

;;; Defines a `semantic-decoration-mode' style which allows semantic
;;; tags to be expanded or collapsed in the style of folding mode and
;;; hideshow mode. In addition to regular semantic tag, comments
;;; preceeding tags can also be folded, and consecutive 'include tags
;;; are folded as a single unit.
;;;
;; Features:
;; 1. Indicators in the fringe to show which tags which can be
;;    expanded or hidden, clicking on the fringe symbols toggles the
;;    associated block's state
;; 2. `semantic-tag-folding-allow-folding-of' lets you customize which
;;    tags can be folded, and which of those tags are folded by
;;    default when this mode is first activated.
;; 3. hs-mode style commands to hide and show all tags or only the
;;    current tag.
;;    

It's been mainly tested on cvs emacs for windows (nqmacs). It works
with reduced functionality on older emacs versions (those without
define-fringe-bitmap, and probably
not at all under XEmacs. 

I went a bit overboard with the fringe bitmaps - customizing
`semantic-tag-folding-fringe-image-style' lets you select between 1)
'plusminus, where a little plus in the fringe indicates that a tag is
folded on that line, and it changes to a small minus when the tag is
unfolded, and 2) 'triangles, where the folded and unfolded symbols are
eclipse style horizontal and vertical triangles. Setting
`semantic-tag-folding-momentarily-highlight-tags-on-expand' to t will
enable a brief animation in the fringe when a tag is unfolded to
indicate its extent.

Eric,  I have a couple of questions about semantic-decorate-mode:

1)  The definition of semantic-decoration-styles seems to be missing a
:require attribute for semantic-decorate-mode. Currently, if I try to
customize its value, after starting up emacs I end with each style
listed twice in semantic-decoration-styles.

2) I need to add a keybinding for clicking on the fringe for this
mode, it would be nice if there was key map for
semantic-decoration-mode.

3) What is a good way to enable semantic-decoration-mode by default ? I tried
(add-hook 'jde-mode-hook 'semantic-decoration-mode) but it complains
"Buffer Foo.java was not set up for parsing".

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 ?


Suraj

Reply via email to