Êíèãà: Learning GNU Emacs, 3rd Edition

9.5.4 Installing the JDEE

9.5.4 Installing the JDEE

Five basic steps are required to install the JDEE on your system:

1. Get the necessary prerequisites downloaded and installed.

2. Update the load path (.emacs).

3. Set theJDEE to load at startup (.emacs).

4. Compile JDEE .el files (optional).

5. Register your JDKs (optional).

The previous section covered the first step. Make sure you take care of those prerequisites before continuing. The next steps can be handled in your .emacs file. The JDEE site proposes the following entries as a minimal setup; we excerpt them here (with one or two small tweaks) for easy reference.

;; This .emacs file illustrates the minimal setup
;; required to run the JDEE.
;; Set the debug option to enable a backtrace when a
;; problem occurs.
(setq debug-on-error t)
;; Update the Emacs load-path to include the path to
;; the JDEE and its require packages. This code assumes
;; that you have installed the packages in the
;; /usr/local/emacs/site-lisp directory. Adjust appropriately.
(add-to-list 'load-path
  (expand-file-name "/usr/local/emacs/site-lisp/jde/lisp"))
(add-to-list 'load-path
  (expand-file-name "/usr/local/emacs/site-lisp/semantic"))
(add-to-list 'load-path
  (expand-file-name "/usr/local/emacs/site-lisp/speedbar"))
(add-to-list 'load-path
  (expand-file-name "/usr/local/emacs/site-lisp/eieio"))
(add-to-list 'load-path
  (expand-file-name "/usr/local/emacs/site-lisp/elib"))
;; If you want Emacs to defer loading the JDEE until you open a
;; Java file, edit the following line
(setq defer-loading-jde nil)

;;to read:
;; (setq defer-loading-jde t)
(if defer-loading-jde
    (progn
      (autoload 'jde-mode "jde" "JDE mode." t)
      (setq auto-mode-alist
            (append
             '((".java'" . jde-mode))
             auto-mode-alist)))
  (require 'jde))
;; Set the basic indentation for Java source files
;; to two spaces.
(add-hook 'jde-mode-hook
          '(lambda ( )
             (setq c-basic-offset 2)))
;; Include the following only if you want to run
;; bash as your shell.
;; Set up 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"))
(if (boundp 'w32-quote-process-args)
  (setq w32-quote-process-args ?")) ;; Include only for MS Windows.

Of course, you'll need to make sure the paths in the add-to-list 'load-path lines match the actual directories you're using.

Compiling the JDEE Lisp files is not required, but as noted in "Byte-Compiling Lisp Files" in Chapter 11, it's a good idea and speeds up several operations including general startup times. The JDEE makes this step simple. After you have it installed, start Emacs and run M-x jde-compile-jde. You run this command only once, so it is definitely worthwhile.

Îãëàâëåíèå êíèãè


Ãåíåðàöèÿ: 0.113. Çàïðîñîâ Ê ÁÄ/Cache: 0 / 0
ïîäåëèòüñÿ
Ââåðõ Âíèç