Re: [CEDET-devel] semanticdb-javap not working
Brought to you by:
zappo
From: Eric M. L. <eri...@gm...> - 2012-02-05 17:23:22
|
On 01/24/2012 02:11 AM, Joel Borggren-Franck wrote: > On Tue, Jan 24, 2012 at 2:10 AM, Eric M. Ludlam<eri...@gm...> wrote: [...] >> Is there a way find /your/path/to/rt.jar programatically? I could use some >> ubuntu packager to look it up, but I think it would be much nicer if Emacs >> could auto-detect this file by default in some platform independent way. Or >> maybe there are just 3 common locations to check for windows, linux, and >> mac? >> > > Yes and no. Chances are you have multiple JDKs installed, which should > emacs chose? Also, there is one location on win (probably C:\Program > Files\Java\...) one or more on mac > (/Library/Java/JavaVirtualMachines/...) and Linux distributions > probably hasn't agreed where to put it if you use the package manager > (apt/yum) or you might have installed an Oracle bunde (/opt/? > /usr/local/?)? So yes, it can be done, but it's a pain. > > But here is a list to get you started looking: > - Oracle supplied bundle: JAVA_HOME/jre/lib/rt.jar > - Mac OS X JDK 6: > /Library/Java/JavaVirtualMachines/1.6.0_29-b11-402.jdk/Contents/Classes/classes.jar > - Max OS X Oracle JDK 7 Preview: /Library/Java/JavaVirtualMachines/JDK > 1.7.0 Developer Preview.jdk/Contents/Home/jre/lib/rt.jar > - On Windows JAVA_HOME is usually a variation of C:\Program Files\Java ... Does anyone know if there is an existing Emacs tool/lib that knows this stuff? It looks like a maintenance problem I'll have trouble keeping up with. Alternately, some of this setup could live in cedet-java as useful data for any tooling. > Btw, you could possibly refine the regexp in the patch to search for > and replace either "class " or "interface " as a prefix, and only use > one re-search-forwad, but I couldn't figure out how emacs want's its > regexp. Regarding your patch, yes, below is a short form that I didn't test. === modified file 'semantic/semanticdb-javap.el' *** semantic/semanticdb-javap.el 2012-01-21 16:23:12 +0000 --- semantic/semanticdb-javap.el 2012-02-05 17:17:41 +0000 *************** *** 891,896 **** --- 891,904 ---- (goto-char (point-min)) ;; The first line says "Compiled from ..." or some-such. (insert "// ") + + ;; strip out fully qualified part of class- and interface names + (save-excursion + (goto-char (point-min)) + (while (re-search-forward "\\(class\\|interface\\) \\([^\\. ]*\\.\\)+" nil t) + (replace-match "\\1 ")) + ) + ;; Enable java mode and semantic parsing. (java-mode) (semantic-new-buffer-fcn) Should it really replace it with something more like: (replace-match "package \\2;\n\\1 ") where it adds in the package statement that is made up of the package of the class in the file? Thanks Eric |