Dear Paul...

The C-c C-v C-z allows you to put the cursor over a Java 1.* class name
and using those three control letters add an import statement
automatically at the top of the .java file (if not already there).

Question:

Can this functionality be extended to an in-house class? For example,
putting the cursor over MyClass and using the three control character
sequence, it adds "import com.mycompany.MyClass;" at the top of the
current java source code?

Emacs  : GNU Emacs 20.6.1 (i386-*-nt4.0.1381)
 of Tue Feb 29 2000 on buffy
Package: JDE version 2.1.9




--
________________________
Jim Snyder
Senior Software Engineer
Copper Key Technologies
402 High Point Dr., #201
Cocoa, FL. 32926
www.copperkey.com
321.635.9070 x135

;;;
;;; Jim Snyder's .emacs file
;;;
;;; 06/27/97
;;;

(message "Loading ~/.emacs...")



;;
;; DEFINE CODING STANDARDS
;;
(defun JAVA ()
  ;; my customizations for all of c-mode, c++-mode, objc-mode, java-mode
  (setq-default c-basic-offset 2)

  ;; this will make sure spaces are used instead of tabs
  (setq indent-tabs-mode nil)

  (c-set-offset 'class-open '0)
  (c-set-offset 'class-close '0)
  (c-set-offset 'inher-intro '+)
  (c-set-offset 'inher-cont '0)
  (c-set-offset 'topmost-intro '0)
  (c-set-offset 'knr-argdecl-intro '0)
  (c-set-offset 'knr-argdecl '0)

  (c-set-offset 'defun-open '0)
  (c-set-offset 'defun-block-intro '+)
  (c-set-offset 'substatement-open '0)
  (c-set-offset 'statement-block-intro '+)

  (c-set-offset 'case-label '+)
  (c-set-offset 'statement-case-open '+)
  (c-set-offset 'statement-cont '+)

  (c-set-offset 'c '0)
  (c-set-offset 'inline-open '0)
  (c-set-offset 'substatement '0)
  )
(add-hook 'c-mode-common-hook 'JAVA)

;;
;; mail setup
;;
(setq mail-yank-prefix " >")
(add-hook 'mail-setup-hook 'mail-abbrevs-setup)


;;
;; set up Line Mode
;;
(display-time)
(setq line-number-mode t)
(setq column-number-mode t)
(setq line-number-display-limit 20000000)


;;
;; tell emacs to scroll 1 line at a time
;;
(setq scroll-step 1)


;;
;; Finds the matching parenthesis/brackets/curly braces
;;
(defun match-paren (arg)
  "Go to the matching parenthesis if on parenthesis otherwise insert %."
  (interactive "p")
  (cond ((looking-at "\\s\(") (forward-list 1) (backward-char 1))
                ((looking-at "\\s\)") (forward-char 1) (backward-list 1))
                (t (self-insert-command (or arg 1)))))

;;
;; C style commenting of current line
;;
(defun c-comment-current-line ()
  (interactive)
  (let ((comment-start "/* ")
        (comment-end " */")
        (bol (save-excursion (beginning-of-line) (point)))
        (eol (save-excursion (end-of-line) (point))))
    (comment-region bol eol)))


