Re: jde-import commands and GNU Emacs-22/23
On the Mac jde should be looking for Classes/classes.jar in your JVM directory (see thedefinition of jde-get-tools-jar in jde.el). Check that you have this file and thatsystem-type is 'darwin.Suraj On 10/4/05, Adrian Robert [EMAIL PROTECTED] wrote: Small update:First problem (jde-import-kill-extra-imports) goes away on emacs-21.3text terminal version bundled on MacOSX.So maybe something hasaffected the lisp code in either cedit, ellib, or jde in emacs 22/23.Second problem (finding developer tools jar) remains.On Oct 4, 2005, at 1:53 PM, Adrian Robert wrote: Hi, Problem: if I try jde's 'import' commands they don't work. jde-import-kill-extra-imports gives: Wrong type argument: arrayp, 5 Stack trace: Debugger entered--Lisp error: (wrong-type-argument arrayp 5) substring(5 0 2) (let* ((import ...) (name ...) (classname ...) (case-fold-search nil) (number-of-matches ...)) (if (or ... ... ...) (setq extra- imports ...) (setq required-imports ...))) (while imports (let* (... ... ... ... ...) (if ... ... ...)) (setq imports (cdr imports))) (save-excursion (goto-char 0) (while imports (let* ... ...) (setq imports ...)) (if (not extra-imports) (message No extra imports found) (let ... ... ... ...))) (let* ((packages ...) (package-imports ...) (first-import ...) extra-imports required-imports) (save-excursion (goto-char 0) (while imports ... ...) (if ... ... ...))) (if (not imports) (message No import found) (let* (... ... ... extra-imports required-imports) (save-excursion ... ... ...))) (let* ((tags ...) (imports ...)) (if (not imports) (message No import found) (let* ... ...))) jde-import-kill-extra-imports(nil) jde-import-all gives: Cannot find JDK's tools jar file (or equivalent). For this latter, I customized my JDK registry (see below) and jde- jdk is set to a directory under which lib/dt.jar can be found.I also tried copying this to tools.jar in the same dir. Most other import commands generate one or the other of these errors.(-collapse is an exception.) I've tried both a month-old Emacs 22 (Aquamacs) and a 1-week-old Emacs unicode-2 branch version of GNU emacs, with jde-2.3.5 cedet 1.0beta2b -or- cedet 1.0beta3b elib-1.0 downloaded from jdee.sunsite.dk All are non-byte-compiled. I used a minimal .emacs: (setq load-path (cons /usr/local/share/emacs/site-lisp load-path)) (add-to-list 'load-path (expand-file-name /usr/local/share/emacs/ site-lisp/elib)) (load-file /usr/local/share/emacs/site-lisp/cedet-1.0beta2b/common/ cedet.el) (setq load-path (cons /usr/local/share/emacs/site-lisp/jde-2.3.5/ lisp load-path)) (require 'jde) (custom-set-variables ;; custom-set-variables was added by Custom. ;; If you edit it by hand, you could mess it up, so be careful. ;; Your init file should contain only one such instance. ;; If there is more than one, they won't work right. '(jde-jdk-registry (quote ((1.4.2 . /System/Library/Frameworks/ JavaVM.framework/Versions/1.4.2/Home) (custom-set-faces ;; custom-set-faces was added by Custom. ;; If you edit it by hand, you could mess it up, so be careful. ;; Your init file should contain only one such instance. ;; If there is more than one, they won't work right. ) Any clues appreciated.Is anyone using jde-import commands successfully with either a Macintosh and/or GNU Emacs CVS 22 or 23?If so, which jde/cedet/elib versions, and is there anything else I should know? Alternatively, if anyone has successfully gotten an older version of jde running in emacs-20 recently, that would also be helpful (again, which jde/semantic/eieio/speedbar/elib)? thanks..
Re: Random Keyboard Language Change
The culprit is C-\ or toggle-input-method. I used to do this all the time, until I did a describe-key on C-\ while looking for a short unused key sequence I could bind something to. Suraj On 5/4/05, Britton, Chris [EMAIL PROTECTED] wrote: I know this sounds bizarre but... ...occasionally, I will be typing along in a Java buffer and notice that my keyboard language has silently changed from its default of US English to what I believe is a French keyboard mapping. (The A and Q keys are swapped as are the W and Z keys. The unshifted number keys produce symbols such as c with a cedilla, e with an accent, and a with a grave symbol.) The complete new keyboard layout is at the end of the attached problem report. At first, I thought maybe I was inadvertently typing some key sequence that caused the change. However, each time the problem occurs an emacs lossage report shows a different key sequence leading up to the language change. Sometimes this happens several times per day, and sometimes just once per week. Resetting to the default language environment, coding system, or input method seems to have no effect. Neither does setting them explicitly to English or latin-1. The only way I can restore the default keyboard layout is to restart emacs. Other currently running Windows applications are not affected when this problem occurs. I've augmented the attached JDEE problem report with a lossage report (notice the language-change event), the new keyboard layout, and the output of the quail-show-keyboard-layout function. Has anyone seen anything like this before? How does one even generate a language-change event? Maybe knowing that will give me a clue as to what is happening. Could any of the background processes (semantic, ECB) be doing anything to contribute to this? Any advice on what I should do next? I'm running JDE 2.3.5, emacs 21.3.1, Windows XP service pack 2, cedet-1.0beta3, and ECB 2.31. Thanks in advance for any feedback. -- Chris Britton [EMAIL PROTECTED] emacskeyboardproblem.zip
Re: header line bugs and artifacts
That's the because of semantic stickyfunc mode. Try M-x global-semantic-stickyfunc-mode. Suraj On 4/22/05, Felix Dorner [EMAIL PROTECTED] wrote: Hi, I now run the nt emacs build + jde 2.3.5 + cedet1.0beta3b + elib-1.0 I did not have trouble with setting things up, only had to install the overlay fix because of no syntax-highlighting. However I still have a question: When i visit a .java file, there is a grey line right below the windows style menubar. Sometimes that line contains a copy of the first line of the visited file, so this looks like an artifact or a bug. When mouseclicking on that line the debugger opens and tells me: Debugger entered--Lisp error: (error Cannot move header-line at the top of the frame) signal(error (Cannot move header-line at the top of the frame)) error(Cannot move header-line at the top of the frame) mouse-drag-header-line((down-mouse-1 (#window 3 on Client.java header-line (47 . 7) 31480531))) * call-interactively(mouse-drag-header-line) So what is that line for? To me it really looks like a bug, not like a feature. Thanks for any help, felix
Re: Re[1]: [CEDET-devel] semantic-tag-folding.el
Version 2.0 of semantic-tag-folding.el is now at http://www.emacswiki.org/elisp/semantic-tag-folding.el I took of simpler route of making incremental changes to semantic-tag-folding.el instead of trying to add the new features to semantic-fold.el in cedet CVS. New features: 1) There is now a semantic-tag-folding-mode function which toggles the mode, turning on semantic-decoration-mode if needed. There is also a global-semantic-tag-folding-mode. 2) The fold state of inidvidual tags is now stored in semantic tag attributes and so is automatically persisited across emacs runs. I think semanticdb needs to be turned on for this. 3) semantic-tag-folding-fold-children and semantic-tag-folding-hide-children Eric, This file now has some minor hackery to make the semantic-decoration-mode appear independent of semantic-tag-folding-mode. It does this by making semantic-decoration-styles a buffer local variable and on occasion setting it value to only turn on folding deocrations. Is it ok to do this? For the following sequence of commands the behaviour is described in parenthesis. M-x semantic-tag-folding-mode (turns on fringe markers) M-x semantic-decoration-mode (turns on all decorations) M-x semantic-decoration-mode (turns off all decorations except the fringe markers) M-x semantic-tag-folding-mode (turns off all decorations) M-x semantic-decoration-mode (turns on all decorations, except for fringe markers) M-x semantic-tag-folding-mode (turns on fringe markers too) M-x semantic-decoration-mode (turns off all decorations except the fringe markers) M-x semantic-tag-folding-mode (turns off the fringe markers too) Suraj
Re: Re[1]: semantic-tag-folding.el
Hi Eric, 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. On Fri, 18 Feb 2005 22:27:23 -0500, Eric M. Ludlam [EMAIL PROTECTED] wrote: Hi, 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 it. 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 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 updated. 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. Suraj Lastly, you might want to run `M-x checkdoc' on your code to make your doc-strings RMS compatible. Thanks, I didn't know such a thing exsisted! Suraj
Re: jde-findbugs.el -- use findbugs from JDE
Hi Len, I've tried it and it works well. I had to change one thing though, customizing jde-findbugs-directory gave me errors on windows cvs emacs until I changed the default value of this variable to the empty string instead of nil. Suraj On Tue, 08 Feb 2005 12:57:11 +1300, Len Trigg [EMAIL PROTECTED] wrote: Hi all, I have put together an initial version of a jde-findbugs.el, which lets you call the most excellent findbugs package (http://findbugs.sourceforge.net/) from within JDE. I took jde-checkstyle.el as the starting point. The most important functionality seems to be working, so I thought I'd flick it out for interested people to try. See the limitations section of the lisp for which bits don't currently work. Cheers, Len.
Re: jde and emacs memory usage
The jde-beanshell-buffer is something that jde-usages to record the output of bsh. It's like a *Messages* buffer for the beanshell, but unlike *Messages* it doesn't clear out old entries. Adding the equivalent of message-log-size for this buffer is on my to-do list. You can delete the buffer at any point without any adverse effects. The next time jde-usages makes a call to bsh it will create the buffer if it does not exist. Suraj On Thu, 18 Nov 2004 11:53:11 -0800, Raul Acevedo [EMAIL PROTECTED] wrote: Right now my Emacs process is using 127 Megs of memory. While the *jde-beanshell-scratch* buffer size is 1239491, and another buffer I have is also just over 1 Meg, the total sum of all my buffers is still only a few megabytes, I definitely am not consuming anywhere near 100 megabytes in buffers. What could be taking up all the memory? How do I free it up? I've had emacs run out of memory a few times in the last couple of weeks. Raul
Re: [jde] [ANNOUNCEMENT] JDEE 2.3.4beta6 available at ...
This might be a job for jde-jeval-async, which asks the beanshell to evaluate something and returns right away, unlike jde-jeval and friends it doesn't wait for a response from bsh. (defun jde-jeval-async (java-statement optional eval-return) Uses the JDEE's instance of the BeanShell Java interpreter to evaluate the Java expression EXPR. It returns right away and doesn't wait for a response from the BeanShell. If the BeanShell is not running, the JDEE starts an instance. (let ((the-bsh (oref 'jde-bsh the-bsh))) (when (not (bsh-running-p the-bsh)) (bsh-launch the-bsh) (bsh-async-eval the-bsh (jde-create-prj-values-str))) (bsh-async-eval the-bsh java-statement eval-return))) I had to modify bsh-async-eval slightly to add the option on not evaluating the return value. (defmethod bsh-async-eval ((this bsh) expr optional eval-return) Send the Java statement EXPR to the BeanShell for evaluation. Do not wait for a response. (unless (bsh-running-p this) (bsh-launch this)) (oset this lisp-output ) (oset this java-expr expr) + (if eval-return + (set-process-filter (oref (oref this buffer) process) (oref this async-filter)) + (set-process-filter (oref (oref this buffer) process) (oref this eval-filter)) +) - (set-process-filter (oref (oref this buffer) process) (oref this async-filter)) (when (bsh-running-p this) (process-send-string (oref (oref this buffer) process) (concat expr \n I don't know much about process filters but this seems to work as expected even if more than one command has been submitted to the beanshell. For example: (progn (jde-jeval-async Thread.sleep (1);System.out.println (\'a\);) (jde-jeval-r System.out.println (\'b\);)) returns 'b after 10 seconds as expected. On Thu, 14 Oct 2004 22:38:39 -0400, Paul Kinnucan [EMAIL PROTECTED] wrote: Raul Acevedo writes: On Wed, 2004-10-13 at 01:14 -0400, Paul Kinnucan wrote: * Update the class list used by completion and by code generation wizards after compiling a class or building a project. This should ensure that completion and the wizards work for new classes and changes to existing classes after compiling new or changed classes. This is extremely slow on large projects, even if I'm just compiling a single class. I'm assuming that's because it's updating everything in the class path. If so, can it be changed to only update the class that was just compiled? And until that happens, how can I disable it and run it manually when necessary? It takes about 30 seconds right now. Hi Raul, I'll see if I can get the first approach to work. Meanwhile, you can easily disable this feature by removing je-compile-finish-update-class-info from jde-compile-finish-hook. Paul
Re: Problems with ant build after xemacs upgrade
What version of jde are you using? jde-ant-get-ant-home no longer looks like what your stack trace indicates. I'm guessing that there was a bug there that got fixed some time ago, XEmacs may have added some extra error checking code in let recently that is more strict about this bug. This is how jde-ant-get-ant-home is defined in the latest jde: (defun jde-ant-get-ant-home () Calculate an appropriate ant home. (let ((ant-home (if (string= jde-ant-home ) (getenv ANT_HOME) jde-ant-home))) (if ant-home (jde-normalize-path ant-home If this fixes your problem then I would suggest that you upgrade to the latest version. Suraj On Thu, 14 Oct 2004 12:41:11 -0700 (PDT), Mike [EMAIL PROTECTED] wrote: I upgraded xemacs using apt-get on my Debian system a while back, and it broke the ant builds inside JDE. I use the Ant Server to build, but now I always get an error message when I try to build. After I enter the target I want to build, xemacs says: Signaling: (error `let' bindings can have only one value-form (if (string= jde-ant-home) (if ANT_HOME_ENV (jde-normalize-path ANT_HOME_ENV)) (jde-normalize-path jde-ant-home))) (let ((ANT_HOME_ENV ...) (if ... ... ...))) jde-ant-get-ant-home() (let* ((ant-home ...) (delimiter ...) (ant-command ...)) (if (not ...) (setq ant-command ...)) (if (not ...) (setq ant-command ...)) (if (and ... ...) (setq ant-command ...)) (if (not ...) (setq ant-command ...)) ant-command) jde-build-ant-command(nil nil /local/src/java/build.xml) (let ((compile-command ...)) (when compile-command (if ... ... ...) (setq compilation-finish-function ...) (if ... ... ...))) (lambda (buildfile target optional interactive-args) Build the current project using Ant. If interactive, we try to prompt the\n user for certain variables.. (interactive (let ... ... ... ... ... ... ... ... ...)) (let (...) (when compile-command ... ... ...)))(/local/src/java/build.xml nil nil) call-interactively(jde-ant-build) (lambda nil Rebuild the entire project.\nThis command invokes the function defined by `jde-build-function'. (interactive) (call-interactively (car jde-build-function)))() call-interactively(jde-build) Here is my ~/.xemacs/custom.el: (custom-set-variables '(cperl-continued-statement-offset 4) '(load-home-init-file t t) '(gnuserv-program (concat exec-directory /gnuserv)) '(cperl-tab-always-indent t) '(cperl-indent-level 4) '(indent-tabs-mode nil) '(jde-ant-home /usr/share/ant) '(jde-build-function (quote (jde-ant-build))) '(jde-jdk-registry (quote ((1.4.2 . /usr/local/java '(gnuserv-program (concat exec-directory /gnuserv)) '(jde-ant-read-target t) '(toolbar-visible-p nil) '(jde-ant-enable-find t) '(jde-ant-invocation-method (quote (Ant Server))) '(font-lock-mode t nil (font-lock))) (custom-set-faces '(default ((t (:size 14pt :family Lucidatypewriter))) t) '(cperl-hash-face class color) (background light)) (:foreground Red :bold t) Any idea what is going on here? Thanks, Mike __ Do you Yahoo!? Yahoo! Mail Address AutoComplete - You start. We finish. http://promotions.yahoo.com/new_mail
InputStream.read bug in jde.util.DynamicClassLoader
In the two loadFile methods in jde.util.DynamicClassLoader InputStream.read() is assumed to read the entire contents of the stream in one go. This is not necessarily true always and I've found it to fail when reading classes from large jars. This causes java.lang.ClassFormatErrors which you don't see because they are suppressed in loadClass. This can be fixed by calling read in a loop till all the bytes are read, something like this: private static byte[] read (InputStream is, int size) throws IOException { int len = 0; byte [] b = new byte[size]; try { while (true) { int n = is.read(b, len, size - len); if (n == -1 || n == 0) { if (len size) { // ignore } break; } else len += n; } } finally { try { is.close(); } catch (IOException e) {} // ignore } return b; } Suraj
Re: jde-usages and jde-2.3.4beta6 do not play nicely together
I'm having no problems at all on Windows XP with GNU Emacs 21.3.50.1 (i386-mingw-nt5.1.2600). (from crasseux.com). I could run the jde-usages test suite (from CVS) sucessfully too. Suraj On Wed, 13 Oct 2004 15:14:09 -0400, Paul Kinnucan [EMAIL PROTECTED] wrote: Raul Acevedo writes: The jde-usages plugin doesn't like the new JDEE beta 6. It's hard to describe the behavior, but they clearly don't work together. The jde-usages commands don't work well or at all, and after running them, the JDEE keeps restarting the bsh process. I'm on Linux, Fedora Core 2. Is this possibly a process-connection-type issue? Possibly. You could easily test this by changing the setting of process-connection-type from nil to t in jde-run.el Paul
Re: [jde] jde-usages and jde-2.3.4beta6 do not play nicely together
What about jde commands that use the beanshell - things like method completion and jde-import-find-and-import, do they work fine? If they don'twork try uninstalling the jde-usages plugin and see if that makes a difference. You can unistall the plugin by moving it out of the plugins folder and then restarting emacs. Suraj On Wed, 13 Oct 2004 12:54:00 -0700, Raul Acevedo [EMAIL PROTECTED] wrote: Same problems if process-connection-type is t. (I did note that it's used in a macro and rebuilt all the .elc files before trying.) Raul On Wed, 2004-10-13 at 15:14 -0400, Paul Kinnucan wrote: Raul Acevedo writes: The jde-usages plugin doesn't like the new JDEE beta 6. It's hard to describe the behavior, but they clearly don't work together. The jde-usages commands don't work well or at all, and after running them, the JDEE keeps restarting the bsh process. I'm on Linux, Fedora Core 2. Is this possibly a process-connection-type issue? Possibly. You could easily test this by changing the setting of process-connection-type from nil to t in jde-run.el Paul
Re: jde and semanticdb?
jde-find-project-file should work, it takes a file (or directory) name and returns the closest prj.el file, and returns nil if the file is not in a jde project. An alternative is to leave semanticdb-project-predicate-functions set to nil which tells semantic to generate semanticdb cache files for all paths. Suraj On Mon, 11 Oct 2004 00:40:43 +0200, Joakim Verona [EMAIL PROTECTED] wrote: Hello, Im trying to get semanticdb and jde to work together. I dont know if im on the right track, but there seems to be a variable called semanticdb-project-predicate-functions. This is supposed to contain a function that informs semanticdb that it can store its persistent token database there. I cant find an apropriate jde function to put there. semanticdb-project-predicate-functions doesnt turn up a single google match, so I guess I'm on the wrong track. Any info on how to achieve this would be apreciated! Cheers, /Joakim
Re: refactoring in jdee
Freefactor looks interesting, I like their idea of using gnuclient to allow the java process to evaluate expressions in emacs I wasn't able to get it to work though. After renaming jde-db-source-directories to jde-sourcepath and checking that gnudoit works I got this exception : java.lang.NullPointerException at antlr.Parser.setASTNodeClass(Parser.java:324) at net.sourceforge.transmogrify.symtab.parser.FileParser.makeRecognizer(FileParser.java:167) at net.sourceforge.transmogrify.symtab.parser.FileParser.parseFile(FileParser.java:131) at net.sourceforge.transmogrify.symtab.parser.FileParser.doFile(FileParser.java:108) at org.freefactor.model.CodeModel.parse(CodeModel.java:120) at org.freefactor.tool.emacs.EmacsTool.testRefactoring(Unknown Source) at org.freefactor.tool.emacs.EmacsTool.apply(Unknown Source) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:494) at bsh.Reflect.invokeMethod(Unknown Source) at bsh.Reflect.invokeObjectMethod(Unknown Source) at bsh.BSHPrimarySuffix.doName(Unknown Source) at bsh.BSHPrimarySuffix.doSuffix(Unknown Source) at bsh.BSHPrimaryExpression.eval(Unknown Source) at bsh.Interpreter.run(Unknown Source) at bsh.Interpreter.main(Unknown Source) Any ideas? Did you have to make any changes to get it running ? Suraj On Fri, 1 Oct 2004 12:36:57 -0400, Nascif Abousalh-Neto [EMAIL PROTECTED] wrote: Another tool to consider is FreeFactor. It is in SourceForge, and it is already integrated with Emacs. It is still alpha, but is a good start for a true refactoring tool. http://sourceforge.net/projects/freefactor. A true refactoring tool needs access to the full syntactic tree of the source code - not just method signatures, but also method bodies. Does semantic support that? How about jde-usages?
Re: refactoring in jdee
I see two ways of approaching getting some refactoring functionality in JDE: 1) Use the parse information from semantic with perhaps a semanticdb backend for jar and class files using jde-usages. Semantic didn't parse java methd bodies when I last checked so this restricts the kinds of refactoring we can do. This is probably the right way to do refactoring but it will take a lot of time before we can do all the refactorings other IDEs provide. 2) Use an external refactoring tool to do the heavy lifting. I've spent some time looking at jrefactory which seems to be frequntly updated and was designed with the object being plugged into a IDE. All the IDEs it is being used with are written in java so I'm not sure how well it will work for us. The refactoring libraries from the eclise project are another option but they seem to be very tightly integrated into their IDE. Here are a list of refactoring operations that jrefactory says it can do : http://jrefactory.sourceforge.net/csrefactory.html I use Extract Method and Rename Method the most. You can use jde-usages as a start to rename a method. I even tried to automate it using a macro but discarded it because jde-usages can only tell you the line on which the method call exists, so if there is another method with the same name called on the line, or of it method name is mentioned in a comment its hard to figure out automatically where the method call is. Extract method, where the IDE converts some code into a method and guess the inputs and outputs, seems much harder. I'm not suggesting that we should choose one of the two approaches, but that we should do both - initially do simpler refactorings using semantic and punt the more complicated global ones to an external tool while we figure out how to do them in emacs. Suraj On Thu, 30 Sep 2004 13:50:45 -0400, Paul Kinnucan [EMAIL PROTECTED] wrote: Raul Acevedo writes: I know this question comes up at least once a year. I figure it's about time to ask again, in case new tools have come up. How do you do refactoring in Emacs/JDEE? Are there plans to include refactoring into JDEE at some point? My plan originally was to use xref as a basis for factoring commands. Now it appears that jde-usages might be a better basis. I need input on what kind of factoring commands users want. Paul
Re: [jde] xref *-caller files empty
Thanks Paul, that sounds good. Please let me know if I can do anything to help with the integration. I've been playing around with the idea of adding some test cases to the plugin so that you can easily tell when semantic or some other changes break it. This should make life easier for you when you are doing a JDEE release. I shall let you know when it is done. Suraj On Tue, 28 Sep 2004 13:52:02 -0400, Paul Kinnucan [EMAIL PROTECTED] wrote: Raul Acevedo writes: On Tue, 2004-09-28 at 16:15 +0100, Dominik Dahlem wrote: I'm testing the xref functionality on a small codebase. In my most simple example, I would like to display the call tree of a private method in a class. Also, jde-xref-first-caller results in a message No more calls in my minibuffer. I verified the xrefdb and found out that all *-caller files just contain (). I suppose this is the reason, why I can not navigate through call-trees since the information could not be properly generated. Find below my prj.el file. Am I missing something? Rather than help you with jde-xref, I'd recommend trying the usages plugin, which works much better and provides extra functionality. Check it out at http://jde-usages.sourceforge.net. Are there plans to integrate the usages plugin as a replacement for jde- xref? I don't know any advantages jde-xref has over the plugin. If there are no objections, I will do this. Paul
Re: Usages plugin problem with deleted classes
Hi Raul, Thanks for the feedback. Can you give me some information which will help me debug this problem ? Was bsh running when you renamed the class? If the .class file is not in the classpath then getting rid of the files in ~/.jde-usages while bsh is not running should fix the problem. Please let me know if this works; and keep the old files around as I'd like to figure out how it got into this state originally. Suraj On Wed, 22 Sep 2004 17:06:41 -0700, Raul Acevedo [EMAIL PROTECTED] wrote: I'm using the usages plugin, and it's awesome. One problem: a class that got deleted (actually renamed to a different package) a few days ago is confusing it when I lookup subclasses; it somehow finds a reference to the old class, but since it's not compiled and the source is not around, it throws an error. I have looked everywhere and find no reference to the old class; not in jde-sourcepath, not in jde-global-classpath. However, ~/.jde-usages keeps getting recreated with one of the #blah#.classes files having a reference to the deleted class. I have no idea where it is picking up the reference, since the classpath directory for the #blah#.classes file definitely does not have the deleted class in its old package. Since the format of the #blah#.classes file is binary, I can't understand what led it to find the reference. Thoughts? Raul
Re: [jde] Re: Usages plugin problem with deleted classes
On Thu, 23 Sep 2004 16:27:40 -0700, Raul Acevedo [EMAIL PROTECTED] wrote: On Thu, 2004-09-23 at 16:04 -0700, Suraj Acharya wrote: Was bsh running when you renamed the class? Someone else renamed the class, I simply synchronized my code base. I have since restarted Emacs several times. Do you remember if bsh was running while you synchronized and built the code base? I'm trying to figure out if the bug is 1) in the code that updates the classes database (in memory) if it detects the files in the classpath have changed or 2) in the code that reconstructs the classes database from the cache files in ~/.jde-usages. If the .class file is not in the classpath then getting rid of the files in ~/.jde-usages while bsh is not running should fix the problem. Please let me know if this works; It did!!! Yay!!! :) and keep the old files around as I'd like to figure out how it got into this state originally. Oops, already deleted them. :( Though it sounds like it was a problem with bsh thinking the old class was there, then usages putting it in ~/.jde-usages... and when bsh was restarted, usages telling bsh the old class was there from its ~/.jde-usages files. Bad cycle. The usages plugin doesn't rely on bsh to find the classes in the classpath, but I get your drift. You're describing option 2) from above. Suraj
Re: javac mistakes filename for flag
javac usually says this when it can't find the .java file passed to it. Can you check if MyDocument.java exists in c:/Allen/DesignPatterns/FactoryMethod/ ? Suraj On Tue, 21 Sep 2004 23:22:44 -0700 (PDT), Allen Hsu [EMAIL PROTECTED] wrote: When I did C-c C-v C-v, javac seems to think the source filename as a flag. Is there a setting to correct this? I'm using JDE2.3.4beta5, emacs21.2.1, JDK1.4.2_05. Thanks. Allen cd c:/Allen/DesignPatterns/FactoryMethod/ c:/j2sdk1.4.2_05/bin/javac.exe -classpath c:/Allen/DesignPatterns/FactoryMethod -g -deprecation -O -verbose -source 1.4 MyDocument.Java javac: invalid flag: MyDocument.Java Usage: javac options source files where possible options include: -gGenerate all debugging info ... ___ Do you Yahoo!? Declare Yourself - Register online to vote today! http://vote.yahoo.com
Re: javac mistakes filename for flag
The problem is probabaly the capital J in the your file extension for MyDocument.Java You must be using windows, filenames are case insensite there and emacs will allow you to open a file called MyDocument.Java even if you originally created a MyDocument.java. Javac, however, doesn't seem to treat its filename as case-insentive on windows. Close the MyDocument.Java buffer and open MyDocument.java, and all should be fine. Suraj On Tue, 21 Sep 2004 23:22:44 -0700 (PDT), Allen Hsu [EMAIL PROTECTED] wrote: When I did C-c C-v C-v, javac seems to think the source filename as a flag. Is there a setting to correct this? I'm using JDE2.3.4beta5, emacs21.2.1, JDK1.4.2_05. Thanks. Allen cd c:/Allen/DesignPatterns/FactoryMethod/ c:/j2sdk1.4.2_05/bin/javac.exe -classpath c:/Allen/DesignPatterns/FactoryMethod -g -deprecation -O -verbose -source 1.4 MyDocument.Java javac: invalid flag: MyDocument.Java Usage: javac options source files where possible options include: -gGenerate all debugging info ... ___ Do you Yahoo!? Declare Yourself - Register online to vote today! http://vote.yahoo.com
Re: auto newline, indent and close brace on open brace, return
;; Allows white space before and after point. (defun jde-line-end-at-open-brace () (and (looking-back {\\s-* (line-beginning-position)) (looking-at }?\\s-$))) ;; Discovering the function parse-partial-sexp has simplified the mismatched brace detecting code considerably. ;; Now we just check if the number of unmatched open braces from the beginning of the buffer to point ;; is greater than the number of unmatched close braces in the region from point to the end of the buffer. ;; If so we add a close brace. This handles all the problems that have come up so far. (defun jde-gen-embrace () Adds a new line and inserts a matching close brace if required. See variable 'jde-gen-embrace. Assumes that 'jde-line-end-at-open-brace has been called and it returned true. (interactive) (let ((open-indent (current-indentation))) (when (looking-at }) ;; if there is a } after point, put it on a new line and come back (jde-newline) (end-of-line 0) ;; move to end of previous line ) ;; make a blank line (jde-newline) (when (save-excursion ( (car (parse-partial-sexp (point-min) (point))) ;; parenthesis depth at point (- (car (parse-partial-sexp (point) (point-max) ;; number of unmatched open parenthesis staring from point ) ;; add the } on a new indented line (insert }) (indent-according-to-mode) (end-of-line 0) ;; move to end of previous line (jde-newline ;; allows you to customize the indentation function (defcustom jde-newline-function '(newline) Indent command that the enter key calls. :group 'jde :type '(list (radio-button-choice :format %t \n%v :tag Function: :entry-format %b %v (const newline) (const newline-and-indent) (const align-newline-and-indent) (function my-custom-newline-function))) ) (defun jde-newline () This command invokes the function defined by `jde-newline-function'. (interactive) (call-interactively (car jde-newline-function))) ;; And here's the rest of the code Paul, so you don't have to grab it from multiple posts. (defcustom jde-gen-embrace t Typing enter after a close brace at the end of a line will insert a matching closing brace (if required) and put point on a empty line between the braces and indent the new lines. So if before you had: pubic void function () { ^ You now have: pubic void function () { } ^ Point must be at the end of the line, or at a } character followed by the end of the line. If it thinks a matching close brace already exists a new one is not inserted. Before: pubic void function () { } ^ After: pubic void function () { } ^ It does this by checking if the line containing the matching close brace is already correctly indented. If it is not then this close brace probably does not match the open brace at point and so a new close brace is inserted. :type 'boolean ) (defcustom jde-gen-complete-multi-line-string t Typing enter at the end of a line with an unterminated string constant will result in the generation of the required string by adding a \\n character to the end of the line, closing the string, adding the string append operator (+) and starting a new string on the next line. Before: String a = \This is a multi-line string ^ After: String a = \This is a multi-line string\\n\ + \ ^ :type 'boolean ) (defun jde-line-has-incomplete-string () Returns true if point is at the end of the line and the current line has a mismatched double quote character. (let* ((end (point)) (beg (save-excursion (beginning-of-line) (point))) (count 0)) (save-excursion (while (search-backward \ beg t) (unless (or (= (preceding-char) ?\\) (and (= (preceding-char) ?') (looking-at \'))) (incf count) ) )) (= (mod count 2) 1) )) (defun jde-multi-line-string-enter () Ends an unterminated string constant and continues it on the next line. See variable 'jde-gen-complete-multi-line-string. Assumes that 'jde-line-has-incomplete-string was called and it returned true. (interactive) (insert \\n\ +) (jde-newline) (insert \) ) (defun jde-mode-return () Check if variables 'jde-gen-embrace or 'jde-gen-complete-multi-line-string are set and handle them appropriately. Automatically indents the new line if jde-auto-indent is true or if invoked by C-j (interactive) (let ((jde-newline-function (if (equal last-command-char 10) '(newline-and-indent) jde-newline-function))) (cond ((and jde-gen-complete-multi-line-string (jde-line-has-incomplete-string)) (jde-multi-line-string-enter)) ((and jde-gen-embrace (jde-line-end-at-open-brace)) (jde-gen-embrace)) (t (jde-newline) (define-key jde-mode-map [return] 'jde-mode-return)
Re: ant build problem
Hi Mark, Have you tried running the ant command from your shell to see if it completes sucessfully? Use the same arguments that emacs is passing to ant: ant -Dant.home=/usr/share/ant -buildfile '/home/mhansen/chap5/oneway/build.xml' -emacs init Suraj On Wed, 8 Sep 2004 21:01:29 -0400, Mark D. Hansen [EMAIL PROTECTED] wrote: One more thing on this ... I've read all the posts related to jde-ant-build and can't find this problem. My problem is NOT related to the \' delimiter around the buildfile. Thanks for any possible help / ideas. -- Mark -Original Message- From: Mark D. Hansen [mailto:[EMAIL PROTECTED] Sent: Monday, September 06, 2004 12:08 AM To: JDE (E-mail) Subject: ant build problem When I try to build (any target / any build file) C-c C-v C-b, I get the following error message: error in process sentinel: byte-code: No more errors error in process sentinel: No more errors ... and the following in the compilation window (abnormal exit): cd ~/chap5/oneway/ ant -Dant.home=/usr/share/ant -buildfile '/home/mhansen/chap5/oneway/build.xml' -emacs init Buildfile: /home/mhansen/chap5/oneway/build.xml Compilation exited abnormally with code 129 at Mon Sep 6 00:04:30 ... Does anyone have any ideas? Sorry if this is a dumb mistake, but I'm new to JDE and don't understand elisp particularly well. Thanks, Mark
jde-run-etrace and the new compile.el
If you are using a relatively new emacs with the revamped compile.el and find that the jde-run-etrace commands to jump to the souce line for a stack trace do not work, the following may help (defun jde-run-etrace-goto (optional next) Display the current stack using `compilation-goto-locus'. (jde-run-etrace-current-marker next) (compilation-goto-locus (car jde-run-etrace-current-marker) (cdr jde-run-etrace-current-marker) nil)) The signature of compilation-goto-locus seems to have changed from taking a single argument of a pair of markers to taking two (or three) marker arguments. Suraj
Re: Jde Xref problem
There are no missing pieces in jde-usages as far as I know too, but it does some things differently, based on my personal preference: 1) Instead of creating a new buffer each time you call one of the usage functions, jde-usages just reuses one buffer called *usages* 2) I did not implement the equivalent of jde-xref-first-caller and jde-xref-next-caller because I didn't use them. But there is a function which moves to the next usage line in the *usages* buffer and hits enter. I shall make the buffer name customizable and add functions to allow navigation between the usages without popping up the *usages* buffer. Also I find that having most of the code in java does not make for a pleasant experience while developing. I'm constantly restarting the bsh process to test new changes. I'm considering using beanshell functions instead of straight java code for parts of the project. Right now, I am, as time permits, working on two subprojects: 1) Using qdox (http://qdox.codehaus.org/) to parse files in jde-sourcepath so that the class hierarchy and class navigation functions don't require the source to be compiled to work. I really need this because compiling my entire project at work from scratch takes more than an hour and during that time JDE can't help me much because the class files are not yet available. 2) Allowing jde-usages to return the same kind of class info structures that jde.util.Completion does. Plusses for this: a) a smaller beanshell process size, since there would be just one component that looked at class files, b) Since jde-usages doesn't keep the files in the classpath open across invocations, on windows it would allow me to delete jar files in the classpath without shutting down the beanshell process. c) You wouldn't have to, in theory, call jde-complete-flush-classinfo-cache manually if you built your project from outside of emacs. This would come at the cost of each completion being slower because of the extra time spent checking if the files in the classpath have changed, but I'm thinking of ways to make this check less aggressive and still useful. Suraj On Wed, 18 Aug 2004 06:29:32 -0400, Andrew Hyatt [EMAIL PROTECTED] wrote: I think jde-usages is a perfectly acceptable replacement, and there is really no difference in functionality as far as I know. On Aug 18, 2004, at 4:08 AM, Jens Lautenbacher wrote: Maybe OT, but does anybody know what feature the normal jde-xref has that isn't done faster and without all the db stuff by the jde-usages plugin? While I really think jde-xref is cool, maybe we should think about integrating jde-usages itself... jtl
Allowing shell wildcards in jde-global-classpath and jde-sourcepath
I made the following changes to allow me to use wildcards in the classpath and sourcepath variables. The file expansion included with jde which expands specially named directories (for example lib) didn't do the job for me because: 1) My project has a bunch of library directories under a common root: extensions/ foo/lib/{a,b,c,d}.jar bar/lib/{e,f}.jar baz/lib/{x,y,z}.jar Without the wildcard expansion my classpath looked like this : (extensions/foo/lib, extensions/bar/lib, extensions/baz/lib, ...), with the wildcards I can say (extensions/*/lib/*.jar) 2) Jde's file expansion only worked on jde-global-classpath Suraj (defun jde-search-src-dirs (class) Return the directory containing the source file for a class. CLASS is the fully qualified name of the class. (let ((file (concat (jde-parse-get-unqualified-name class) .java)) (package (jde-parse-get-package-from-name class))) (catch 'found - (loop for dir in jde-sourcepath do + (loop for dir in (jde-expand-wildcards-and-normalize jde-sourcepath) do (progn - (setq - dir - (jde-normalize-path dir 'jde-sourcepath)) (if (file-exists-p (expand-file-name file dir)) (throw 'found dir) (let* ((pkg-path (subst-char-in-string ?. ?/ package)) (pkg-dir (expand-file-name pkg-path dir)) (file-path (expand-file-name file pkg-dir))) (if (file-exists-p file-path) (throw 'found pkg-dir) (defun jde-open-get-path-prefix-list () Builds all the path prefixes used to search for the full qualified source file. For this method to work `jde-sourcepath' needs to be set. (if jde-sourcepath - (append (jde-normalize-paths jde-sourcepath 'jde-sourcepath)) + (append (jde-expand-wildcards-and-normalize jde-sourcepath 'jde-sourcepath)) (error (concat For this method to work the variable jde-sourcepath needs to be set (defun jde-expand-classpath (classpath optional symbol) If `jde-expand-classpath-p' is nonnil, replaces paths to directories that match `jde-lib-directory-names' with paths to jar or zip files in those directories, excepting those specified by `jde-lib-excluded-file-names'. This function assumes that the existing paths are already normalized. - (if jde-expand-classpath-p - (let (paths) - (loop for path in classpath do - (if (and - (file-exists-p path) - (file-directory-p path) - (let ((dir-name (file-name-nondirectory path))) -(member-if - (lambda (lib-name) - (string-match lib-name dir-name)) - jde-lib-directory-names))) - (progn - (setq paths - (append - paths - (jde-expand-directory - path - \\.jar$ - jde-lib-excluded-file-names - symbol))) - (setq paths - (append - paths - (jde-expand-directory - path - \\.zip$ - jde-lib-excluded-file-names - symbol - (setq paths (append paths (list path) - paths) -classpath)) + (if (or jde-expand-classpath-p jde-expand-wildcards-in-paths-p) + (mapcan (lambda (path) + (cond + ((and jde-expand-classpath-p (file-exists-p path) + (file-directory-p path) + (let ((dir-name (file-name-nondirectory path))) + (member-if +(lambda (lib-name) + (string-match lib-name dir-name)) +jde-lib-directory-names))) +(append + (jde-expand-directory + path + \\.jar$ + jde-lib-excluded-file-names + symbol) + (jde-expand-directory + path + \\.zip$ + jde-lib-excluded-file-names + symbol))) + (jde-expand-wildcards-in-paths-p +(let ((exp-paths (file-expand-wildcards path))) + (if exp-paths exp-paths (list path + (t (list path + classpath) +classpath)) +(defcustom jde-expand-wildcards-in-paths-p t + Expands entries in the 'jde-global-classpath and 'jde-sourcepath which are wildcards patterns into a list of matching files or directories which are interpolated into classpath or sourcepath list. This
Re: SV: Jde-electric-return sometimes off
Paul, I think the problem might occur if you set jde-electric-return-p in your .emacs (using custom-set-variable) and don't set in your jde project files.Petter, are setting the variable in your .emacs or your project file? I've just upgraded to jde beta5 from beta3 so I'm not sure there is new jde custom variable code that calls the :set methods for variables set globally when switching projects or loading a new one. Suraj On Wed, 30 Jun 2004 08:01:11 -0400, Paul Kinnucan [EMAIL PROTECTED] wrote: Petter Måhlén writes: Well, have to correct myself - the 'toggle' function has been changed to jde-electric-return-mode in beta5, the text referred to beta3. Nevertheless, the behaviour as such is the same in both betas, that is, the electric return doesn't work automatically for newly opened files. I can't reproduce this problem on my system. Please note that intended behavior is for you to use the customization variable jde-electric-return-p to specify the default setting for this mode (on or off) and jde-electric-return-mode to toggle the setting temporarily during a session. Paul / Petter -Ursprungligt meddelande- Från: Petter Måhlén [mailto:[EMAIL PROTECTED] Skickat: den 30 juni 2004 10:16 Till: '[EMAIL PROTECTED]' Ämne: Jde-electric-return sometimes off Hi, I like the jde-gen-embrace functionality that Suraj provided and that is included in the last few betas. However, that feature is often turned off when I open up a new buffer, even though jde-electric-return-p is true. I can turn the feature on by doing two jde-toggle-electric-return (not one), but it should work from the start. My guess is that the key-mapping doesn't take when I open or create a new buffer, could that be true? I have tried to understand what goes on, but haven't quite gotten there. I'm on 2.3.4beta5, by the way. / Petter
Re: Trans.: Class finding
You can try the (fairly beta) jde-usages (http://jde-usages.sourceforge.net). It has a function called jde-open-class-source-with-completion, which is a wrapper around jde-open-class-source that gives you tab-completion on the class and optional package name. So how does this help you? If you say M-x jde-open-class-source-with-completion and hit tab, the completions buffer will get populated with a list of all the classes that are in the jde-global-classpath; you can seach for regular expressions here and hitting enter on any line will take you to the class source. Since this function is setup for easy class name completion a class package.name.Class is listed as Class|package.name, so construct your regexps accordingly. Suraj PS: The latest build of jde-usages (from today) adds code to ensure that the list of classes used by jde-open-class-source-with-completion is as up to date as the usage and class hierarchy functions, that is, they are all always in sync with the files in jde-global-classpath. On Tue, 15 Jun 2004 10:44:29 -0700, Chitale, Sandip V [EMAIL PROTECTED] wrote: I think what plalleme is looking for enumeration of all classes/interfaces (java types in general) on the classpath. I think the: jde.util.JdeUtilities jde.util.ProjectClasses or in general jde.util.* classes deals with that. However I think there is no method to enumerate the ALL types on classpath. -sandip HINT: Look into /** * returns a list of fully qualified classnames matching an * unqualified name in all classpath entries for the project. * * @param unqualifiedName a codeString/code value * @return a codeList/code value * @exception IOException if an error occurs */ List getClassNames(String unqualifiedName) throws IOException { List rv = new ArrayList(); for (Iterator i = classPathEntries.iterator(); i.hasNext();) { ClassPathEntry cpe = (ClassPathEntry) i.next(); rv.addAll(cpe.getClassNames(unqualifiedName)); } return rv; } of jde.util.ProjectClasses Sandip -Original Message- From: Paul Kinnucan [mailto:[EMAIL PROTECTED] Sent: Tuesday, June 15, 2004 10:23 AM To: [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] Subject: Trans.: Class finding [EMAIL PROTECTED] writes: Hi, is there a way to find all class names in the jde project matching a regexp ? i've read the jde doc, but it seems nothing appears about it. (i don't want jump to classsource, but just watch all class names then choose one and jump to source) Your question is not very clear. JDE-Find-Expression finds all occurrences of a regular expression in the current directory that matches a regular expression and displays the results in a buffer. Clicking on any result takes you to the source of the match. JDE-Find-Expression... finds all occurrences of a regular expression in a directory tree. Why can't you use these commands? Paul Thx Christophe - Fin du message transféré -
Re: Question/Bug to 'jde-detect-java-buffer-activation
Hi Paul, I replied too hastily earlier. On starting up a new emacs process, switching buffers as you describe results in loading the correct prj.el file. However, after a while I can get myself into a situation where some of my jde buffers do not have jde-detect-java-buffer-activation in their post-command-hook. Its value is (ecb-layout-post-command-hook ecb-handle-major-mode-visibilty). So switching from *any* buffer to this jde buffer does not load the project file. I don't have a reproducible set of commands I can perform to get into this state yet, but the customizations I have for jde-entering-buffer-hook and ecb-source-path-functions are the likely suspects. The documentation for post-command-hook says that if an unhandled error occurs while running one of the hooks, its value is set to nil. I shall investigate this further. Sorry for the false alarm. I have noticed this behavior of the project file not being loaded correctly before sporadically, usually when killing buffers or when trying to load all the buffers in recentf-list, and jumped to the conclusion that it was because post-command-hook was buffer-local. Suraj On Wed, 2 Jun 2004 23:40:13 -0400, Paul Kinnucan [EMAIL PROTECTED] wrote: Suraj Acharya writes: On Wed, 2 Jun 2004 09:29:22 +0200 , Berndl, Klaus [EMAIL PROTECTED] wrote: ;; to a buffer belonging to another. (make-local-hook 'post-command-hook) Hmm, I don't think I need the above form because the add-hook form below makes the variable local anyway. Indeed. (add-hook 'post-command-hook 'jde-detect-java-buffer-activation nil t) This is the code from `jde-mode' (JDEE 2.3.4beta3). This should work even if the from buffer is not a jde-mode buffer. Are you saying that it doesn't? Yes, i'm saying this - and it can not work in other modes: This add-hook is called when `jde-mode' is called which is only called when a buffer X is opened which is linked to jde-mode. And because you add the function LOCALLY to post-command-hook only the local value (local in buffer X) contains this function - the global value of post-command-hook doesn't. Therefore this works only in jde-buffers - which is suboptimal IMHO ;-) I can confirm this. Moving from a java file in one project to a .el file and then to a java file in another project does not result in the loading of the new project's settings file. It does on my system. I opened up four frames: Frame 1: Project A Frame 2: Project B Frame 3: jde.el Frame 4: *Messages* buffer (to monitor project load messages). Frame MovementsResult 1-2 Project B reloaded. 2-3-1Project A reloaded. 1-3 No change. 3-2 Project B reloaded. etc. I am at a loss to explain why the project switching does not work correctly on your system. I am using JDEE 2.3.4beta5 with Emacs 21.3.1 on Windows Millenium. Paul
Re: Question/Bug to 'jde-detect-java-buffer-activation
On Wed, 2 Jun 2004 09:29:22 +0200 , Berndl, Klaus [EMAIL PROTECTED] wrote: ;; to a buffer belonging to another. (make-local-hook 'post-command-hook) Hmm, I don't think I need the above form because the add-hook form below makes the variable local anyway. Indeed. (add-hook 'post-command-hook 'jde-detect-java-buffer-activation nil t) This is the code from `jde-mode' (JDEE 2.3.4beta3). This should work even if the from buffer is not a jde-mode buffer. Are you saying that it doesn't? Yes, i'm saying this - and it can not work in other modes: This add-hook is called when `jde-mode' is called which is only called when a buffer X is opened which is linked to jde-mode. And because you add the function LOCALLY to post-command-hook only the local value (local in buffer X) contains this function - the global value of post-command-hook doesn't. Therefore this works only in jde-buffers - which is suboptimal IMHO ;-) I can confirm this. Moving from a java file in one project to a .el file and then to a java file in another project does not result in the loading of the new project's settings file. Suraj
Re: Customizing jde-entering-java-buffer-hook
This works for me, but I have it after a (require 'jde) in my .emacs. Putting it before the require statement results in JDE clobbering the old value during its load. Suraj - Original Message - From: Berndl, Klaus [EMAIL PROTECTED] Date: Tue, 1 Jun 2004 14:38:43 +0200 Subject: Customizing jde-entering-java-buffer-hook To: [EMAIL PROTECTED] Why is it not possible to do the following: (add-hook 'jde-entering-java-buffer-hook 'ecb-jde-update-ecb-source-paths) When i add this to my .emacs then the default-value of this hook is lost and only ecb-jde-update-ecb-source-paths is contained in this hook var. I assume this comes from the autom. checking and setting etc. of the jde-options for project switches etc But IMHO such hooks should be setable via add-hook - especially if such a hook is project-independent - and this hoom seems to be not project-centric because per default the function `jde-reload-project-file' is contained in this hook and this fuinction reloads a project-file! isn there a way to add function to such a hook from elisp and not via a customize- buffer? Would the following help: (customize-set-variable 'jde-entering-java-buffer-hook '(new sensefull value for this hook)) Ciao, Klaus Klaus Berndl mailto: [EMAIL PROTECTED] sdm AG http://www.sdm.de software design management Carl-Wery-Str. 42, 81739 Muenchen, Germany Tel +49 89 63812-392, Fax -220
Re: AspectJ for JDE?
There's aspectjforemacs http://aspectj4emacs.sourceforge.net/ which is JDE aware, but it has not been updated in a while. Suraj On Wed, 2 Jun 2004 08:04:45 -0500, Paul Landes [EMAIL PROTECTED] wrote: Are there any AspectJ extensions or libraries written for JDE? Thanks in advance! -- Paul Landes [EMAIL PROTECTED]
Re: Cannot open load file, semantic loaddefs
As explained in the cedet INSTALL file you need to say (load-file (expand-file-name ~/jdestuff/cedet/cedet-1.0beta2a/common/cedet.el)) before the (require 'jde) line. This will automatically add all the directories that cedet uses to the load-path and load semantic and other libraries that JDE uses. The (add-to-list ...) lines for semantic, speedbar and eieio are no longer required. Suraj On Tue, 11 May 2004 20:11:37 -0700 (PDT), exits funnel [EMAIL PROTECTED] wrote: Hello, I'm pretty new to Emacs and just tried to install JDE but I've run into what is probably a simple problem. I downloaded all the dependencies and added the following to my .emacs file: ;; JDE Stuff (add-to-list 'load-path (expand-file-name ~/jdestuff/jde/jde-2.3.3/lisp)) (add-to-list 'load-path (expand-file-name ~/jdestuff/cedet/cedet-1.0beta2a/semantic)) (add-to-list 'load-path (expand-file-name ~/jdestuff/cedet/cedet-1.0beta2a/speedbar)) (add-to-list 'load-path (expand-file-name ~/jdestuff/elib/elib-1.0)) (add-to-list 'load-path (expand-file-name ~/jdestuff/cedet/cedet-1.0beta2a/eieio)) (require 'jde) ;; Sets the basic indentation for Java source files ;; to two spaces. (defun my-jde-mode-hook () (setq c-basic-offset 2)) (add-hook 'jde-mode-hook 'my-jde-mode-hook) ;; Include the following only if you want to run ;; bash as your shell. ;; Setup Emacs to run bash as its primary shell. (setq shell-file-name bash) (setq shell-command-switch -c) (setq explicit-shell-file-name shell-file-name) (setenv SHELL shell-file-name) (setq explicit-sh-args '(-login -i)) ;; END JDE Stuff ;; ECB (add-to-list 'load-path (expand-file-name ~/jdestuff/ecb/ecb-2.24)) (require 'ecb) ;; END ECB When I start emacs it complains thusly: File error: Cannot open load file, semantic-loaddefs I'm sure this is something simple but I can't figure out how to fix it. I don't see a file named 'semantic-loaddefs' in anything I downloaded. Could it be a conflict with the older stuff bundled with my emacs which is 21.3.1? If so, how can I fix it? Thanks in advance! -exits __ Do you Yahoo!? Yahoo! Movies - Buy advance tickets for 'Shrek 2' http://movies.yahoo.com/showtimes/movie?mid=1808405861
Re: JDE 2.3.4beta3: strange overlining
You have the semantic show-tag-boundaries minor mode enabled, I think setting 'semantic-load-turn-useful-things-on to t will do that. To turn it off say M-x semantic-show-tag-boundaries-mode Suraj On Tue, 11 May 2004 13:15:41 +0200, Petter Måhlén [EMAIL PROTECTED] wrote: Hi, I'm getting the weird effect shown in the attached GIF using JDE 2.3.4beta3 and cedet1.0beta2 on Emacs 21.3. All non-public methods are 'overlined', which is really not pleasant. I guess it's some kind of highlighting of non-public methods that has gone wrong - does anybody know of a configuration setting to modify this behaviour or is it possibly a bug? / Petter
Re: jdee 2.3.4beta1 RETURN complaint and jde-gen-embrace bug
On Wed, 28 Apr 2004 14:30:20 -0400, Paul Kinnucan [EMAIL PROTECTED] wrote: Martin Dickau writes: Hi Paul, Just installed jdee 2.3.4beta1. Looks very nice. One complaint: I absolutely *HATE* having my return key overridden and having to do something to actively prevent it. Now I have yet another customization to maintain that I don't even really want to have IMO, even more annoying than when abbrev mode was turned on by default. FWIW. I'm planning to make this feature off by default. I did notice that it the jde-gen-embrace it's bound to does not honor my indentation style. For example, I have my indentation set up to get the now-not-in-favor alignment of close brace under beginning of keyword: There was a thread on getting jde-gen-embrace to honor a user's indentation styles that I did not follow very closely. I plan to review the thread and incorporate any ideas that are workable into an enhanced version of this feature. Paul try { } via: (setq c-basic-offset 4) (setq c-indent-level 4) (setq c-tab-always-indent nil) (setq tab-width 4) (setq-default tab-width 4) (setq default-tab-width 4) but when I used 2.3.4 with RET, I got: try { } (tab on the close-brace line shifts it back to the left, but that sort of defeats the purpose of having the code generated in the first place). Regards, Martin The gen-embrace code in the 2.3.4beta1 is from the start of the thread and is a bit buggy. The consensus at the end of the thread was that it would be nice we could get this functionalty in a way that was more in the spirit of realted cc-mode features. I think c-context-line-break is a good candidate to host this functionality (along with the special handling of returns inside strings). I am working on this and shall post the code to the cc-mode list when I'm done. So, since the code is half-baked now and will hopefully the feature will get into cc-mode someday, I suggest that it not be included in JDE. If however you want to use this feature in right now, you can use the code at the end of the old thread. For convenience I've pasted it here after ripping out the multi-line string stuff. To bind [return] to jde-electric-return. The code is much smarter about not inserting a close brace if it is not needed, jde-newline-function lets you customize which identation function you want for newlines and jde-gen-embrace lets you toggle the brace insertion. Suraj (defun jde-electric-return () (interactive) (cond ;; ((and jde-gen-complete-multi-line-string (jde-inside-string-literal)) ;; (jde-multi-line-string-enter)) ((and jde-gen-embrace (jde-line-end-at-open-brace)) (jde-gen-embrace)) (t (jde-newline)) ) ) (defcustom jde-newline-function '(newline) Indent command that the enter key calls. :group 'jde :type '(list (radio-button-choice :format %t \n%v :tag Function: :entry-format %b %v (const newline) (const newline-and-indent) (const align-newline-and-indent) (function my-custom-newline-function))) ) (defcustom jde-gen-embrace t Typing enter after a close brace at the end of a line will insert a matching closing brace (if required) and put point on a empty line between the braces and indent the new lines. So if before you had: pubic void function () { ^ You now have: pubic void function () { } ^ Point must be at the end of the line, or at a } character followed by the end of the line. If it thinks a matching close brace already exists a new one is not inserted. Before: pubic void function () { } ^ After: pubic void function () { } ^ :type 'boolean ) (defun jde-line-end-at-open-brace () (and (looking-back {\\s-* (line-beginning-position)) (looking-at }?\\s-*$))) (defun jde-gen-embrace () Adds a new line and inserts a matching close brace if required. See variable 'jde-gen-embrace. Assumes that 'jde-line-end-at-open-brace has been called and it returned true. (interactive) (let ((open-indent (current-indentation))) (when (looking-at }) ;; if there is a } after point, put it on a new line and come back (jde-newline) (end-of-line 0) ;; move to end of previous line ) ;; make a blank line (jde-newline) (when (save-excursion ( ;; parenthesis depth at point (car (parse-partial-sexp (point-min) (point))) ;; number of unmatched open parenthesis staring from point (- (car (parse-partial-sexp (point) (point-max) ) ;; add the } on a new indented line (insert }) (indent-according-to-mode) (end-of-line 0) ;; move to
Re: W3m binary for windows
Take a look at http://www.w3m.org/. It has cygwin binaries for windows. Suraj On Mon, 26 Apr 2004 10:29:40 -0400, Nascif Abousalh-Neto [EMAIL PROTECTED] wrote: Hi there, I have been reading about w3m + Emacs and that some lucky guys out there are already browsing their Javadoc pages with it inside Emacs. How cool is that? :-) I would like to do the same as well, but I am having a hard time collecting all the pieces to build w3m on my WindowsXP + Cygwin box. I found some really old (1999) Windows binaries which don't seem to work. Does anybody has a more recent version available? And isn't this package useful enough to be included with the default JDE distribution - or at least to have a pointer to it in the JDEE documentation? Regards, Nascif
Re: W3m binary for windows
My w3m version is w3m/0.4.1+cvs-1.859 which seems to be much newer than the one on w3m.org. So I googled the version string and found http://www.page.sannet.ne.jp/knabe/w3m/w3m-bin.html Sorry for the wrong link. The page also has a more recent version - 0.5-cvs-1.916. Suraj On Mon, 26 Apr 2004 14:33:43 -0400, Nascif Abousalh-Neto [EMAIL PROTECTED] wrote: I did, but they are 4-5 years old. I was able to compile the latest w3m (had to install and compile a garbage collection package first, and change my configuration so that the gc.h include file could be found by gcc). Emacs-w3c works fine, a really nice extension to JDEE. One less reason to leave Emacs :-) Regards, Nascif -Original Message- From: Suraj Acharya [mailto:[EMAIL PROTECTED] Sent: Monday, April 26, 2004 1:23 PM To: Nascif Abousalh-Neto Cc: [EMAIL PROTECTED] Subject: Re: W3m binary for windows Take a look at http://www.w3m.org/. It has cygwin binaries for windows. Suraj On Mon, 26 Apr 2004 10:29:40 -0400, Nascif Abousalh-Neto [EMAIL PROTECTED] wrote: Hi there, I have been reading about w3m + Emacs and that some lucky guys out there are already browsing their Javadoc pages with it inside Emacs. How cool is that? :-) I would like to do the same as well, but I am having a hard time collecting all the pieces to build w3m on my WindowsXP + Cygwin box. I found some really old (1999) Windows binaries which don't seem to work. Does anybody has a more recent version available? And isn't this package useful enough to be included with the default JDE distribution - or at least to have a pointer to it in the JDEE documentation? Regards, Nascif
Re: auto newline, indent and close brace on open brace, return
Here you go: (defvar jde-auto-indent t Automatically indent new lines.) (defvar jde-gen-embrace t Typing enter after a close brace at the end of a line will insert a matching closing brace (if required) and put point on a empty line between the braces and indent the new lines. So if before you had: pubic void function () { ^ You now have: pubic void function () { } ^ Point must be at the end of the line, or at a } character followed by the end of the line. If it thinks a matching close brace already exists a new one is not inserted. Before: pubic void function () { } ^ After: pubic void function () { } ^ It does this by checking if the line containing the matching close brace is already correctly indented. If it is not then this close brace probabaly does not match the open brace at point and so a new close brace is inserted.) (defvar jde-gen-complete-multi-line-string t Typing enter at the end of a line with an unterminated string constant will result in the generation of the required string by adding a \\n character to the end of the line, closing the string, adding the string append operator (+) and starting a new string on the next line. Before: String a = \This is a multi-line string ^ After: String a = \This is a multi-line string\\n\ + \ ^) (defun jde-mode-return () Check if variables 'jde-gen-embrace or 'jde-gen-complete-multi-line-string are set and handle them appropriately. Automatically indents the new line if jde-auto-indent is true or if invoked by C-j (interactive) (let ((jde-auto-indent (or jde-auto-indent (equal last-command-char 10 (cond ((and jde-gen-complete-multi-line-string (jde-line-has-incomplete-string)) (jde-multi-line-string-enter)) ((and jde-gen-embrace (jde-line-end-at-open-brace)) (jde-gen-embrace)) (t (jde-newline ) (defun jde-line-end-at-open-brace () (and (= (preceding-char) ?{) (looking-at }?$))) (defun jde-gen-embrace () Adds a new line and inserts a matching close brace if required. See variable 'jde-gen-embrace. Assumes that 'jde-line-end-at-open-brace has been called and it returned true. (interactive) (let ((open-indent (current-indentation))) (when (looking-at }) ;; if there is a } after point, put it on a new line and come back (jde-newline) (end-of-line 0) ;; move to end of previous line ) ;; make a blank line (jde-newline) ;; Look for the matching close brace; if it is indented at the ;; level as the open brace or if indent-according-to-mode thinks ;; it is correctly indented, don't add a new close brace. (unless (save-excursion (condition-case err (progn (up-list 1) (let* ((old-close-indent (current-indentation)) (dummy (indent-according-to-mode)) (new-close-indent (current-indentation)) ;; save return value (ret (and (= (preceding-char) ?}) (or (= open-indent old-close-indent) (= old-close-indent new-close-indent) ;; set indent back to what it was (indent-line-to old-close-indent) ;; return result ret )) (error nil))) ;; add the } on a new indented line (insert }) (indent-according-to-mode) (end-of-line 0) ;; move to end of previous line (jde-newline (defun jde-line-has-incomplete-string () Returns true if point is at the end of the line and the current line has a mismatched doublequote character. (let* ((end (point)) (beg (save-excursion (beginning-of-line) (point))) (count 0)) (save-excursion (while (search-backward \ beg t) (unless (or (= (preceding-char) ?\\) (and (= (preceding-char) ?') (looking-at \'))) (incf count) ) )) (= (mod count 2) 1) )) (defun jde-multi-line-string-enter () Ends an unterminated string constant and coninues it on the next line. See variable 'jde-gen-complete-multi-line-string. Assumes that 'jde-line-has-incomplete-string was called and it returned true. (interactive) (insert \\n\ +) (jde-newline) (insert \) ) (defun jde-newline () (if jde-auto-indent (newline-and-indent) (newline))) (define-key jde-mode-map [return] 'jde-mode-return) (define-key jde-mode-map [(control j)] 'jde-mode-return)
Re: auto newline, indent and close brace on open brace, return
If you try the code that I posted here (it's not in CVS yet I think) you'll find that it doesn't depend solely on the value of (current-indentation) . If emacs thinks the line with matching close-brace is correctly indented (as it would in your example) then no close brace is inserted. Emacs does a pretty good of figuring out what the correct indentation should be based on the line preceeding point, but you are right, if you had a funky coding style which say required an extra space before the close brace then you would either have to teach emacs about it or turn this feature off. Bryan Shell wrote: I have issues with the use of `current-indentation'. This value will always return false if you have a rather long line and break it or like myself and put the `throws' clause on a separate line. public doSomeThingThat() throws somePoo { -- 4 } -- 2 This is even more trouble if you have to maintain a code base that was initially written by a different user that used a funky indention scheme that moved closing braces in a space or two. Another interesting unexpected behavior; the close brace is not inserted if there is any amount of whitespace between point and the open brace. I'll change the matching regexp to include any whitespace before the end of line. Here is a better (at least the way I think about) way of doing almost the same thing. Without worrying about indention levels, coding styles, or the myriad other pitfalls the previous way has. The drawback with your code is that one doesn't always want a close brace on a new line from the old one, think array definitions or empty methods or one liner methods for inner classes. Another way to do this would be to insert {} for the open brace and have the return character insert two newlines if point had a open and close brace before and after it. But this might be too surprising for people not expecting it. Also if I just typed an open brace followed by a close brace to create a empty method I would end up with two close brace chars. Balanced.el (http://www.cs.indiana.edu/chezscheme/emacs/balanced.el) gets around this by binding close parenthesis type keys to just move over the matching close parenthesis. I find it very useful, especially for lisp code but it is definitely an acquired taste. Suraj
Re: auto newline, indent and close brace on open brace, return
The brace matching code now uses parse-partial-sexp and handles the funky indentation case. Whitespaces are now allowed after the brace and around point. As suggested by Jens I also added a defcustom for jde-newline which lets you select what indentation function you want. The default value is ('newline) or no indentation. Control-j is bound to the same function as return but will always indent the new line. (defcustom jde-newline-function '(newline) Indent command that the enter key calls. :group 'jde :type '(list (radio-button-choice :format %t \n%v :tag Function: :entry-format %b %v (const newline) (const newline-and-indent) (const align-newline-and-indent) (function my-custom-newline-function))) ) (defcustom jde-gen-embrace t Typing enter after a close brace at the end of a line will insert a matching closing brace (if required) and put point on a empty line between the braces and indent the new lines. So if before you had: pubic void function () { ^ You now have: pubic void function () { } ^ Point must be at the end of the line, or at a } character followed by the end of the line. If it thinks a matching close brace already exists a new one is not inserted. Before: pubic void function () { } ^ After: pubic void function () { } ^ :type 'boolean ) (defcustom jde-gen-complete-multi-line-string t Typing enter at the end of a line with an unterminated string constant will result in the generation of the required string by adding a \\n character to the end of the line, closing the string, adding the string append operator (+) and starting a new string on the next line. Before: String a = \This is a multi-line string ^ After: String a = \This is a multi-line string\\n\ + \ ^ :type 'boolean ) (defun jde-line-end-at-open-brace () (and (looking-back {\\s-* (line-beginning-position)) (looking-at }?\\s-*$))) (defun jde-gen-embrace () Adds a new line and inserts a matching close brace if required. See variable 'jde-gen-embrace. Assumes that 'jde-line-end-at-open-brace has been called and it returned true. (interactive) (let ((open-indent (current-indentation))) (when (looking-at }) ;; if there is a } after point, put it on a new line and come back (jde-newline) (end-of-line 0) ;; move to end of previous line ) ;; make a blank line (jde-newline) (when (save-excursion ( (car (parse-partial-sexp (point-min) (point))) ;; parenthesis depth at point (- (car (parse-partial-sexp (point) (point-max) ;; number of unmatched open parenthesis staring from point ) ;; add the } on a new indented line (insert }) (indent-according-to-mode) (end-of-line 0) ;; move to end of previous line (jde-newline (defun jde-line-has-incomplete-string () Returns true if point is at the end of the line and the current line has a mismatched doublequote character. (let* ((end (point)) (beg (save-excursion (beginning-of-line) (point))) (count 0)) (save-excursion (while (search-backward \ beg t) (unless (or (= (preceding-char) ?\\) (and (= (preceding-char) ?') (looking-at \'))) (incf count) ) )) (= (mod count 2) 1) )) (defun jde-multi-line-string-enter () Ends an unterminated string constant and continues it on the next line. See variable 'jde-gen-complete-multi-line-string. Assumes that 'jde-line-has-incomplete-string was called and it returned true. (interactive) (insert \\n\ +) (jde-newline) (insert \) ) (defun jde-mode-return () Check if variables 'jde-gen-embrace or 'jde-gen-complete-multi-line-string are set and handle them appropriately. Automatically indents the new line if jde-auto-indent is true or if invoked by C-j (interactive) (let ((jde-newline-function (if (equal last-command-char 10) '(newline-and-indent) jde-newline-function))) (cond ((and jde-gen-complete-multi-line-string (jde-line-has-incomplete-string)) (jde-multi-line-string-enter)) ((and jde-gen-embrace (jde-line-end-at-open-brace)) (jde-gen-embrace)) (t (jde-newline) (defun jde-newline () This command invokes the function defined by `jde-newline-function'. (interactive) (call-interactively (car jde-newline-function))) (define-key jde-mode-map [return] 'jde-mode-return) (define-key jde-mode-map [(control j)] 'jde-mode-return) ;; Do an indent after a yank. (defadvice yank (after jde-indent-and-fix-strings-after-yank activate) (jde-indent-and-fix-strings-after-yank)) (defadvice yank-pop (after jde-indent-and-fix-strings-after-yank activate) (jde-indent-and-fix-strings-after-yank)) (lexical-let ((unescaped-quote (if (string-match XEmacs (version)) ;; no sregex in XEmacs
Re: auto newline, indent and close brace on open brace, return
Here are some bugfixes and enhancements to the original code. The close brace does not always get inserted now. First a simple check takes place to see if a matching close brace might already exist. This allows you to add a new line to the beginning of an existing block by typing enter at the open brace without an additional new brace getting inserted. The function bound to return now also tries to detect if current line has a unterminated string and assumes you are trying to enter a multi line string. It adds a java newline char, closes the string, and appends it to a new string that starts on the next line. This behavior is controlled by the variables jde-gen-embrace and jde-gen-complete-multi-line-string. I also modified the jde-indent-after-yank code that was posted here some time ago to let you paste multiline strings. It's been tested on both XEmacs also and I've been using it for the last few days so hopefully it should be reasonably bug-free. (defvar jde-gen-embrace t Typing enter after a close brace at the end of a line will insert a matching closing brace (if required) and put point on a empty line between the braces and indent the new lines. So if before you had: pubic void function () { ^ You now have: pubic void function () { } ^ Point must be at the end of the line, or at a } character followed by the end of the line. If it thinks a matching close brace already exists a new one is not inserted. Before: pubic void function () { } ^ After: pubic void function () { } ^ It does this by checking if the line containing the matching close brace is already correctly indented. If it is not then this close brace probabaly does not match the open brace at point and so a new close brace is inserted.) (defvar jde-gen-complete-multi-line-string t Typing enter at the end of a line with an unterminated string constant will result in the generation of the required string by adding a \\n character to the end of the line, closing the string, adding the string append operator (+) and starting a new string on the next line. Before: String a = \This is a multi-line string ^ After: String a = \This is a multi-line string\\n\ + \ ^) (defun jde-line-end-at-open-brace () (and (= (preceding-char) ?{) (looking-at }?$))) (defun jde-gen-embrace () Adds a new line and inserts a matching close brace if required. See variable 'jde-gen-embrace. Assumes that 'jde-line-end-at-open-brace has been called and it returned true. (interactive) (let ((open-indent (current-indentation))) (when (looking-at }) ;; if there is a } after point, put it on a new line and come back (newline-and-indent) (end-of-line 0) ;; move to end of previous line ) ;; make a blank line (newline-and-indent) ;; Look for the matching close brace; if it is indented at the ;; level as the open brace or if indent-according-to-mode thinks ;; it is correctly indented, don't add a new close brace. (unless (save-excursion (condition-case err (progn (up-list 1) (let* ((old-close-indent (current-indentation)) (dummy (indent-according-to-mode)) (new-close-indent (current-indentation)) ;; save return value (ret (and (= (preceding-char) ?}) (or (= open-indent old-close-indent) (= old-close-indent new-close-indent) ;; set indent back to what it was (indent-line-to old-close-indent) ;; return result ret )) (error nil))) ;; add the } on a new indented line (insert }) (c-indent-line) (end-of-line 0) ;; move to end of previous line (newline-and-indent (defun jde-line-has-incomplete-string () Returns true if point is at the end of the line and the current line has a mismatched doublequote character. (let* ((end (point)) (beg (save-excursion (beginning-of-line) (point))) (count 0)) (save-excursion (while (search-backward \ beg t) (unless (or (= (preceding-char) ?\\) (and (= (preceding-char) ?') (looking-at \'))) (incf count) ) )) (= (mod count 2) 1) )) (defun jde-multi-line-string-enter () Ends an unterminated string constant and coninues it on the next line. See variable 'jde-gen-complete-multi-line-string. Assumes that 'jde-line-has-incomplete-string was called and it returned true. (interactive) (insert \\n\ +) (newline-and-indent) (insert \) ) (defun jde-mode-return () Check if variables 'jde-gen-embrace or 'jde-gen-complete-multi-line-string are set and handle them appropriately. (interactive) (cond ((and jde-gen-complete-multi-line-string (jde-line-has-incomplete-string)) (jde-multi-line-string-enter)) ((and jde-gen-embrace
Re: Exception stack trace: goto file/line
The jde-run-etrace-* commands do this too, take a look at http://www.mail-archive.com/[EMAIL PROTECTED]/msg06868.html Paul Landes wrote: I couldn't find anything that did this. Let me know if I have reinvented the wheel. If someone with CVS access wants to add this, I'll leave it up to them where they want to add it. I wrote everything Emacs friendly under XEmacs. Let me know if you have problems, and I will add this to my `make compat with emacs' todo list. ;;; code starts here (defun jde-exception-stack-trace-parse-line () Parse the current line of an exception stack trace. The class name, method and (if provided) the source file line number, are returned in a list. (let (eol line class method lineno) (save-excursion (save-match-data (end-of-line) (setq eol (point)) (beginning-of-line) (when (re-search-forward ^[ \t]*at \\(.+\\)\\.\\(.+\\)([^:)]+:?\\([0-9]+\\)?)$ eol t) (setq class (match-string 1) method (match-string 2) lineno (let ((s (match-string 3))) (and s (string-to-int s (list class method lineno) ) (defun jde-exception-stack-trace-goto-error () Go to the Java source file indicated by the line at the current point of an exception stack trace. Also go to the line number if given by the stack trace. The line must be a stack trace line meaning it looks like `at class ...', otherwise an error is signaled. (interactive) (let* ((exception-info (jde-exception-stack-trace-parse-line)) source-file) (if (null exception-info) (error line doesn't appear to be an exception stack trace line)) (setq class (first exception-info) method (second exception-info) lineno (third exception-info) source-file (jde-find-class-source-file class)) (if (not source-file) (error class `%s' not found (first exception-info)) (find-file source-file) (if lineno (goto-line lineno)) (message (concat (format Method `%s' method) (if lineno (format in line %d lineno)) (format of `%s' class))) ))) ;;; code ends here
Re: auto newline, indent and close brace on open brace, return
The code I posted earlier today should take care of problem 1. For problem 2, I shall make the folllowing changes: a) bind both C-j and return to jde-mode-return, C-j will always indent the newly added lines. b) add a variable jde-auto-indent which would control if auto indentation is on or not. Is there a variable that does this? I just bind [return] to newline-and-indent. Suraj Hai Nguyen wrote: Hello, I downloaded jde.el file (and new dependent files) from the CVS to fix a syntax highlight issue, but then got the auto-indent issue. Being a newbie, it took me a while to figure out that it's due to the binding ot [enter] to jde-gen-embrace. I see two issues with the command: 1- If you already have the following code: if (some-cond) { doSomething(); } Now if you need to add code above doSomething(), and hit enter after the opening bracket, you get: if (some-cond) { ^ } doSomething(); } 2- I don't like auto-indent and prefer to do so using tab. It would be nice if jde-gen-embrace checked for my preferences before doing a newline-and-indent. So that if I had set auto-indent it would do a newline-and-indent, otherwise it would just insert a newline. I like the auto matching closing bracket idea, but ended up unbinding the [enter] key mapping because of the above issues. Just my $.02 -Hai. (Sorry I don't know how to implement that in elisp). __ Do you Yahoo!? Yahoo! Search - Find what youre looking for faster http://search.yahoo.com
Re: Convenient javadoc access
Robert Mecklenburg wrote: I've used jde for four years and love it, thanks for this great software! Currently, I have 24 separate java packages installed on my machine (and I'm just getting started). Each one has its own javadoc api directory. When I see a class I'm not familiar with I want to see its javadoc, but I often don't know which of the 24 javadoc packages is appropriate to search. JDE has this great javadoc lookup facility in jde-help-symbol and the docsets variable, but to use it for this kind of browsing I need to: 1. find a .java file with a properly configured prj.el 2. add a declaration for the class I'm looking up 3. add the import for the class 4. invoke jde-help-symbol It would be very cool if I could use jde-help-symbol (or a new function) to without performing steps 2 and 3 (I appreciate that a properly set docsets is required). I have enough skill to write a lisp method to prompt for the class name, create a new .java file, fill it a declaration, invoke import, invoke jde-help-symbol, then delete the whole thing. Clearly, a horrible hack. How can I implement what I want? Thanks, Have you looked at jde-help-class? It accepts a unqualified class name from the minibuffer, looks it up and brings up the javadocs. As for help with figuring out which project the class belongs to, maybe you could create a 25th project with classpath entries and docsets from all the other projects. Suraj
auto newline, indent and close brace on open brace, return
Intellij does this thing where if you type a open curly brace and then a return it inserts a matching closing brace and puts point on a empty line between the braces and indents the two newlines. So if before you had: pubic void function () { ^ You now have: pubic void function () { }^ Simple but handy. (define-key jde-mode-map [return] (lambda () (interactive) (if (save-excursion (backward-char) (not (looking-at {}?$))) (newline-and-indent) ;; else (newline-and-indent) (newline-and-indent) (when (not (looking-at })) (insert }) (c-indent-command) ) (previous-line) (c-indent-command) ))) Suraj PS: The above is slightly more complicated than needs be because I use Erik Hilsdale's balanced.el which, among other things, automatically inserts matching close parenthese when you type any kind of open parentheses.
Re: auto newline, indent and close brace on open brace, return
Petter Måhlén wrote: Hi, This seems like a good idea to me, but I had two problems when trying it out. First, I got an error message saying something like if: wrong number of arguments. I then tried the following update which I think is correct (added parentheses around the else clause): (define-key jde-mode-map [return] (lambda () (interactive) (if (save-excursion (backward-char) (not (looking-at {}?$))) (newline-and-indent) ;; else ((newline-and-indent) (newline-and-indent) (when (not (looking-at })) (insert }) (c-indent-command) ) (previous-line) (c-indent-command) But then I got an error message saying: if: Invalid function: (newline-and-indent). Where is newline-and-indent defined? / Petter My emacs (21.3.50) allows multiple else expressions, perhaps earlier elisps don't. You need a progn around the else expressions (define-key jde-mode-map [return] (lambda () (interactive) (if (save-excursion (backward-char) (not (looking-at {}?$))) (newline-and-indent) ;; else (progn (newline-and-indent) (newline-and-indent) (when (not (looking-at })) (insert }) (c-indent-command) ) (previous-line) (c-indent-command) This should fix the if: Invalid function: (newline-and-indent) problem too. Emacs is trying to call the value returned by (newline-and-indent) as a function. If not I have newline-and-indent in emacs/lisp/simple.el: (defun newline-and-indent () Insert a newline, then indent according to major mode. Indentation is done using the value of `indent-line-function'. In programming language modes, this is the same as TAB. In some text modes, where TAB inserts a tab, this command indents to the column specified by the function `current-left-margin'. (interactive *) (delete-horizontal-space t) (newline) (indent-according-to-mode)) -Original Message- From: Suraj Acharya [mailto:[EMAIL PROTECTED] Sent: den 3 mars 2004 13:55 To: [EMAIL PROTECTED] Subject: auto newline, indent and close brace on open brace, return Intellij does this thing where if you type a open curly brace and then a return it inserts a matching closing brace and puts point on a empty line between the braces and indents the two newlines. So if before you had: pubic void function () { ^ You now have: pubic void function () { }^ Simple but handy. (define-key jde-mode-map [return] (lambda () (interactive) (if (save-excursion (backward-char) (not (looking-at {}?$))) (newline-and-indent) ;; else (newline-and-indent) (newline-and-indent) (when (not (looking-at })) (insert }) (c-indent-command) ) (previous-line) (c-indent-command) ))) Suraj PS: The above is slightly more complicated than needs be because I use Erik Hilsdale's balanced.el which, among other things, automatically inserts matching close parenthese when you type any kind of open parentheses.
Re: Trying to understand completion behaviour
Paul Kinnucan wrote: Jens Lautenbacher writes: Hi, I try to figure out why completion does not work when I try to complete on a Class name. Say the class FooBarBaz is somewhere on my classpath, and I'm in a source buffer with point just after Foobar (the ^ denotes point): FooBar ^ trying to complete on the classname doesn't work, but I don't understand why this is not enabled. When I have FooBarBaz ^ trying to complete will insert an import statement for FooBarBaz and leave my buffer looking like this FooBarBaz() ^ So JDE already recognizes that the thing before point should be tried as a classname, and an import statement should be generated if it is found. Why can't it try to complete on the prefix FooBar then? Because no one has yet bothered to implement completion of class names, which is a fundamentally different problem from completion of class methods and fields. I even think that the () shouldn't be inserted into this case, because most often what I try to do is something like FooBarBaz fbz = new FooBarBaz(...) with completion on the available classes. So supposing somebody took the trouble to implement completion of class names, how do you think the user should convey to the JDEE that they are seeking completion of the constructor as opposed to completion of a class name? One could look at the java naming conventions for hints to determine the kind of entity we are trying to complete. FooBar ^ would lead to classname completion, while fooBar ^ would not. Another option would be only complete against imported classes (and classes in the same package). This would not be as costly as always trying to complete against all classes in the classpath. Btw, there does seem to be a bug similar to the one Jens pointed out. If you run jde-complete at foo.bar(). and foo.bar() ^ ^ you get the same completion list. Note the missing . in the second example. After choosing say baz(), the lines look like foo.bar().baz() and foo.bar()baz() Perhaps a . should be inserted in the second case? Suraj
Re: fatal error
Latchezar Dimitrov wrote: You were right. It blows up. However a little investigation shows the only thing missing is fns-21.3.1.el. You can get it from the old 21.3 or as the others did by unpacking the new over the old. Latchezar I think this is a generated file so the fact that it does not get created with the 21.3a binary may indicate that the problem is more than just a missing file. But as was pointed out earlier the version on ftp.gnu.org is older than the one on http://www.crasseux.com/emacs/ even though the former was built on 2/21/2004. I was hoping to try out the new fringe bitmap support in cvs: http://mail.gnu.org/archive/html/emacs-devel/2004-02/msg00207.html but I guess I will have to compile my own. Suraj
Re: complete
Unless something has changed recently you would also need to setup your jde-global-classpath to point to the classes generated from these sources. Your classpath for bsh also has the directories from your sourcepath. If you are using a beanshell 2.0 jar and you know that bsh can parse your .java files without any problems you might be ok, but otherwise you need to jde-sourcepath to include only your src directories and put in all external jars and directories or jars of genrated classes in jde-global-classpath. Suraj Richard Martin wrote: Thanks for your help My version of jde is jde-2.3.2. I have nothing in my prj.el since I am setting all the options in the menus. my source path is [INS] [DEL] Path: ~/workspace/product/ota/src/ [INS] [DEL] Path: ~/workspace/product/axis/src/ [INS] [DEL] Path: ~/workspace/product/db/src/ [INS] [DEL] Path: ~/workspace/product/net/src/ [INS] [DEL] Path: ~/workspace/product/netsh/src/ [INS] [DEL] Path: ~/workspace/product/spine/src/ [INS] [DEL] Path: /data/JBoss-2.4.10_Tomcat-3.2.3/jboss/lib/ext/jboss.jar the output from the bsh buffer is cd /users/richard/workspace/product/ota/src/system/servlet/ /usr/java/jdk1.3.1_04/bin/java -classpath /usr/share/xemacs/xemacs-packages/etc/jde/java/bsh-commands:/usr/java/jdk1.3.1_04/lib/tools.jar:/opt/java/jakarta-ant-1.5/lib/ant.jar:/opt/java/jakarta-ant-1.5/lib/clover.jar:/opt/java/jakarta-ant-1.5/lib/genjar.jar:/opt/java/jakarta-ant-1.5/lib/junit.jar:/opt/java/jakarta-ant-1.5/lib/optional.jar:/opt/java/jakarta-ant-1.5/lib/xercesImpl.jar:/opt/java/jakarta-ant-1.5/lib/xml-apis.jar:/usr/share/xemacs/xemacs-packages/etc/jde/java/lib/checkstyle-all.jar:/usr/share/xemacs/xemacs-packages/etc/jde/java/lib/jakarta-regexp.jar:/usr/share/xemacs/xemacs-packages/etc/jde/java/lib/jde.jar:/usr/share/xemacs/xemacs-packages/etc/jde/java/lib/bsh.jar:/users/richard/workspace/product/ota/src/:/users/richard/workspace/product/axis/src/:/users/richard/workspace/product/db/src/:/users/richard/workspace/product/net/src/:/users/richard/workspace/product/netsh/src/:/users/richard/workspace/product/spine/src/ bsh.Interpreter BeanShell 1.2.7 - by Pat Niemeyer ([EMAIL PROTECTED]) bsh % Cheers Richard Paul Landes wrote: Auto completion uses bsh to do classpath lookups using `jde-sourcepath'; are you setting this? We don't have much to go on, can you please post your prj.el, JDEE version (`jde-version') and any other configuration, please. Richard Martin writes: Hi I have been using JDEE for a while but I cant get auto complete to work on my own classes. It says No completions available at this time. My entire project builds (with and without ant) so I must have my classpath setup correctly. Is there something else I need to set? I noticed that there bsh-commands directory in my xemacs packages - do i need that or is that only present in later versions? Thanks Richard
Re: [jde] cedet-1.0beta1 /Semantic 2.0 and JDEE-2.3.2
I just tried out flymake and it is pretty neat. It highlights errors as advertised and brings up a little pop-up window with the error message when your mouse is over the line. If you have jde-compile setup correctly to compile the current file then this redefinition for flymake-start-syntax-check-process will automatically run jde-compile. Caveats : * flymake automatically saves your current buffer before it compiles * the error/warning message do not appear in the minibuffer when point is on a line which has been highlighted. * may not be very nice on a slower machine using javac (defun flymake-start-syntax-check-process(buffer base-dir master-file-name patched-master-file-name source-file-name patched-source-file-name) start syntax check-process (let* ((process nil) (file-to-compile (flymake-get-file-to-compile patched-master-file-name patched-source-file-name source-file-name)) (compiler (jde-compile-get-the-compiler)) (program-name (oref compiler :path)) (program-args (append (jde-compile-get-args compiler) (list file-to-compile (condition-case err (progn (setq process (get-process (apply 'start-process flymake-proc nil program-name program-args))) (set-process-sentinel process 'flymake-process-sentinel) (set-process-filter process 'flymake-process-filter) (flymake-reg-names(process-id process) (buffer-name buffer) patched-master-file-name patched-source-file-name) (flymake-set-buffer-base-dir buffer base-dir) (flymake-set-buffer-master-file-name buffer master-file-name) (flymake-set-buffer-is-running buffer t) (flymake-set-buffer-last-change-time buffer nil) (flymake-set-buffer-check-start-time buffer (float-time)) (flymake-report-status buffer nil *) (flymake-log 2 started process %d, command=%s, dir=%s (process-id process) (process-command process) default-directory) process ) (error (let ((err-str (format Failed to launch syntax check process '%s' with args %s: %s program-name program-args (error-message-string err (flymake-log 0 err-str) (flymake-safe-delete-file patched-master-file-name) (flymake-safe-delete-file patched-source-file-name) (flymake-set-buffer-last-change-time buffer nil) (flymake-report-fatal-status buffer PROCERR err-str) ) ) ) ) ) Suraj Eric M. Ludlam wrote: The support for highlighting unmatched syntax is still rudimentary, but it is a longterm goal to highlight all syntactic issues. Parsing an entire file is pretty slow. Parsing only the visible parts, is one option. For missing ; after things already being parsed (method and type declarations) you will get the highlighting. The new incremental parser helps with this. Detecting missing imports or methods is not a part of any short term plan. The semantic analyzer has not been modified much as we've been concentrating on low level APIs, and speed. The version of eieio in the beta includes a feature similar to something I think is called flymake. You can run a build, and it will detect the errors, and highlight them for you. I think flymake may have more user features. The version in eieio is an example program for using a line highlighting feature. Eric
Re: ECB 2.01 released!
Bzip2 http://sources.redhat.com/bzip2/ try tar -jxcf instead of tar -zxvf Suraj James Cox wrote: I had the same problem. Cygwin tar didn't grok it either. I downloaded the trial version of powerarchiver, that seemed to do the trick. Maybe someone can clue us in on an open source tool that can do the same... -Original Message- From: Jayakrishnan Nair [mailto:[EMAIL PROTECTED] Sent: Friday, November 07, 2003 4:39 PM To: [EMAIL PROTECTED] Subject: RE: ECB 2.01 released! I downloaded the binary from the site and the file is emacs_bin_cvs_2003_09_20.tar.bz2. WinZip cannot open it. Is there any tool to open .bz2 files ? -Original Message- From: Suraj Acharya [mailto:[EMAIL PROTECTED] Sent: Wednesday, November 05, 2003 1:11 AM To: Berndl, Klaus; [EMAIL PROTECTED] Subject: Re: ECB 2.01 released! Berndl, Klaus wrote: Cool Stuff. I tried setting ecb-tree-buffer-style to image and it did not change from Ascii with guide-lines. I am using GNU Emacs 21.2.1 on Windows 2K Of course, because GNU Emacs 21.2 does not support images on windows ;-) The image-code for Windows is only in the cvs. So, the image-style works only for XEmacs, GNU Emasc 21 for Unix/linux or GNU Emacs 21 cvs. And you can get GNU Emacs 21 cvs for windows from here : http://www.crasseux.com/emacs/ Suraj This E-mail message is for the sole use of the intended recipient(s) and may contain confidential and privileged information. Any unauthorized review, use, disclosure or distribution is prohibited. If you are not the intended recipient, please contact the sender by reply E-mail, and destroy all copies of the original message.
Re: Syntax checking the current buffer
My post from yesterday titled class and package name completion for jde-open-class-source provides this kind of completion. It is modelled on Intellij's Find-Class functionality and is in fact a little better because it handles inner classes correctly. It has some modifications for jde-xref.el, jde-open-source.el and some defuns for your .emacs. You have to get set-up jde-xref and call jde-xref-make-xref-db first. Comments and feedback are welcome. Suraj Henrik Kjær wrote: Hi I really like the JDE, but I am missing syntax checking which could help to optimize the development process as it would remove a lot of small errors before compiling, e.g. a missing ;, using an unknown class (e.g. Strin when I ment String), etc. Is there any plans to extend JDE with syntax checking or does anyone know about a syntax checking mode for Java in Emacs!? I would also like if the JDE could help me find classes by using completion, e.g if I have classes called MyClass and MyOtherClass, I would just type My and JDE could help me find those classes. I know JDE uses reflection to find classes so I have to type the exact name, but I can not always remember the full and exact name of all my classes, so such a tool could some in handy - for me at least :-) Henrik
Re: jde + emacs-w3m problem
Is there a way to get the javadocs into a separate frame that gets reused? Adding *w3m* to special-display-buffer-names did not do the trick. Suraj Nick Sieger wrote: JC == James Cox [EMAIL PROTECTED] writes: JC Hi Paul, JC If I remember correctly, integration was pretty much a snap. JC After JC installing emacs-w3m-1.3.4, and w3m 0.4.1, I needed to modify JC jde-file-to-url because there seemed to be some discrepancy in how JC jdee and w3m handle URL file notation. (see previous email). I JC also added: JC (setq browse-url-browser-function 'w3m-browse-url) JC to my .emacs. Indeed, it was easy for me as well. [Aside: I was also pleasantly surprised that cygwin gcc handled w3m out of the box. Guess I don't realize just how good an emulation layer cygwin is.] In addition to the above plus '(jde-help-use-frames nil), I added this advice which causes the javadoc to jump up in another window. Good for javadoc, probably less so if you use emacs-w3m a lot for other browsing. There's probably a better way to do this from within the JDEE, but for me it works great. (defadvice w3m-browse-url (before njs-w3m-browse-url-new-window activate compile) Always w3m-browse links in a new window. (ad-set-arg 1 t))
Completion for jde-open-class-source
Here is my not so good way of getting class name completion for C-c C-v C-y. (defvar jde-all-built-classes '()) (with-all-class-files (name) (let* ((start-pos (string-match /\\([a-zA-Z0-9]*\\)\\.class name)) (end-pos (match-end 1))) (when (and start-pos end-pos) (setq classes (cons (list (substring name (+ 1 start-pos) end-pos)) jde-all-built-classes) (defun jde-open-class-source-new () (interactive) (if jde-all-built-classes (jde-open-class-source (completing-read Class: jde-all-built-classes)) (jde-open-class-source))) And then bind C-c C-v C-y to jde-open-class-source-new instead of jde-open-class-source. The extra check for nullness of jde-all-built-classes is because I don't run the (with-all-class-files ... bit on start-up, but rather by hand, since it takes a bit of time to complete. I'm looking into integrating this with jde-xref so the class names get cached across jde sessions. Does anyone have any ideas or suggestions for better ways of doing this? Suraj Acharya