;;;; Myles' GNU Emacs file. ;;;; ---------------------------------------------- ;;;; Emacs Keyboard Macros. ;;;; ---------------------------------------------- ;;; Remove CTRL-M's from the current buffer. (fset 'dos2unix [?\M-< ?\M-% ?\C-q ?\C-m return return ?!]) ;;; When browsing a directory, open the file not in Emacs but with the ;;; associated MS Windows application. (fset 'open-windows-file [?\C-o ?\C-x ?o ?\M-x ?b ?r ?o ?w ?s ?e ?- ?u ?r ?l ?- ?o ?f ?- ?f ?i ?l ?e return ?\C-x ?k return ?\C-x ?o ?\C-x ?1]) ;;;; ---------------------------------------------- ;;;; End of Emacs Keyboard Macros. ;;;; ---------------------------------------------- ;;;;; ---------------------------------------------- ;;;;; Start of Key Mappings ;;;;; ---------------------------------------------- ;;; Map F4 to eval-buffer. (global-set-key [f4] 'eval-buffer) ;;; Map F5 to goto-line. (global-set-key [f5] 'goto-line) ;;; Map F6 to reset the frame width to 80 columns wide. (global-set-key [f6] 'frame-width-80) (defun frame-width-80 () (interactive) (set-frame-width (selected-frame) 80) ) ;;; Map F7 to reload the current buffer. (global-set-key [f7] 'find-alternate-file) ;;; Map F8 to build the project. (global-set-key [f8] 'jde-build) ;;; Map F9 to be generate Java get and set methods. (global-set-key [f9] 'jde-gen-get-set) ;;; Map F10 to cycle through the list of completion options. (global-set-key [f10] 'jde-complete-in-line) ;;; Map F11 to display the method completion list. (global-set-key [f11] 'jde-complete-menu) ;;; Map F12 to display the class' source. (global-set-key [f12] 'jde-show-class-source) ;; In dired mode, map o to open a Windows file. (add-hook 'dired-mode-hook '(lambda () (define-key dired-mode-map "o" 'open-windows-file))) ;;;; ---------------------------------------------- ;;;; End of Key Mappings ;;;; ---------------------------------------------- ;;;; ---------------------------------------------- ;;;; General Emacs Settings. ;;;; ---------------------------------------------- ;;; Make the scroll bar appear on the right. (set-scroll-bar-mode 'right) ;;; Set the default frame height. (set-frame-height (selected-frame) 40) ;;; Set the default font. On Windows, this works for all frames, while ;;; set-default-font only works on the first opened frame. (add-to-list 'default-frame-alist '(font . "-outline-Lucida Console-normal-r-normal-normal-19-142-96-96-c-*-iso10646-1") ) ;;; Always use spaces instead of tab. (setq-default indent-tabs-mode nil) ;;; Now to turn off automatic making of backup files: (setq make-backup-files nil) (setq vc-cvs-stay-local nil) (setq auto-save-default nil) ;;; Open all files in binary format. (setq file-name-buffer-file-type-alist '((".*" . t))) ;;; Save files in UNIX format (for Emacs on Windows). (setq buffer-file-coding-system 'undecided-unix) ;;; Always enable the ability to change the case of words ;;; (disabled by default in shell mode) (put 'upcase-region 'disabled nil) (put 'downcase-region 'disabled nil) ;;; Enable wheelmouse support by default for UNIX. (mwheel-install) ;;; Enable highlighting while selecting text. (setq transient-mark-mode t) ;;; Enable word wrap in text mode. (setq default-major-mode 'text-mode) (add-hook 'text-mode-hook 'text-mode-hook-identify) (add-hook 'text-mode-hook 'turn-on-auto-fill) ;;; Turn on syntax highlighting automatically. (global-font-lock-mode 1) ;;;; ---------------------------------------------- ;;;; End of General Emacs Settings. ;;;; ---------------------------------------------- ;;;; ---------------------------------------------- ;;;; Eshell Configuration ;;;; ---------------------------------------------- ;;; Make this the default shell in Emacs. (setq eshell-prefer-to-shell t) ;;; Clear the elisp shell buffer. (defun eshell/clear() (interactive) (recenter 0) ) ;;; Reset/erase the elisp buffer. (defun eshell/reset() (interactive) (setq inhibit-read-only t) (erase-buffer) ) ;;; The below lines make pcomplete by the tab-complete mode for shell mode. ;;; Therefore, the *Completions* buffer will disappear automatically after a ;;; selection is chosen. (require 'shell) (define-key shell-mode-map (kbd "TAB") 'pcomplete) (add-hook 'shell-mode-hook 'pcomplete-shell-setup) (setq pcomplete-cycle-completions nil) ;;; --- Set Environment Variables --- ;;; Set the cvs authentication type. (setenv "CVS_RSH" "ssh") ;;; Set the display. (setenv "DISPLAY" "localhost:0") ;;; Set the CLASSPATH. ;; Junit (setenv "CLASSPATH" "c:\\custom\\junit3.8.1\\junit.jar") ;; The current path. (setenv "CLASSPATH" (format "%s;." (getenv "CLASSPATH"))) ;;; Update the system path. ;; Path for Infozip. (setenv "PATH" (format "%s;C:\\custom\\infozip" (getenv "PATH"))) ;; Path for Microsoft Office. (setenv "PATH" (format "%s;C:\\Program Files\\Microsoft Office\\Office10" (getenv "PATH"))) ;;; --- Setup the aliases --- ;;; While eshell can easily make these on the fly, I prefer to have them all ;;; in my .emacs file so all Emacs customizations are in one place. (defun createEshellAliases() (setq aliases (concat "alias ftp cmd /c start ftp $1 &\n" "alias ssh echo \"ssh does not run within Emacs, launching Xterm...\"; xterm &\n" "alias TestRunner java junit.swingui.TestRunner\n" "alias xterm C:\\cygwin\\usr\\X11R6\\bin\\run.exe xterm -display 127.0.0.1:0.0 -fn 10x20 -bg white -fg black -sb -rightbar -sl 10000 -e bash --login\n" )) ;; Prepare the filename. (setq eshell_alias_file "~/.eshell/alias") ;; Write the eshell alias file. (write-region aliases nil eshell_alias_file) ) (createEshellAliases) ;;;; ---------------------------------------------- ;;;; End of Eshell Configuration ;;;; ---------------------------------------------- ;;;; ---------------------------------------------- ;;;; For JDE. ;;;; ---------------------------------------------- ;;; Update the Emacs load-path for the JDE required packages. (add-to-list 'load-path (expand-file-name "c:/custom/elisp/jdee/jde-2.3.5/lisp")) (add-to-list 'load-path (expand-file-name "c:/custom/elisp/jdee/cedet-1.0beta3b/common")) (load-file (expand-file-name "c:/custom/elisp/jdee/cedet-1.0beta3b/common/cedet.el")) (add-to-list 'load-path (expand-file-name "c:/custom/elisp/jdee/elib-1.0")) ;;; Disallow a semantic.cache file in each directory. (setq semanticdb-default-save-directory "c:/docume~1/myles.bogner/") ;;; Set the debug option to enable a backtrace when a problem occurs. (setq debug-on-error t) ;;; Defer loading the JDE until a Java file is opened. (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)) '(("\\.jws\\'" . jde-mode)) auto-mode-alist))) (require 'jde)) ;;; Launch Beanshell when Java file is opened instead of at first use. (setq jde-launch-beanshell-on-demand-p nil) (defun my-jde-mode-hook () ;; Set the classes menu to be alphabetized. (setq jde-imenu-sort 'asc) ;; Do not use K&R style braces for code generation. (setq jde-gen-k&r nil) ;; Sets the basic indentation for Java source files to Sun's standard four ;; spaces (the default but placed here for reference). (setq c-basic-offset 4) ;; When placing braces following ifs and trys on the next line, JDE indents ;; them four additional spaces. This turns this indention off. (c-set-offset 'substatement-open nil) ;; Don't automatically reparse the files. (setq jde-auto-parse-enable nil) ;; The base of the JDK APIs. (setq jde-jdk-doc-url "c:/custom/jdk-1.4.2_06-docs/docs/index.html") ;; Show line numbers. (setq line-number-mode t) ;; Have ant always prompt for a target. (setq jde-ant-read-target t) ;; Traverse up the directory tree to find build.xml. (setq jde-ant-enable-find t) ;; This is somewhat annoying, but JDE when doing a Ant build in script mode ;; seems to pass the default shell, cmdproxy.exe, arguments it can't handle. ;; Changing the shell to bash rectifies this. (setq shell-file-name "C:/cygwin/bin/bash.exe") ) (add-hook 'jde-mode-hook 'my-jde-mode-hook) ;;;; ---------------------------------------------- ;;;; End of JDE Configuration. ;;;; ---------------------------------------------- ;;;; ---------------------------------------------- ;;;; For nXML Mode. ;;;; ---------------------------------------------- ;;; Load the module. (load "c:/custom/elisp/nxml-mode-20041004/rng-auto.el") ;;; Use nxml-mode automatically for files with appropriate extension. (setq auto-mode-alist (cons '("\\.\\(xml\\|xsl\\|rng\\|xhtml\\)\\'" . nxml-mode) auto-mode-alist)) ;;;; ---------------------------------------------- ;;;; End of nXML Mode. ;;;; ---------------------------------------------- ;;;; ---------------------------------------------- ;;;; For SQL Mode. ;;;; ---------------------------------------------- (require 'sql) ;;; Don't let Emacs prompt for login information in advance of SQL tool's ;;; prompt. (defalias 'sql-get-login 'ignore) ;;;; ---------------------------------------------- ;;;; End of SQL Mode. ;;;; ---------------------------------------------- ;;;; ---------------------------------------------- ;;;; For Xslide. ;;;; ---------------------------------------------- ;;; XSL mode (autoload 'xsl-mode "xslide" "Major mode for XSL stylesheets." t) ;;; Turn on font lock when in XSL mode. (add-hook 'xsl-mode-hook 'turn-on-font-lock) ;;; Use Xslide for the following file extension. (setq auto-mode-alist (append (list '("\\.fo" . xsl-mode) '("\\.xsl" . xsl-mode) '("\\.xslt" . xsl-mode)) auto-mode-alist)) ;;; Uncomment if using abbreviations. (abbrev-mode t) ;;;; ---------------------------------------------- ;;;; End of Xslide. ;;;; ----------------------------------------------