;;
;; Allows multiple shells: shell<1>, shell<2>, etc.
;;
(defun new-fshell ()
  (interactive)
  (fshell '(4)))



(defun serverBuffer ()
  (interactive)
  (rename-buffer "---SERVER---"))
(defun clientBuffer ()
  (interactive)
  (rename-buffer "---CLIENT---"))



;;
;; SET UP FUNCTION KEYS FOR (SORT OF) 1 KEY ACCESS
;;
(global-set-key '[f1] 'jde-compile)
(global-set-key '[M-f1] 'compile)
(global-set-key '[C-f1] 'kill-compilation)
;;;jks(global-set-key '[f2] "\C-x`")        ; traverse through error list after 
compiling
;;;(global-set-key '[f2] "\C-c C-v C-z")
(global-set-key '[C-f3]  'cpp-comment-current-line)
(global-set-key '[f3] 'comment-out-region)
(global-set-key '[f4] 'match-paren)
;; jks (global-set-key '[f5] 'jde-db)
(global-set-key '[f5] 'jdok-generate-javadoc-template)
;;(global-set-key '[f5] 'gdb)
(global-set-key '[C-f5] 'jde-run)
(global-set-key '[C-f6] 'shell)
(global-set-key '[f6] 'new-fshell)
(global-set-key '[f7] 'ediff-buffers)
(global-set-key '[C-f7] 'font-lock-fontify-buffer)
;;(global-set-key '[f8] 'comment-out-region)
(global-set-key '[f8] 'serverBuffer)
(global-set-key '[C-f8] 'clientBuffer)
(global-set-key '[f9] 'undo)
(global-set-key '[f10] 'goto-line)
(global-set-key '[C-f10] 'what-line)
(global-set-key '[f11] 'enlarge-window)
(global-set-key '[f12] 'enlarge-window-horizontally)
;;;(global-set-key '[SunF36] 'enlarge-window)
;;;(global-set-key '[SunF37] 'enlarge-window-horizontally)
(global-set-key [C-left] 'scroll-right)         ; left arrow
(global-set-key [C-right] 'scroll-left)         ; right arrow
(global-set-key [mouse-3] "\C-l")
;;(global-set-key [M-f7] 'font-lock-fontify-buffer)
(global-set-key [C-tab] "\C-xo")  ; tab between frames

;;
;; load appropriate .el files
;;
(load "international/mule-cmds.elc")   ;; needed for fluke error when starting 
fshell.el
(load "g:/site_lisp/fshell.el")
;; jks (load "d:\\gnu\\emacs-20.6\\site_lisp\\strip.el")
(load "g:/site_lisp/igrep.el")

;;
;; hook for removing trailing blanks from files
;;
;; jks (require 'strip)


;;
;; Moves the mouse cursor out of the way for me.
;;
;;(cond (window-system
;;       (require 'avoid)
;;       (mouse-avoidance-mode 'cat-and-mouse)))




;;
;; misc. setup
;;
(setq compile-command "javac")
;;;(setq jde-compile-options "-deprecation")
(setq version-control t)
(setq blink-matching-paren t)
(setq kept-old-versions 20)
(setq kept-new-versions 20)
(setq delete-old-versions t)


(setq compilation-window-height 15)
(setq require-final-newline t)
(setq tags-table-list '("g:/.TAGS/TAGS"))
(add-hook 'java-mode-hook
          (function
           (lambda ()
             (setq case-fold-search t))))
(setq auto-fill-mode t)
(setq fill-column 80)


(setq load-path
      (nconc '(
               "d:/gnu/emacs-20.6/site_lisp/jde-2.1.5"
               "g:/site_lisp/speedbar-0.11"
               "g:/site_lisp/semantic-1.1"
               "g:/site_lisp/jde-2.1.9/lisp"
               )
             load-path))
(require 'jde)
(define-key-after (lookup-key global-map [menu-bar tools])
  [speedbar] '("Speedbar" . speedbar-frame-mode) [calendar])

(custom-set-variables
 '(jde-run-option-properties nil)
 '(jde-gen-cflow-case (quote ("(if (jde-parse-comment-or-quoted-p)" "'(l \"case\")" 
"'(l > \"case\")" ")")))
 '(ange-ftp-auto-save 1)
 '(jde-compile-option-debug (quote ("all" (t nil nil))))
 '(jde-run-option-verbose (quote (t t t)))
 '(jde-gen-cflow-switch (quote ("(if (jde-parse-comment-or-quoted-p)" "'(l 
\"switch\")" "'(l > \"switch\")" ")")))
 '(jde-run-option-heap-size (quote ((1 . "megabytes") (256 . "megabytes"))))
 '(jde-gen-cflow-while (quote ("(if (jde-parse-comment-or-quoted-p)" "'(l \"while\")" 
"'(l > \"while\")" ")")))
 '(jde-gen-cflow-if-else (quote ("(if (jde-parse-comment-or-quoted-p)" "'(l \"ife\")" 
"'(l > \"if(\" (p \"if-clause: \" clause) \") \"" "\"{\" > n> r n" "\"} // end of if 
(\" (s clause) \")\" > n>" "> \"else \"" "\"{\" > n> r n" "\"}\"> n)" ")")))
 '(which-func-mode-global t nil (which-func))
 '(jde-gen-cflow-if (quote ("(if (jde-parse-comment-or-quoted-p)" "'(l \"if\")" "'(l > 
\"if\")" ")")))
 '(jde-gen-cflow-for (quote ("(if (jde-parse-comment-or-quoted-p)" "'(l \"for\")" "'(l 
> \"for\")" ")")))
 '(which-func-modes t)
 '(ange-ftp-make-backup-files t)
 '(jde-db-source-directories (quote ("/home/jsnyder/www/bmg/dev" 
"/cots/jdk/jdk1.2.2/jre/lib/rt.jar" "/cots/jsdk/jsdk2.1/servlet.jar" 
"/cots/jsdk/jsdk2.1/server.jar" "/home/jsnyder/.scratch/Debugging")))
 '(c-comment-only-line-offset (quote (0 . 0)))
 '(jde-gen-class-buffer-template (quote ("(funcall jde-gen-boilerplate-function) 'n" 
"\"// ***********************************************************************\" 'n" 
"\"// (c) Copyright Copper Key Technologies, Inc.  2000.\" 'n" "\"//     All rights 
reserved.\" 'n" "\"//\" 'n" "\"// 
***********************************************************************\" 'n" "\"//\" 
'n" "\"// NOTICE: Copper Key Technologies, Inc. proprietary rights are included\" 'n" 
"\"//         in this source code. Recipient and/or user, by accepting this\" 'n" 
"\"//         source code, agrees that neither this source code nor any part\" 'n" 
"\"//         thereof shall be reproduced, copied, adapted, distributed,\" 'n" "\"//   
      used, displayed or transferred to any party, or used or\" 'n" "\"//         
disclosed to others for development, consulting, or any other\" 'n" "\"//         
purpose except as specifically authorized in writing by\" 'n" "\"//\" 'n" "\"//        
 Copper Key Technologies, Inc.\" 'n" "\"// 
***********************************************************************\" 'n" "\"\" 
'n" "\"\" 'n" "'n>" "\"public class \"" "(file-name-sans-extension 
(file-name-nondirectory buffer-file-name))" "\" \" (jde-gen-get-super-class) \" {\" 
'n> 'n>" "\"public \"" "(file-name-sans-extension (file-name-nondirectory 
buffer-file-name))" "\"() {\" 'n>" "'p 'n>" "\"}\" 'n>" "'n>" "\"} // \"" 
"(file-name-sans-extension (file-name-nondirectory buffer-file-name))" "'n>")))
 '(jde-db-debugger (quote ("JDEbug" "jdb" . "Executable")))
 '(jdok-describe-constructor "* Constructor")
 '(jde-global-classpath (quote ("${JSDK_ROOT}/server.jar" "${JSDK_ROOT}/servlet.jar" 
