Re: [ECB-list] Using the partial reparse hook within ECB! (was: AW: ECB2.40 released!)
[email protected] Wed, 20 May 2009 08:04:26 -0500
| Newsgroups | gmane.emacs.cedet,gmane.emacs.code-browser |
|---|---|
| Message-ID | <[email protected]> |
[email protected] seems to think that: > Hi Eric, > > Wow, sounds pretty good... But first some questions: [...] > Q1: There is a comment that these functions are for internal use > only - what does this mean for ECB? Is it reliable when ECB uses > these functions for that needs you suggested?? Ah. They are marked as internal. I haven't given that too much thought since this was first written. I've been using tag properties for miscellaneous things that might not be considered private. Let's figure out what you want to do in specifics, and then I'll make an API for that that is not considered private. For example, there is semantic-tag-add-hook and semantic-tag-remove-hook. Ther are some special hooks you can apply to a tag so you can find out when "stuff" happens to it. There is also semantic-add-label and semantic-show-label which seem like some high-level hacks that never got used. If these existing functions work fine, then that is ok too. ECB and CEDET have always been closely related, and that API is unlikely to change. > Q2: Are these the right functions - which ones i would need - i > assume semantic--tag-put-property and semantic--tag-get-property - > what about semantic--tag-put-property-no-side-effect? If i have > undrestood you in the right way, this is not the right one for my > needs, right? You want to take the raw tag directly from the buffer and use the put/get functions, and not use the 'no-side-effect' function. That way you will get your properties back out of the buffer again later. > Q3: are properties stored permanantly in the semanticdb and > semantic.caches? I assume not. So when a buffer is opened then all > tags are without any private properties right? Just to get sure, is > fine for me and ECB No properties are saved in the persistent database file except for those used by the parsing engine. Properties also get flushed if a full reparse of a buffer occurs. > Q4: is there any example out for the right usage of these functions, > ie. A "real live" example? ;-) In the info-manual of semantic i > fund only the function-description, i.e. there docstrings.... There are the simple add/remove hook functions and add/show label I mentioned above. There is also semantic-foreign-tag-p and semantic-tag-file-name that use these properties. There is semantic-decorate.el which stores overlay information. cogre-mode.el uses properties to tie cogre nodes to tags. semantic-symref.el uses properties to store some statistical information. They are meant to be like 'get' and 'put' in usage. > Q5: my approach would be: > 1. i add to semantic-after-partial-cache-change-hook and > semantic-after-cache-change-hook the same function which always gets > the full tag-list after a reparse (maybe from the semantic-cache or > fully reparsed, anyway) > 2. This function creates for each tag an appropriate tree-node and > adds the identifier for this tree-node as property-value for a new > ECB-property like 'ECB-tree-node which indicates, that this tag is > displayed in the tree-buffer and in which tree-node. After that this > property is stored in the tag itself, right? The modified tag is > stored in the :data-slot the tree-node itself. > 3. Then i build up the tree-buffer of ECB based on the tree-nodes of > step 2 und display the tree-buffer > <4. the user does some editing> > 5. some tags are updated by semantic > 6. The hooks of step 1 above are called and ECB gets again the full > tag-list for current source-buffer > 7. i check if a tag contains the ECB-property 'ECB-tree-node and get > so the information if the tag is currently already represented by a > tree-node and by which tree-node - if yes, then i can easily update > the tree-node with the modified tag-data .... > > Is this somehow right, is it that what you want to suggest? If yes, > then this is pretty cool idea and should be not so hard to > implement... Yes, this is what cogre does in one of its code generation steps. One difference is that if a full reparse occurs, all the property information is flushed. I've often wondered how to recover the property information after a reparse. It might be possible, but it has not been attempted. Good Luck Eric ------------------------------------------------------------------------------ Crystal Reports - New Free Runtime and 30 Day Trial Check out the new simplified licensing option that enables unlimited royalty-free distribution of the report engine for externally facing server and web deployment. http://p.sf.net/sfu/businessobjects