;; .emacs ;;----------------------------------------------------------+ ;; JAMIES EMACS CONFIG FILE | ;;----------------------------------------------------------+ ;; | ;; STARTED: 05/15/2006 | ;; UPDATED: 06/01/2006 | ;; CONTACT: jestill_at_sourceforge.net | ;; | ;;----------------------------------------------------------+ ;;----------------------------+ ;; BASIC INTERFACE PROPERTIES | ;;----------------------------+ ;; turn on font-lock mode (global-font-lock-mode t) ;; enable visual feedback on selections (setq transient-mark-mode t) ;; Show column-number in the mode line (column-number-mode 1) ;;Show matching parenthesis (show-paren-mode 1) ;;Use y or n for yes or no (fset 'yes-or-no-p 'y-or-n-p) ;;----------------------------+ ;; NEW FUNCTIONS | ;;----------------------------+ ;; INSERT DATE INTO BUFFER ;; Modified from two sources: ;; http://www.dotemacs.de/dotfiles/BenjaminRutt.emacs.html ;; http://www.perseguers.ch/epfl/linux/config/emacs (defun insert-date () "Insert date at point." (interactive) (insert (format-time-string "%m/%d/%Y")) ) (defun insert-long-comment () (interactive) (insert "-----------------------------------------------------------+\n") ) (defun insert-short-comment () (interactive) (insert "-----------------------------+\n") ) ;;----------------------------+ ;; FUNCTION KEYS | ;;----------------------------+ ;; Make F1 invoke help (global-set-key [f1] 'help-command) ;; Make F2 be undo (global-set-key [f2] 'undo) ;; Make F5 be "mark", F6 be "copy", F8 be "paste" ;; Note that you can set a key sequence either to a command or to another ;; key sequence. ;; EDITING RELATED FUNCTIONS (global-set-key [f5] 'set-mark-command) ;; Set Mark (global-set-key [f6] "\M-w") ;; Copy (global-set-key [f7] "\C-w") ;; Cut (global-set-key [f8] "\C-y") ;; Paste ;; COMMENT RELATED FUNCTIONS (global-set-key [f9] 'insert-date) ;; Insert date as MM/DD/YYYY (global-set-key [f10] 'insert-long-comment) (global-set-key [f11] 'insert-short-comment) ;;----------------------------+ ;; META AND CTL KEYS | ;;----------------------------+ ;;; Jump to a specific line of the current buffer (global-set-key "\M-g" 'goto-line) ;;----------------------------+ ;; FONT LOCK DISPLAY | ;;----------------------------+ ;; Modify my font lock display here ;; This should do a xemacs or text emacs ;; check here to determine how the text ;; will be displayed. ;; The following is ugly and not what I want but it ;; gives me the syntax to work with. (custom-set-faces '(font-lock-builtin-face ((t (:background "grayex")))) ;;'(font-lock-builtin-face ((t (:foreground "deepskyblue")))) ;;'(font-lock-comment-face ((t (:foreground "gray60")))) ;;'(font-lock-doc-face ((t (:foreground "darkkhaki")))) ;;'(font-lock-keyword-face ((t (:foreground "magenta")))) ;;'(font-lock-function-name-face ((t (:foreground "green" :background "seagreen")))) ;;'(font-lock-string-face ((t (:foreground "gold")))) ;;'(font-lock-type-face ((t (:foreground "cyan" :background "slateblue")))) ;;'(font-lock-variable-name-face ((t (:foreground "yellow")))) ;;'(modeline ((t (:foreground "plum1" :background "navy")))) ;;'(region ((t (:background "sienna")))) ;;'(highlight ((t (:foreground "black" :background "darkseagreen2")))) '(diff-added-face ((t (:foreground "green")))) '(diff-changed-face ((t (:foreground "yellow")))) '(diff-header-face ((t (:foreground "cyan")))) '(diff-hunk-header-face ((t (:foreground "magenta")))) '(diff-removed-face ((t (:foreground "red"))))) ;;----------------------------+ ;; LOAD LOCAL EMACS MODES | ;;----------------------------+ ;; ESS for programmin in R (load "/home/jestill/Apps/ESS/ess-5.3.0/lisp/ess-site") ;; Fontify Apollo Tiers Files (load "/home/jestill/temp/apollo-tiers-mode.el") ;; ;;-----------------------------------------------------------+ ;; ;; USE CPERL MODE FOR EDITING PERL FILES | ;; ;; 06/28/2006 | ;; ;;-----------------------------------------------------------+ ;; ;;-----------------------------+ ;; ;; TRY THE OTHER PERL EDITOR | ;; ;;-----------------------------+ ;; ;; http://www.khngai.com/emacs/perl.php ;; ;; Use cperl-mode instead of the default perl-mode ;; (add-to-list 'auto-mode-alist '("\\.\\([pP][Llm]\\|al\\)\\'" . cperl-mode)) ;; (add-to-list 'interpreter-mode-alist '("perl" . cperl-mode)) ;; (add-to-list 'interpreter-mode-alist '("perl5" . cperl-mode)) ;; (add-to-list 'interpreter-mode-alist '("miniperl" . cperl-mode)) ;; (setq cperl-invalid-face (quote off)) ;; Turn off trailing white spaces ;; (setq cperl-auto-newline t) ;; Add neline after semicolon etc. ;; ;; ALWAYS HIGHLIGHT SCALAR VARIABLES ;; ;; http://www.emacswiki.org/cgi-bin/wiki/CPerlMode ;; (setq cperl-highlight-variables-indiscriminately t) ;; ;; SOME CHANGES TO INDENTATION IN PERL MODE ;; (add-hook 'cperl-mode-hook 'n-cperl-mode-hook t) ;; (defun n-cperl-mode-hook () ;; (setq cperl-indent-level 4) ;; ;;(setq cperl-continued-statement-offset 0) ;; ;;(setq cperl-extra-newline-before-brace t) ;; ;;(set-face-background 'cperl-array-face "wheat") ;; ;;(set-face-background 'cperl-hash-face "wheat") ;; ) ;; ;;JOING MACRO NEEDED BELOW ;; (defmacro join (join-char &rest others) `(mapconcat 'identity ',others ,join-char)) ;; ;; MODIFY STRUCTURE OF OUTLINE MODE ;; ;; http://www.emacswiki.org/cgi-bin/wiki/CPerlModeOutlineMode ;; (setq my-cperl-outline-regexp ;; (concat ;; "^" ; Start of line ;; "[ \\t]*" ; Skip leading whitespace ;; "\\(" ; begin capture group \1 ;; (join "\\|" ;; "=head[12]" ; POD header ;; "package" ; package ;; "=item" ; POD item ;; "sub" ; subroutine definition ;; ) ;; "\\)" ; end capture group \1 ;; "\\b" ; Word boundary ;; )) ;; (setq cperl-mode-hook 'my-cperl-customizations) ;; (defun my-cperl-customizations () ;; "cperl-mode customizations that must be done after cperl-mode loads" ;; (outline-minor-mode) ;; (abbrev-mode) ;; (defun cperl-outline-level () ;; (looking-at outline-regexp) ;; (let ((match (match-string 1))) ;; (cond ;; ((eq match "=head1" ) 1) ;; ((eq match "package") 2) ;; ((eq match "=head2" ) 3) ;; ((eq match "=item" ) 4) ;; ((eq match "sub" ) 5) ;; (t 7) ;; ))) ;; (setq cperl-outline-regexp my-cperl-outline-regexp) ;; (setq outline-regexp cperl-outline-regexp) ;; (setq outline-level 'cperl-outline-level) ;; ) ;; TRY TO MAKE OUTLINE MODE WORK IN DEFAULT PERL MODE ;; ;;JOING MACRO NEEDED BELOW (defmacro join (join-char &rest others) `(mapconcat 'identity ',others ,join-char)) ;; MODIFY STRUCTURE OF OUTLINE MODE ;; http://www.emacswiki.org/cgi-bin/wiki/CPerlModeOutlineMode (setq my-perl-outline-regexp (concat "^" ; Start of line "[ \\t]*" ; Skip leading whitespace "\\(" ; begin capture group \1 (join "\\|" "=head[12]" ; POD header "package" ; package "=item" ; POD item "sub" ; subroutine definition ) "\\)" ; end capture group \1 "\\b" ; Word boundary )) (setq perl-mode-hook 'my-perl-customizations) (defun my-perl-customizations () "perl-mode customizations that must be done after cperl-mode loads" (outline-minor-mode) (abbrev-mode) (defun perl-outline-level () (looking-at outline-regexp) (let ((match (match-string 1))) (cond ((eq match "=head1" ) 1) ((eq match "package") 2) ((eq match "=head2" ) 3) ((eq match "=item" ) 4) ((eq match "sub" ) 5) (t 7) ))) (setq perl-outline-regexp my-perl-outline-regexp) (setq outline-regexp perl-outline-regexp) (setq outline-level 'perl-outline-level) )