Re: Bugs introduced that affected jde-import-all(better patch for last import has comment bug)
"Eric M. Ludlam" <[email protected]>
| Newsgroups | gmane.emacs.jdee.devel |
|---|---|
| Message-ID | <[email protected]> |
Hi, A relatively new addition to CEDET is SRecode, which is specifically designed for handling code-generation. I know the insert below is really simple, but SRecode could still help. It has a blank space management, and final point destination managment. It specifically knows how to insert tags, so you could do this: (srecode-insert-tag (semantic-tag-new-include "myInclude" nil)) and most of the code I see below in the patch would not be necessary, though you would need to develop an SRecode template for imports (includes). I have a rough one already that would probably need a real java programmer to improve it. What is particularly cool about that, is that it is likely that the jde import code would also work for C/C++, and a range of other languages, thus making CEDET better. (And thus my interest it telling you about this.) The imenu feature in CEDET was adopted out of JDE, so it is a proven path. Eric Paul Landes wrote: > A couple of thoughts while we're touching this code: we might want to > think about separating the buffer modification code with the > parsing/finding insertion point code. As it is now, this code both > finds and returns an offset, but it also has a side affect. We might > get more reuse if we separate it. > > More importantly, we're moving around code that works with semantic and > the new CEDET works a lot differently with JDEE. I speak from > experience while trying to migrate to the new code. For this reason, we > might to create a branch just for these kinds of changes. I hate the > complexity, but we're not in the position to make these changes. I want > to cut a new release soon and I want a release candidate. > > Thoughts? > > > On Jan 8, 2010, at 7:59 PM, Jeff Peck wrote: > >> After seeing some of the other failure modes, >> and taking to heart Paul's concern about extra new-lines, >> (and actually reading the whole method) >> I see that there was serious cruft and heuristics... >> [which could lead to putting the imports *after* the class statement] >> >> So I offer this alternative/improved patch, >> the avoids all the extra newlines, and makes the code more obvious: >> >> >> Index: lisp/jde-import.el >> =================================================================== >> --- lisp/jde-import.el (revision 191) >> +++ lisp/jde-import.el (working copy) >> @@ -232,13 +232,9 @@ >> 'type tags))) >> insertion-point) >> (cond (import-tag >> - (setq insertion-point (+ (semantic-tag-end import-tag) 1))) >> + (setq insertion-point (semantic-tag-end import-tag))) >> (package-tag >> - (save-excursion >> - (goto-char (semantic-tag-end package-tag)) >> - (forward-line) >> - (insert "\n") >> - (setq insertion-point (point)))) >> + (setq insertion-point (semantic-tag-end package-tag))) >> (class-tag >> (setq insertion-point >> (let ((comment-token (semantic-documentation-for-tag >> @@ -248,10 +244,13 @@ >> (semantic-tag-start class-tag))))) >> (t >> (setq insertion-point 1))) >> - (save-excursion >> - (goto-char insertion-point) >> - (unless (and (bolp) (eolp)) (insert "\n"))) >> - insertion-point)) >> + (save-excursion >> + (goto-char insertion-point) >> + (if (eolp) (forward-char 1)(forward-line 1)) >> + (unless (bolp) (insert "\n")) >> + (setq insertion-point (point)) >> + ) >> + insertion-point)) >> >> (defun jde-import-import (class) >> "*Insert an import statement for a class in the current buffer. >> ------------------------------------------------------------------------------ >> This SF.Net email is sponsored by the Verizon Developer Community >> Take advantage of Verizon's best-in-class app development support >> A streamlined, 14 day to market process makes app distribution fast >> and easy >> Join now and get one step closer to millions of Verizon customers >> http://p.sf.net/sfu/verizon-dev2dev _______________________________________________ >> jdee-devel mailing list >> [email protected] <mailto:[email protected]> >> https://lists.sourceforge.net/lists/listinfo/jdee-devel > > > ------------------------------------------------------------------------ > > ------------------------------------------------------------------------------ > This SF.Net email is sponsored by the Verizon Developer Community > Take advantage of Verizon's best-in-class app development support > A streamlined, 14 day to market process makes app distribution fast and easy > Join now and get one step closer to millions of Verizon customers > http://p.sf.net/sfu/verizon-dev2dev > > > ------------------------------------------------------------------------ > > _______________________________________________ > jdee-devel mailing list > [email protected] > https://lists.sourceforge.net/lists/listinfo/jdee-devel ------------------------------------------------------------------------------ This SF.Net email is sponsored by the Verizon Developer Community Take advantage of Verizon's best-in-class app development support A streamlined, 14 day to market process makes app distribution fast and easy Join now and get one step closer to millions of Verizon customers http://p.sf.net/sfu/verizon-dev2dev