;;;--------------------------------------------------------------------- ;;; Ruby customizations ;;;--------------------------------------------------------------------- (autoload 'ruby-mode "ruby-mode.el" "Ruby editing mode." t) (setq auto-mode-alist (cons '("\\.rb$" . ruby-mode) auto-mode-alist)) (setq interpreter-mode-alist (cons '("ruby" . ruby-mode) interpreter-mode-alist)) (setq interpreter-mode-alist (cons '("expect" . tcl-mode) interpreter-mode-alist)) (setq default-major-mode 'text-mode) ;;;--------------------------------------------------------------------- ;;; Some macros and key bindings ;;;--------------------------------------------------------------------- (defun ccc-set-key (key function) "binds key to function using global-set-key and (not yet functional) adds an entry to an a-list that gives the key bindings for my customizations" (global-set-key key function) (add-to-list 'ccc-key-alist (cons key function))) ; !FIXME!finish a-list and map a key to display the a-list (defvar ccc-key-alist '() "an alist of my custom key bindings") ;; Key bindings ;; (ccc-set-key [f1] 'compile) ;; (ccc-set-key [\C-f1] 'ccc-toggle-ecb-mode) ;; (ccc-set-key [f2] 'ccc-revert-buffer) ;; (ccc-set-key [f3] 'ccc-add-code-tags) ;; (ccc-set-key [f4] 'ccc-javadoc) ;; (ccc-set-key [f5] '"\C-q\C-i") ; useful for tabs inside source ;; (ccc-set-key [f7] 'ccc-string-newline) ;; (ccc-set-key [\C-f7] 'ccc-format-for-junit) ;; (ccc-set-key [f8] 'ccc-prejml) ;; (ccc-set-key [f9] 'ccc-fixme) ;; (ccc-set-key [\C-f9] 'ccc-fixme2) ;; (ccc-set-key [f10] 'ccc-kill-buffer-and-frame) ;; (ccc-set-key [f11] 'bury-buffer) ;; (ccc-set-key [f12] nil) ;; (ccc-set-key [\C-f12] 'ccc-line) ;; (ccc-set-key [100663328] 'dabbrev-expand) ;C-S-SPC ;; (ccc-set-key "\M-L" '"(type-check-and-eval-loop)") ;; (ccc-set-key "\M-\C-l" 'goto-line) ;; (ccc-set-key "\C-x\C-c" 'ccc-save-buffers-kill-emacs) ;; (ccc-set-key "\M-\d" 'backward-kill-word) ; meta-backspace (defun ccc-toggle-ecb-mode () "Toggle ecb-minor-mode and resize window accordingly" (interactive) (if ecb-minor-mode (progn (let ((w (frame-width ecb-frame))) (message "%i" w) ) (ecb-minor-mode) ) (progn (message "%s" "turning on, make frame wider") (ecb-minor-mode) ) )) (defun ccc-save-buffers-kill-emacs (&optional arg) "Prompts whether the user wishes to exit emacs and, if so, gives the user the opportunity to save all file-visiting buffers." (interactive "*P") (if (yes-or-no-p "Really save your work and exit emacs? ") (save-buffers-kill-emacs))) (defun ccc-curts-emacs() "Load Curt's .emacs file, useful for pair programming" (interactive) (if (yes-or-no-p "Really switch to Curt's configuration? ") (load "curts-dot-emacs.el") nil)) (defun ccc-revert-buffer() "Revert buffer to version on disk, offering a simple y/n prompt. Sure it is a little risky, but I find it useful." (interactive) (progn (if (y-or-n-p "Really revert to buffer on disk? ") (revert-buffer nil 't 't)) (message nil))) (defun ccc-kill-buffer-and-frame() "Kill the current buffer and frame, offering a simple y/n prompt." (interactive) (if (y-or-n-p "Really kill buffer and frame? ") (progn (kill-this-buffer) (delete-frame)) (message nil))) ;; Template definitions (require 'tempo) (defvar ccc-tags '() "an association list for my tempo templates") ;; ---------- (defun ccc-line (&optional arg) "Inserts a horizontal line" (interactive "*P") (tempo-template-ccc-line) nil) (tempo-define-template "ccc-line" '( "-------------------------------------------------------------" ) 'line "Inserts a horizontal line" 'ccc-tags) ;; ---------- (defun ccc-fixme (&optional arg) "Inserts a comment indicating code to be fixed" (interactive "*P") (push-mark (point)) (indent-for-comment) (tempo-template-ccc-fixme) (exchange-point-and-mark) nil) (tempo-define-template "ccc-fixme" '( " !FIXME!" (p "FIXME comment: ") ) 'fixme "Inserts a comment indicating code to be fixed" 'ccc-tags) (defun ccc-fixme2 (&optional arg) "Inserts a C-style comment indicating code to be fixed" (interactive "*P") (tempo-template-ccc-fixme2) nil) (tempo-define-template "ccc-fixme2" '( "/* !FIXME!" (p "FIXME comment: ") " */" ) 'fixme "Inserts a comment indicating code to be fixed" 'ccc-tags) ;; ---------- (defun ccc-braces (&optional arg) "Inserts a matching set of braces, properly indented, with point positioned inside the braces" (interactive "*P") (tempo-template-ccc-braces) nil) (tempo-define-template "ccc-braces" '( '> " {" 'n " " '> (push-mark (point)) 'n "}" '> 'n (exchange-point-and-mark) ) 'braces "Inserts a matching set of braces, properly indented, with point positioned inside the braces" 'ccc-tags) ;; ---------- (defun ccc-block-comment (&optional arg) "Inserts a block comment, properly indented, in the correct format for the major mode" (interactive "*P") (tempo-template-ccc-block-comment) nil) (tempo-define-template "ccc-block-comment" '( (beginning-of-line) '% comment-start (ccc-line) '> 'n comment-start (p "Block description:") '> 'n comment-start (ccc-line) '> 'n ) 'block-comment "Inserts a block comment, properly indented." 'ccc-tags) ;; ---------- (defun ccc-java-main (&optional arg) "Inserts a declaration for the standard Java main() entry point." (interactive "*P") (tempo-template-ccc-java-main) nil) (tempo-define-template "ccc-java-main" '( (end-of-line) '& "/**" '> 'n "* Command line entry point." '> 'n "*" '> 'n "* @param args " (p "args description:") " */" '> 'n "public static void main( String[] args )" (ccc-braces) ) 'java-main "Inserts a declaration for the standard Java main() entry point." 'ccc-tags) ;; ---------- (defun ccc-javadoc (&optional arg) "Inserts a declaration for an empty javadoc comment." (interactive "*P") (tempo-template-ccc-javadoc) nil) (tempo-define-template "ccc-javadoc" '( (push-mark (point)) (beginning-of-line) '% "/**" '> 'n "* " (p "Description: ") '> 'n "*/" '> 'n (exchange-point-and-mark) ) 'javadoc "Inserts a declaration for an empty javadoc comment." 'ccc-tags) ;; ---------- (defun ccc-prejml (&optional arg) "Inserts a declaration for javadoc comment lines containing a JML annotation." (interactive "*P") (tempo-template-ccc-prejml) nil) (tempo-define-template "ccc-prejml" '( (end-of-line) '& "*" '> 'n "*
" '> 'n "*" '> (exchange-point-and-mark) ) 'prejml "Inserts a declaration for javadoc comment lines containing a JML annotation." 'ccc-tags) ;; ---------- (defun ccc-string-newline () "Inserts a string followed by a NEWLINE constant in a Java program. Useful for writing JUnit test cases" (interactive) (tempo-template-ccc-string-newline) nil) (tempo-define-template "ccc-string-newline" '( (end-of-line) '& "\"" (p "String: ") "\\n\" +" '> ) 'string-newline "Inserts a string followed by a NEWLINE constant in a Java program. Useful for writing JUnit test cases" 'ccc-tags) (defun ccc-format-for-junit () "wraps the current line in quotes for insertion in a junit test case" (interactive) (tempo-template-ccc-format-for-junit) (forward-line) nil ) (tempo-define-template "ccc-format-for-junit" '( (beginning-of-line) "\"" (end-of-line) "\" + NEWLINE +" '> ) 'format-for-junit "wraps the current line in quotes for insertion in a junit test case" 'ccc-tags) (defun ccc-add-code-tags () "wraps the current region in" '> 'n "*" '> (push-mark (point)) 'n "*
and
tags"
(interactive)
(progn
(insert "")
(exchange-point-and-mark)
(insert "")
))
;;; Configuration for gnuserv
;(load "gnuserv")
;(setenv "GNUSERV_SHOW_EMACS" "1") ; force gnuserv to show emacs window
;(message "%s" load-path)
;(gnuserv-start)
; (setq gnuserv-frame ecb-frame) ; this doesn't seem reliable
; (setq gnuserv-frame nil) ; redundant, this is default
(load "curts-java-mode.el")
;;;-------------------------------------------------------------
;;; OTHER MODE FOO
;;;-------------------------------------------------------------
;;; Some html mode stuff
(add-to-list 'auto-mode-alist '("\\.shtml" . html-mode))
;;; Load prolog mode
;;;(setq load-path (cons "Path" load-path))
;(autoload 'run-prolog "prolog" "Start a Prolog sub-process." t)
;(autoload 'prolog-mode "prolog" "Major mode for editing Prolog programs." t)
;(setq prolog-system 'Terzo)
;(setq prolog-system-version
; '((sicstus (3 . 7))
; (swi (0 . 0))
; (mercury (0 . 0))
; (eclipse (3 . 7))))
;;;; I use Perl and want to keep .pl for that...
;;;;(setq auto-mode-alist (cons '("\\.pl$" . prolog-mode) auto-mode-alist))
;(setq auto-mode-alist (cons '("\\.mod$" . prolog-mode) auto-mode-alist))
;;; Use makefile-mode for Make.Defs and others
(add-to-list 'auto-mode-alist '("Make.*" . makefile-mode))
;;;---------------------------------------------------------------------
;;; Fix line endings, and configure menu item to do conversions
;;;---------------------------------------------------------------------
(require 'auto-translate)
;; dos to unix
(defun d2u ()
(interactive)
(if (y-or-n-p "Convert DOS to Unix format?")
(set-buffer-eol-conversion 'unix)
(message "format unchanged")
))
;; unix to dos
(defun u2d ()
(interactive)
(if (y-or-n-p "Convert Unix to DOS format?")
(set-buffer-eol-conversion 'dos)
(message "format unchanged")
))
;;;-------------------------------------------------------------
;;; Use the desktop package to save session information
;;;-------------------------------------------------------------
;; (desktop-load-default)
;; (desktop-read)
;; (setq desktop-globals-to-save ;save the registers
;; (cons 'register-alist desktop-globals-to-save))
;;;---------------------------------------------------------------------
;;; Below here reserved for auto-configuration from emacs menus
;;;---------------------------------------------------------------------
(custom-set-variables
;; custom-set-variables was added by Custom -- don't edit or cut/paste it!
;; Your init file should contain only one such instance.
'(bsh-startup-timeout 45)
'(compilation-scroll-output t)
'(compile-auto-highlight t)
'(ecb-compile-window-height nil)
'(ecb-layout-nr 9)
'(ecb-layout-window-sizes (quote ((2 (30 . 17) (30 . 21) nil (30 . 21)))))
'(ecb-other-window-jump-behavior (quote edit-and-compile))
'(ecb-show-node-info-in-minibuffer (quote ((always . path) (always . name) (always . path) (always . name+type))))
'(ecb-truncate-lines t)
'(ecb-windows-width 30)
'(jde-bug-jdk-directory "c:\\cygwin\\usr\\local\\jdk1.4\\jdk1.4.0\\")
'(jde-bug-vm-includes-jpda-p t)
'(jde-check-version-flag nil)
'(jde-db-debugger (quote ("JDEbug" "" . "Executable")) t)
'(jde-db-read-app-args t)
'(jde-db-source-directories (quote ("c:\\cygwin\\home\\cclifton\\MJ\\" "c:\\cygwin\\home\\cclifton\\JML2\\")))
'(jde-enable-abbrev-mode t)
'(jde-find-file-regexp (quote ("*[.java|.g|Makefile]")))
'(jde-gen-buffer-boilerplate (quote ("/*
* Copyright (C) 2002, Curtis Clifton, All Rights Reserved
*
* $Id: curts-commands.el,v 1.1 2015/01/01 14:22:32 leavens Exp leavens $
*/
")))
'(jde-gen-cflow-else (quote ("(if (jde-parse-comment-or-quoted-p)" "'(l \"else\")" "'(l '> \"else \"" "(if jde-gen-k&r " "()" "'>'n)" "\"{\"'>'n'>'r'n" "\"}\"" "(if jde-gen-comments" "'(l \" // end of if (\" (s clause) \")\"))" "'>'n'>)" ")")))
'(jde-gen-cflow-for-i (quote ("(if (jde-parse-comment-or-quoted-p)" "'(l \"fori\")" "'(l '> \"for (int \" (p \"variable: \" var) \" = 0; \"" "(s var)" "\" < \"(p \"upper bound: \" ub)\"; \" (s var) \"++) \"" "(if jde-gen-k&r " "()" "'>'n)" "\"{\"'>'n'>'r'n" "\"}\" " "(if jde-gen-comments" "'(l \" // end of for \" (s var)))" "'>'n'>)" ")")))
'(jde-gen-cflow-for-iter (quote ("(if (jde-parse-comment-or-quoted-p)" "'(l \"foriter\")" "'(l '> \"for (Iterator \" (p \"variable: \" var) \" = \"" "(p \"collection: \" coll) \".iterator(); \"" "(s var) \".hasNext();\"" "\")\"" "(if jde-gen-k&r " "()" "'>'n)" "\"{\"'>'n'>'r'n" "(s var) \".next();\" '>'n'>" "\"}\"" "(if jde-gen-comments" "'(l \" // end of for (Iterator \" (s var) \" = \" (s coll) \".iterator(); \"" "(s var) \".hasNext();)\"))" "'>'n'>)" ")")))
'(jde-gen-cflow-if-else (quote ("(if (jde-parse-comment-or-quoted-p)" "'(l \"ife\")" "'(l '> \"if (\" (p \"if-clause: \" clause) \") \"" "(if jde-gen-k&r " "()" "'>'n)" "\"{\"'>'n'>'r'n" "\"} \"" "(if jde-gen-comments " "'(l \"// end of if (\" (s clause) \")\" '> n))" "'> \"else \"" "(if jde-gen-k&r " "()" "'>'n)" "\"{\"'>'n'>'r'n" "\"}\"" "(if jde-gen-comments " "'(l \" // end of if (\" (s clause) \")else\"))" "'>'n'>)" ")")))
'(jde-gen-cflow-main (quote ("(if (jde-parse-comment-or-quoted-p)" "'(l \"main\")" "'(l '> \"public static void main (String[] args) \"" "(if jde-gen-k&r " "()" "'>'n)" "\"{\"'>'n'>'r'n" "\"}\"" "(if jde-gen-comments" "'(l \" // end of main ()\"))" "'>'n'>)" ")")))
'(jde-gen-cflow-switch (quote ("(if (jde-parse-comment-or-quoted-p)" "'(l \"switch\")" "'(l '> \"switch (\" (p \"switch-condition: \" clause) \") \"" "(if jde-gen-k&r " "()" "'>'n)" "\"{\"'>'n'" "\"case \" (p \"first value: \") \":\"'>'n'>'p'n" "\"break;\"'>'n'>'p'n" "\"default:\"'>'n'>'p'n" "\"break;\"'>'n" "\"}\"" "(if jde-gen-comments" "'(l \" // end of switch (\" (s clause) \")\"))" "'>'n'>)" ")")))
'(jde-gen-cflow-try-catch (quote ("(if (jde-parse-comment-or-quoted-p)" "'(l \"try\")" "'(l \"try \"" "(if jde-gen-k&r " "()" "'>'n)" "\"{\"'>'n'>'r'n" "\"} \"" "'> \"catch (\" (p \"catch what: \" clause) \" e) \"" "(if jde-gen-k&r " "()" "'>'n)" "\"{\"'>'n'>'r'n" "\"}\"" "(if jde-gen-comments" "'(l \"// end of try-catch\"))" "'>'n'>)" ")")))
'(jde-gen-cflow-while (quote ("(if (jde-parse-comment-or-quoted-p)" "'(l \"while\")" "'(l '> \"while (\" (p \"while-clause: \" clause) \") \"" "(if jde-gen-k&r " "()" "'>'n)" "\"{\"'>'n'>'r'n" "\"}\"" "(if jde-gen-comments" "'(l \" // end of while \" (s clause)))" "'>'n'>)" ")")))
'(jde-gen-class-buffer-template (quote ("(funcall jde-gen-boilerplate-function)" "(jde-gen-get-package-statement)" "\"/**\" '>'n" "\" * \"" "(file-name-nondirectory buffer-file-name) '>'n" "\" *\" '>'n" "\" * @author \" (user-full-name) '>'n" "\" * @version $Revision: 1.1 $\" '>'n" "\" */\" '>'n'" "'>'n" "\"public class \"" "(file-name-sans-extension (file-name-nondirectory buffer-file-name))" "\" \" (jde-gen-get-extend-class)" "(if jde-gen-k&r " "()" "'>'n)" "\"{\"'>'n" "'n" "\"//---------------------------------------------------------------------\" '> 'n" "\"// CONSTRUCTORS \" '> 'n" "\"//---------------------------------------------------------------------\" '> 'n" "\"public \"" "(file-name-sans-extension (file-name-nondirectory buffer-file-name))" "\"() \"" "(if jde-gen-k&r " "()" "'>'n)" "\"{\"'>'n" "'>'p'n" "\"}\">" "'>'n" "(jde-gen-get-interface-implementation)" "'>'n" "\"//---------------------------------------------------------------------\" '> 'n" "\"// ACCESSORS\" '> 'n" "\"//---------------------------------------------------------------------\" '> 'n" "'n" "\"//---------------------------------------------------------------------\" '> 'n" "\"// PRIVILEGED DATA\" '> 'n" "\"//---------------------------------------------------------------------\" '> 'n" "'n" "\"}\"" "'>'n")))
'(jde-gen-comments nil)
'(jde-gen-get-set-var-template (quote ("(end-of-line) '&" "(P \"Variable type: \" type) \" \"" "(P \"Variable name: \" name) \";\" '>'n '>'n" "\"/**\" '>'n" "\"* Get the value of \" (s name) \".\" '>'n" "\"* @return value of \" (s name) \".\" '>'n" "\"*/\" '>'n" "'>'\"public \" (s type)" "(jde-gen-init-cap (jde-gen-lookup-named 'name))" "\"() \"" "(if jde-gen-k&r " "()" "'>'n)" "\"{\" '>'n" "\"return \" (s name) \";\" '>'n \"}\"" "'>'n '>'n" "\"/**\" '>'n" "\"* Set the value of \" (s name) \".\" '>'n" "\"* @param v Value to assign to \" (s name) \".\" '>'n" "\"*/\" '>'n" "'>'\"public void set\" (jde-gen-init-cap (jde-gen-lookup-named 'name))" "\"(\" (s type) \" v) \" " "(if jde-gen-k&r " "()" "'>'n)" "\"{\" '>'n" "'>'\"this.\" (s name) \" = v;\" '>'n \"}\" '>'n'>")))
'(jde-gen-println (quote ("(end-of-line) '&" "\"System.out.println(\" (P \"Print out: \") \");\" '>")))
'(jde-global-classpath (quote ("$JDEE_CLASSPATH")))
'(jde-imenu-enable t)
'(jde-imenu-include-signature nil)
'(jde-imenu-sort (quote asc))
'(jde-key-bindings (quote (("[? ? ?]" . jde-run-menu-run-applet) ("[? ? ?]" . jde-build) ("[? ? ?]" . jde-compile) ("[? ? ?]" . jde-debug) ("[? ? ?]" . jde-find) ("[? ? ?i]" . jde-wiz-implement-interface) ("[? ? ?j]" . jde-javadoc-generate-javadoc-template) ("[? ? ?]" . bsh) ("[? ? ?]" . jde-gen-println) ("[? ? ?]" . jde-browse-jdk-doc) ("[? ? ?]" . jde-save-project) ("[? ? ?]" . jde-wiz-update-class-list) ("[? ? ?]" . jde-run) ("[? ? ?]" . speedbar-frame-mode) ("[? ? ?]" . jde-db-menu-debug-applet) ("[? ? ?]" . jde-help-symbol) ("[? ? ?]" . jde-show-class-source) ("[? ? ?]" . jde-import-find-and-import) ("[? ? ?]" . jde-run-etrace-prev) ("[? ? ?]" . jde-run-etrace-next) ("[(control c) (control v) (control ?.)]" . jde-complete-at-point-menu) ("[(control c) (control v) ?.]" . jde-complete-at-point) ("[(control c) (control v) (control b)]" . ccc-braces) ("[(control c) (control v) ?b]" . ccc-block-comment) ("[(control c) (control v) (control m)]" . ccc-java-main))))
'(jde-make-args "CLASSROOT=$JCLASSROOT debug-build")
'(jde-mode-abbreviations (quote (("ab" . "abstract") ("bo" . "boolean") ("br" . "break") ("by" . "byte") ("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") ("in" . "int") ("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") ("thro" . "throws") ("tra" . "transient") ("tr" . "true") ("vo" . "void") ("vol" . "volatile") ("wh" . "while"))))
'(jde-mode-line-format (quote ("-" mode-line-mule-info mode-line-modified mode-line-frame-identification mode-line-buffer-identification "--" (line-number-mode "L%l--") (column-number-mode "C%c--") (-3 . "%p") (jde-which-method-mode ("--" jde-which-method-format "--")) " " global-mode-string " %[(" mode-name mode-line-process minor-mode-alist "%n" ")%]--" "-%-")))
'(jde-package-search-classpath-variables (quote (jde-db-source-directories jde-global-classpath)))
'(jde-read-make-args t)
'(jde-run-application-class "org.multijava.mjc.Main")
'(jde-run-classic-mode-vm t)
'(jde-run-read-app-args t)
'(speedbar-frame-parameters (quote ((minibuffer) (width . 40) (border-width . 0) (menu-bar-lines . 0) (unsplittable . t) (left . 930))))
'(speedbar-mode-hook nil)
'(speedbar-sort-tags t)
'(speedbar-tag-hierarchy-method (quote (speedbar-trim-words-tag-hierarchy speedbar-prefix-group-tag-hierarchy speedbar-sort-tag-hierarchy)))
'(speedbar-use-images nil)
'(tempo-interactive t))
(custom-set-faces
;; custom-set-faces was added by Custom -- don't edit or cut/paste it!
;; Your init file should contain only one such instance.
'(ecb-default-general-face ((t nil)))
'(ecb-default-highlight-face ((t (:foreground "black" :background "yellow"))))
'(font-lock-builtin-face ((t (:foreground "red"))))
'(font-lock-constant-face ((t (:foreground "cyan"))))
'(font-lock-type-face ((t (:foreground "azure3"))))
'(jde-java-font-lock-modifier-face ((t (:foreground "MediumPurple2"))))
'(jde-java-font-lock-package-face ((((class color) (background dark)) (:foreground "dodgerblue")))))