"${BIZNAV_HOME}" "${HOME}/www/sybase/jConnect.jar" 
"${JDK_ROOT}/jdk1.2.2/jre/lib/rt.jar" 
"${HOME}/www/StudioJ_swing1.1/Blend.J2_0/jars/design/jfc/Blend.jar" 
"${HOME}/www/StudioJ_swing1.1/Chart.J2_2/jars/ChartRuntimeJFC.jar" 
"${HOME}/www/StudioJ_swing1.1/Grid.J2_0/jars/design/jfc/grid2_0.jar" 
"/home/malcolm/java/capsapi_classes.zip" "${JCLASS_HOME}/lib/jcchart401K.jar" 
"${JCLASS_HOME}/lib/jcdatasource401K.jar" "${JCLASS_HOME}/lib/jchigrid401K.jar" 
"${JCLASS_HOME}/lib/jctable401K.jar" "${JCLASS_HOME}/lib/jcjarmaster401K.jar" 
"${JCLASS_HOME}/lib/jcfield401K.jar" "${JCLASS_HOME}/lib/jcswingsuite401K.jar" 
"/cots/mapxtreme/server/mxtj20.jar" "/cots/mapxtreme/server/devsup20.jar" 
"/cots/mapxtreme/server/dpext20.jar" "/cots/mapxtreme/server/mxloc20.jar" 
"/cots/mapxtreme/server/raster20.jar" "${HOME}/KLGroup" ".")))
 '(jde-gen-cflow-main (quote ("(if (jde-parse-comment-or-quoted-p)" "'(l \"main\")" 
"'(l > \"public static void main (String[] args) \"" "\"{\" > n> r n" "\"}\"> n)" 
")")))
 '(jde-enable-abbrev-mode t)
 '(jde-bug-jpda-directory "/home/jsnyder/jpda1.0/lib/sparc")
 '(jde-run-option-java-profile (quote (nil . "./java.prof")))
 '(jdok-describe-method "* %s")
 '(vc-make-backup-files t)
 '(jde-mode-abbreviations (quote (("ab" . "abstract") ("bo" . "boolean") ("br" . 
"break") ("byv" . "byvalue") ("cas" . "cast") ("ca" . "catch") ("ch" . "char") ("cl" . 
"class") ("co" . "const") ("con" . "continue") ("de" . "default") ("dou" . "double") 
("el" . "else") ("ex" . "extends") ("fa" . "false") ("fi" . "final") ("fin" . 
"finally") ("fl" . "float") ("fo" . "for") ("fu" . "future") ("ge" . "generic") ("go" 
. "goto") ("impl" . "implements") ("impo" . "import") ("ins" . "instanceof") ("dln" . 
"System.out.println(\"DJKS:") ("ln" . "System.out.println(") ("inte" . "interface") 
("lo" . "long") ("na" . "native") ("ne" . "new") ("nu" . "null") ("pa" . "package") 
("pri" . "private") ("pro" . "protected") ("pu" . "public") ("re" . "return") ("sh" . 
"short") ("st" . "static") ("su" . "super") ("sw" . "switch") ("sy" . "synchronized") 
("th" . "this") ("thr" . "throw") ("throw" . "throws") ("tra" . "transient") ("tr" . 
"true") ("vo" . "void") ("vol" . "volatile") ("wh" . "while") ("timeit" . "long 
startTime = System.currentTimeMillis();
        long stopTime = System.currentTimeMillis();
        System.out.println(\"DJKS:TOTAL_TIME: \"+(stopTime-startTime)+\"(ms)\");
        ") ("ckex" . "com.copperkey.util.CKException cke =
        new com.copperkey.util.CKException(\"DJKS:Bogus_EXCEPTION\");
        cke.printStackTrace();"))))
 '(jde-gen-cflow-else (quote ("(if (jde-parse-comment-or-quoted-p)" "'(l \"else\")" 
"'(l > \"else\")" ")"))))


(custom-set-faces)



(require 'jdok)
(setq frame-title-format "%b %l:%c %p")
(setq hscroll-global-mode)



(message "Done Loading ~/.emacs...")

Reply via email to