RE: Javadoc comments
Hi! Smart ENTER in all cc-mode based major-modes (so also for jde-mode): Here is what i have bound to RET in my c-mode-common-hook (jde-mode inherits all this!): (defun my-cc-mode-return () Intelligent line breaking in all cc-modes. Handles strings in a smart way (interactive) (cond ((eq (c-in-literal) 'string) (if (or (eq major-mode 'java-mode) (eq major-mode 'jde-mode)) (insert-and-inherit \+) (insert-and-inherit \)) (c-context-line-break) (insert \ ) ;; cause of strings in c will be concatenated we ;; must add a single space. (end-of-line)) (t (c-context-line-break With this function you will get best and smartest results after hitting ENTER regardless if in code, if within a string or within a comment. Some more maybe usefull settings: = Here are some of my other cc-mode common settings which should be also useful for java (all this code is added to c-mode-common-hook!): ;; comments should be treated as whitespace in paren-matching, jumping ;; etc. (setq parse-sexp-ignore-comments t) ;; we like auto-newline and hungry-delete (c-toggle-auto-hungry-state 1) ;; keybindings for C, C++, and Objective-C. We can put these in ;; c-mode-base-map because c++-mode-map and java-mode-map and ;; c-mode-map inherit it. (define-key c-mode-base-map \C-m 'my-cc-mode-return) ;; lines of a c-block-comment should begin with a (set-variable 'c-block-comment-prefix ) ;; we want no autofilling within cpp-makros string-literals and normal code (set-variable 'c-ignore-auto-fill '(string cpp code)) ;; turn on adaptive auto-fill-mode for max. easy writing comments (auto-fill-mode 1) (c-setup-filladapt) (turn-on-filladapt-mode) ;; no automatic newlines after ';' if following line is non blank or ;; inside oneline inline methods (add-to-list 'c-hanging-semicomma-criteria 'c-semicomma-no-newlines-before-nonblanks) (add-to-list 'c-hanging-semicomma-criteria 'c-semicomma-no-newlines-for-oneline-inliners) Maybe someone find these settings also useful. Block closing comments: === Ok, and here comes codes which add automatically after every closing } auto. after hitting } a block-closing comment so you see for large blocks which statement is closed by }: To get the following code below working you have to add (block-close . my-c-snug-do-while) to c-hanging-braces-alist, so e.g. a sensefull setting could be: (c-hanging-braces-alist . ((substatement-open . my-set-begin-block) (brace-list-open) (brace-list-close) (brace-list-intro) (brace-entry-open) (block-close . my-c-snug-do-while))) Here comes the code: ;; ;; comment block-close ;; The communication-channel between `my-c-snug-do-while' and ;; `comment-block-close': `block-close-data' is set during the call of the ;; ACTION-function `my-c-snug-do-while' and evaluated within the ;; `c-special-indent-hook' (here `comment-block-close', s.b.) ;; If not nil it is a list of the following elements: ;; 1. The text of the comment to be inserted behind the closing brace of ;;the block. ;; 2. The exact position at which the closing brace was inserted ;; 3. The size of the block in lines (defvar block-close-data nil) ;; define here how many lines a block at least must contain so the ;; block-close-comment will be added. (defcustom c-block-close-min-size-to-comment 15 *Define how many lines a block at least must contain so the block-close-comment will be added. :type 'integer :group 'c) (defun comment-block-close () For all blocks unless do-while-blocks this function adds after the block-close-brace the block-begin-statement as comment, for example: for \(i = 1; i 6; i++\) \{ cout i; ... \} // for \(i = 1; i 6; i++\) Already hitting the '\}' inserts the comment! This works only if the autonewline-feature of cc-mode is turned on! (if (and block-close-data ( (nth 2 block-close-data) c-block-close-min-size-to-comment)) ;; Because this function is hooked to c-special-indent-hook and ;; therefore called after EVERY indentation, we do the ;; comment-insert only if we have a block and it´s not a do-while and ;; block is larger the 'block-close-min-size-to-comment' lines (save-excursion ;; frirst we must do some stuff to go to the right position for the ;; block-close-comment: (goto-char (nth 1 block-close-data)) (if (not (looking-at [ \t]*})) (next-line 1)) (end-of-line) (forward-sexp -1) (forward-sexp 1) ;; now we are on
cygwin-emacs and classpath under jdee
Hello, Recently I installed on my WinXP box last cygwin version with emacs-21.2 with X toolkit. Jdee translates classpath almost well except that it puts ':' between directories instead of ';'. Earlier when I compiled emacs on my own under this environment it worked well, I could even use both unix-like and windows-like path style when loeaded files (i mean i could use: d:/file.java and /cygdrive/d/file.java) and in paths I always got ';' as needed, however it looks like cygwin-emacs version only sees cygwin path and path style but it doesn't know about windows anything. And probably jdee rely on emacs knowledge about path style. So my questions is: does anybody know how to force jdee to put ';' as path/file separator instead of ':'. I want classpath like this: d:/jar1.jar;d:/jar2.jar;d:/jar3.jar instead of: d:/jar1.jar:d:/jar2.jar:d:/jar3.jar what i currently get. regards Artur Hefczyc -- Artur Hefczyc[EMAIL PROTECTED] Open Source Developer http://wttools.sourceforge.net/
RE: cygwin-emacs and classpath under jdee
Do not know exactly, but JDE checks sometimes the following condition: (if (eq system-type 'cygwin32)...) and here is: (defvar jde-classpath-separator (if (eq system-type 'cygwin32) ; path-separator) The separator to use in a classpath. This is usually the same as `path-separator') So, normally it should work i would say. Check the value of system-type in your cygwin Emacs 21.2. Maybe it's different!? Ciao, Klaus -Original Message- From: Artur Hefczyc To: jdee Sent: 12.09.02 10:47 Subject: cygwin-emacs and classpath under jdee Hello, Recently I installed on my WinXP box last cygwin version with emacs-21.2 with X toolkit. Jdee translates classpath almost well except that it puts ':' between directories instead of ';'. Earlier when I compiled emacs on my own under this environment it worked well, I could even use both unix-like and windows-like path style when loeaded files (i mean i could use: d:/file.java and /cygdrive/d/file.java) and in paths I always got ';' as needed, however it looks like cygwin-emacs version only sees cygwin path and path style but it doesn't know about windows anything. And probably jdee rely on emacs knowledge about path style. So my questions is: does anybody know how to force jdee to put ';' as path/file separator instead of ':'. I want classpath like this: d:/jar1.jar;d:/jar2.jar;d:/jar3.jar instead of: d:/jar1.jar:d:/jar2.jar:d:/jar3.jar what i currently get. regards Artur Hefczyc -- Artur Hefczyc[EMAIL PROTECTED] Open Source Developer http://wttools.sourceforge.net/
Re: Javadoc comments
Thanks for posting your Java specific code Klaus, my .emacs is now packed to the gunwales with your cc-mode and tempo enhancements.
RE: Javadoc comments
hi, On Wed, 11 Sep 2002, Daniel Hegyi wrote: I know. However, is there a way of getting this functionality when starting a new line (i.e., hitting ENTER)? I'd like to get an asterisk then as well. I discovered by accident that if you turn on auto-fill-mode and begin typing within a javadoc comment, the line will automatically wrap, add an asterisk, and indent to the appropriate place within the comment. - david When I'm typing a javadoc comment I'd like to have every new line automatically start with an asterisk. How can I do this? if have the following lines in somewhere in my java-mode-hook ;; borrowed from Kai Grossjohann ;; return in comments inserts comments sign (define-key c-mode-base-map [(return)] '(lambda () (interactive) (c-indent-command) (c-context-line-break) )) heinz-dieter conradi
RE: Javadoc comments
Thanks for the nifty code, Klaus. Your `my-cc-mode-return' function led me to wonder if there was a way to make auto-fill/filladapt obey string semantics. It'd be slick if hitting space after the fill-column would close the current string and re-open it in the proper way on the next line. I looked at the lisp code for auto-fill/filladapt but did not see any obvious hooks to make this work. Anyone have an idea? /Nick -Original Message- From: Berndl, Klaus [mailto:[EMAIL PROTECTED]] Sent: Thursday, September 12, 2002 3:10 AM To: 'Matthias Papesch '; '[EMAIL PROTECTED] ' Subject: RE: Javadoc comments Hi! Smart ENTER in all cc-mode based major-modes (so also for jde-mode): Here is what i have bound to RET in my c-mode-common-hook (jde-mode inherits all this!): (defun my-cc-mode-return () Intelligent line breaking in all cc-modes. Handles strings in a smart way (interactive) (cond ((eq (c-in-literal) 'string) (if (or (eq major-mode 'java-mode) (eq major-mode 'jde-mode)) (insert-and-inherit \+) (insert-and-inherit \)) (c-context-line-break) (insert \ ) ;; cause of strings in c will be concatenated we ;; must add a single space. (end-of-line)) (t (c-context-line-break With this function you will get best and smartest results after hitting ENTER regardless if in code, if within a string or within a comment. Some more maybe usefull settings: = Here are some of my other cc-mode common settings which should be also useful for java (all this code is added to c-mode-common-hook!): ;; comments should be treated as whitespace in paren-matching, jumping ;; etc. (setq parse-sexp-ignore-comments t) ;; we like auto-newline and hungry-delete (c-toggle-auto-hungry-state 1) ;; keybindings for C, C++, and Objective-C. We can put these in ;; c-mode-base-map because c++-mode-map and java-mode-map and ;; c-mode-map inherit it. (define-key c-mode-base-map \C-m 'my-cc-mode-return) ;; lines of a c-block-comment should begin with a (set-variable 'c-block-comment-prefix ) ;; we want no autofilling within cpp-makros string-literals and normal code (set-variable 'c-ignore-auto-fill '(string cpp code)) ;; turn on adaptive auto-fill-mode for max. easy writing comments (auto-fill-mode 1) (c-setup-filladapt) (turn-on-filladapt-mode) ;; no automatic newlines after ';' if following line is non blank or ;; inside oneline inline methods (add-to-list 'c-hanging-semicomma-criteria 'c-semicomma-no-newlines-before-nonblanks) (add-to-list 'c-hanging-semicomma-criteria 'c-semicomma-no-newlines-for-oneline-inliners) Maybe someone find these settings also useful. Block closing comments: === Ok, and here comes codes which add automatically after every closing } auto. after hitting } a block-closing comment so you see for large blocks which statement is closed by }: To get the following code below working you have to add (block-close . my-c-snug-do-while) to c-hanging-braces-alist, so e.g. a sensefull setting could be: (c-hanging-braces-alist . ((substatement-open . my-set-begin-block) (brace-list-open) (brace-list-close) (brace-list-intro) (brace-entry-open) (block-close . my-c-snug-do-while))) Here comes the code: ;; ;; comment block-close ;; The communication-channel between `my-c-snug-do-while' and ;; `comment-block-close': `block-close-data' is set during the call of the ;; ACTION-function `my-c-snug-do-while' and evaluated within the ;; `c-special-indent-hook' (here `comment-block-close', s.b.) ;; If not nil it is a list of the following elements: ;; 1. The text of the comment to be inserted behind the closing brace of ;;the block. ;; 2. The exact position at which the closing brace was inserted ;; 3. The size of the block in lines (defvar block-close-data nil) ;; define here how many lines a block at least must contain so the ;; block-close-comment will be added. (defcustom c-block-close-min-size-to-comment 15 *Define how many lines a block at least must contain so the block-close-comment will be added. :type 'integer :group 'c) (defun comment-block-close () For all blocks unless do-while-blocks this function adds after the block-close-brace the block-begin-statement as comment, for example: for \(i = 1; i 6; i++\) \{ cout i; ... \} // for \(i = 1; i 6; i++\) Already hitting the '\}' inserts the comment! This works only if the autonewline-feature of cc-mode is turned on! (if (and block-close-data ( (nth 2 block-close-data)
Re: Javadoc comments
Nick == Nick Sieger [EMAIL PROTECTED] writes: Nick Thanks for the nifty code, Klaus. Your `my-cc-mode-return' Nick function led me to wonder if there was a way to make Nick auto-fill/filladapt obey string semantics. It'd be slick if Nick hitting space after the fill-column would close the current Nick string and re-open it in the proper way on the next line. I Nick looked at the lisp code for auto-fill/filladapt but did not Nick see any obvious hooks to make this work. Anyone have an idea? Probably better to bind this to a key and do it manually. Several short strings catenated together will probably before significantly worse than a single long one, and should happen by programmer choice, when it doesn't matter (debug, or fatal error reports), rather than automatically. Also its very easy to do this way (defun insert-new-string-line() (interactive) (insert \ +\n) (insert \) (indent-according-to-mode)) Cheers Phil
Starting to use the beta: What do I need to know
Title: Starting to use the beta: What do I need to know I am trying 2.2.9beta12 for the first time today for the purpose of debugging an application. I just stumbled across the fact that there is a new variable jde-sourcepath that I should know about. Is there a list of these types of changes that I can refer to? Thanks, Dale
Starting to use the beta: What do I need to know
Dale Wyttenbach writes: I am trying 2.2.9beta12 for the first time today for the purpose of debugging an application. I just stumbled across the fact that there is a new variable jde-sourcepath that I should know about. Is there a list of these types of changes that I can refer to? What's wrong with the release notes included in every JDEE distribution and also on the web site? - Paul
RE: cygwin-emacs and classpath under jdee
Earlier when I compiled emacs on my own under this environment it worked well, I could even use both unix-like and windows-like path style when loeaded files (i mean i could use: d:/file.java and /cygdrive/d/file.java) and in paths I always got ';' as needed, however it looks like cygwin-emacs version only sees cygwin path and path style but it doesn't know about windows anything. And probably jdee rely on emacs knowledge about path style. You can always use the cygwin version of XEmacs which correctly understands windows paths and UNIX paths. http://www.xemacs.org/Download/win32/setup.exe andy
Re: JDE-2.2.9beta12 available at
I'm getting the following error when trying to run jde-ant-build: Debugger entered--Lisp error: (wrong-type-argument arrayp nil) I met a same error in JDE 2.2.9beta12. My work around is to set jde-ant-read-target be 'on'. jde-ant-escape(nil) (setq target (jde-ant-escape target)) target is nil if jde-ant-read-target is nil. jde-ant.el: in defun jde-ant-build | | (if jde-ant-read-target | : | (setq target (jde-ant-escape target)) It seems that target variable is defined only jde-ant-read- target is non-nil. So, (setq target ...) would be in the block of (if jde-ant-read-target ...) or like following. (if target (setq target (jde-ant-escape target))) --- Toru TAKAHASHI
Re: JDE-2.2.9beta12 available at
Thank you Toru.That certainly solves the issue of not building. Jeff - Original Message - From: TAKAHASHI Toru To: [EMAIL PROTECTED] Sent: Thursday, September 12, 2002 12:55 PM Subject: Re: JDE-2.2.9beta12 available at I'm getting the following error when trying to run jde-ant-build: Debugger entered--Lisp error: (wrong-type-argument arrayp nil)I met a same error in JDE 2.2.9beta12.My work around is to set jde-ant-read-target be 'on'. jde-ant-escape(nil) (setq target (jde-ant-escape target))target is nil if jde-ant-read-target is nil.jde-ant.el: in defun jde-ant-build|| (if jde-ant-read-target| :| (setq target (jde-ant-escape target))It seems that target variable is defined only jde-ant-read-target is non-nil.So, (setq target ...) would be in the block of (if jde-ant-read-target ...)or like following.(if target (setq target (jde-ant-escape target)))---Toru TAKAHASHI