At 05:17 PM 4/18/2001 -0500, Schewe, Jon (MN65) wrote: >No, it's the same, except that it gets invoked when you start a new Java >file. To reiterate Eric's point, how is what this user asking for different from File->JDE New->Class (= M-x jde-gen-class-buffer) This command creates a new Java source file and runs jde-gen-class in it. Note also that File->JDE New offers a bunch of other choices for creating new Java source files with skeletons in them, e.g., a skeleton console app, a skeleton Swing app. Furthermore, it offers an Other option that you can extend to include your own templates. I really fail to see the need for anything beyond this in the way of creating new Java files containing code templates. - Paul - Paul > >> -----Original Message----- >> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] >> Sent: Wednesday, April 18, 2001 5:15 PM >> To: [EMAIL PROTECTED] >> Cc: Sonu Luthra; [EMAIL PROTECTED]; [EMAIL PROTECTED] >> Subject: Re: jde >> >> >> >> How is this different from M-x jde-gen-class-buffer? >> >> You are prompted for the name of the .java file you wish to create and >> jde-gen-class is run in the new buffer. Am I missing something here? >> >> Eric >> >> In message <[EMAIL PROTECTED]>, David >> Ponce writes: >> : Hello Sonu, >> : >> : > David, I have been searching the internet looking for one specific >> : > cuztomization, and I am unable to find it. I was wondering if you >> : > could help me out? When I create a new .java file, I >> would like for >> : > jde-gen-class to run automatically, how do I add this to my .emacs >> : > file? Any help would be greatly appreciated. Thanks! >> : >> : I thought about your problem and found it an interesting idea :-) >> : Following is a possible implementation which seems to work >> well on my >> : NT Emacs 20.7, 21.0.102 and NT XEmacs 21.1.13. >> : >> : ------------------------- cut here >> ---------------------------------- >> : (defvar jde-new-file-p nil >> : "Non-nil if can initialize this new file with a Java skeleton.") >> : ;; This is a buffer local variable. >> : (make-variable-buffer-local 'jde-new-file-p) >> : ;; Avoid `kill-all-local-variables' to kill it! >> : (put 'jde-new-file-p 'permanent-local t) >> : >> : (defun jde-new-file-hook () >> : "Hook run on nonexistent file. >> : It set the `jde-new-file-p' flag to non-nil if the new file can be >> : initialized with a Java skeleton. >> : It seems better to append this hook to `find-file-not-found-hooks'." >> : (let ((last-cmd (car (car command-history)))) >> : ;; Allow insertion of a Java skeleton only when the new file >> : ;; resulted of a direct invocation of `find-file'. This prevent >> : ;; insertion of multiple skeletons when the new file resulted of >> : ;; execution of a `jde-gen-...' command! >> : (setq jde-new-file-p (eq last-cmd 'find-file))) >> : nil) >> : >> : (defun jde-new-file-setup-hook () >> : "Hook run after `jde-mode' is setup. >> : It inserts a Java skeleton in the current buffer if editing >> a new Java >> : file in `jde-mode'. >> : It seems better to append this hook to `jde-mode-hook'." >> : (and jde-new-file-p >> : (eq major-mode 'jde-mode) >> : (= (point-min) (point-max)) >> : (progn >> : (jde-gen-class) >> : (beginning-of-buffer) >> : (search-forward "{") >> : (backward-char 1) >> : (c-indent-exp) >> : (tempo-forward-mark)))) >> : >> : (add-hook 'find-file-not-found-hooks #'jde-new-file-hook t) >> : (add-hook 'jde-mode-hook #'jde-new-file-setup-hook t) >> : ---------------------- end cut here >> --------------------------------- >> : >> : Hope this will help. >> : >> : Sincerely, >> : David >> : >> : __________________________________________________________________ >> : Get your own FREE, personal Netscape Webmail account today >> at http://webmail. >> >netscape.com/ >> : >>
