;; ;; This .emacs file is a combination of what I was given as ;; a freshman and what I have picked up along the way ;; Dan Noland circa August 2002 ;; ;; Options Menu Settings ;; ===================== ; load variable config for xemacs (needs the customize package) ;(cond ; ((string-match "XEmacs" emacs-version) ; (load-file "~/.xemacs") ; (setq-default custom-file "~/.xemacs") ; (load-file "~/.xemacs-options"))) ;;; Test of Emacs derivates ;;; ----------------------- (defvar running-xemacs (string-match "XEmacs\\|Lucid" emacs-version)) (if running-xemacs ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;; Stuff For XEmacs ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; This is a really long way of saying ;; "Load the .xemacs-options file" (cond ((and (string-match "XEmacs" emacs-version) (boundp 'emacs-major-version) (or (and (= emacs-major-version 19) (>= emacs-minor-version 14)) (= emacs-major-version 20)) (fboundp 'load-options-file)) (load-options-file "~/.xemacs-options"))) ;; If not exists create the XEmacs options file (progn (if (and (not (file-readable-p "~/.xemacs-options")) (fboundp 'save-options-menu-settings)) (save-options-menu-settings)) ;; Remember font and more settings (setq options-save-faces t) )) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; Stuff For Standard emacs ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (setq term-file-prefix nil) ;;;;; set text mode as default mode (setq default-major-mode 'text-mode) ;; always auto-fill in text mode. (add-hook 'text-mode-hook 'turn-on-auto-fill) ;;;;; Fear the great and powerfull auto-mode-list of nolandda (setq auto-mode-alist (append '(("\\.h\\'" . c-mode) ("\\.c\\'" . c-mode) ("\\.hh\\'" . c++-mode) ("\\.hx\\'" . c++-mode) ("\\.hpp\\'" . c++-mode) ("\\.cc\\'" . c++-mode) ("\\.cpp\\'" . c++-mode) ("\\.[CH]\\'" . c++-mode) ("\\.java\\'" . java-mode) (".*[mM]akefile.*" . makefile-mode) ("\\.html\\'" . sgml-mode) ("\\.HTML\\'" . sgml-mode) ("\\.htm\\'" . sgml-mode) ("\\.HTM\\'" . sgml-mode) ("\.xemacs" . emacs-lisp-mode) ("\.emacs" . emacs-lisp-mode) ("\\.el\\'" . emacs-lisp-mode) ("\\.p[lm]\\'" . perl-mode) ("\\.sh\\'" . sh-mode) ("\.bash_profile" . sh-mode) ("\.bashrc" . sh-mode) ("\.cshrc" . sh-mode) ("\.tcshrc" . sh-mode) ("\\.sql\\'" . sql-mode) ("\\.txt\\'" . text-mode) ("\\.text\\'" . text-mode) ("\\.py\\'" . python-mode) ("\\.ps\\'" . postscript-mode) ("\\.[tT]e[xX]\\'" . tex-mode) ("\\.ltx\\'" . latex-mode) ("\\.bib\\'" . bibtex-mode) ("\\.[sS]\\'" . asm-mode) ("\\.asm\\'" . asm-mode) ("\\.scm\\'" . scheme-mode) ("\\.awk\\'" . awk-mode) ("\\.f\\(or\\)?\\'" . fortran-mode) ("\\.f\\(?:or\\)?\\'" . fortran-mode) ("\\.[fF]90\\'" . f90-mode) ("\\.ad[abs]\\'" . ada-mode) ("\\.lisp\\'" . lisp-mode) ("\\.cl\\'" . lisp-mode) ("\\.cm\\'" . lisp-mode) ("\\.clm\\'" . lisp-mode) ("\\.p\\(as\\)?\\'" . pascal-mode) ("\\.p\\(?:as\\)?\\'" . pascal-mode) ("\\.lex\\'" . c-mode) ("\\.yacc\\'" . c-mode) ("\\.yy\\'" . c-mode) ("\\.y\\'" . c-mode) ("\\.bas\\'" . basic-mode) ("\\.vbs\\'" . basic-mode) ("\\.m\\'" . matlab-mode) ("\\.[Jj][Pp][Ee]?[Gg]\\'" . image-mode) ("\\.[Pp][Nn][Gg]\\'" . image-mode) ("\\.[Gg][Ii][Ff]\\'" . image-mode) ("\\.[Tt][Ii][Ff][Ff]?\\'" . image-mode) ) auto-mode-alist)) ;; We want to see the line/column number at the bottom of the page (setq line-number-mode t) (setq column-number-mode t) ;; Always end a file with a newline (setq require-final-newline t) ;; make all "yes or no" prompts be "y or n" instead (fset 'yes-or-no-p 'y-or-n-p) ;; Turn off things that annoy me (setq scroll-step 1) ; Scroll one line at a time damnit! (setq visible-bell t) ; Turn off the &*^%$ bell! (setq inhibit-startup-message t) ; no splash screen ;; This enables the colors ;; Turn on font-lock in all modes that support it (if (fboundp 'global-font-lock-mode) (global-font-lock-mode t)) (setq font-lock-make-faces t) (setq font-lock-maximum-decoration t) ;; Fun with colors (don't you fell like the old BBS days again ;;setup display colors for font-lock ;(set-foreground-color "black") ;(set-background-color "white") (set-face-background 'default "black") (set-face-foreground 'default "white") ;; apparently xemacs 20.4 hates colors (cond ((not running-xemacs) (set-face-foreground font-lock-comment-face "red") (set-face-foreground font-lock-string-face "cornflower blue") (set-face-foreground font-lock-keyword-face "RoyalBlue1") (set-face-foreground font-lock-function-name-face "RoyalBlue1") (set-face-foreground font-lock-variable-name-face "DarkGoldenrod1") (set-face-foreground font-lock-type-face "lime green") (set-face-foreground font-lock-builtin-face "purple2") (set-face-foreground font-lock-constant-face "dark grey") (set-face-foreground font-lock-reference-face "dark grey"))) ;;; Some handy keys (global-set-key "\C-x\C-r" 'next-error) (global-set-key "\C-x\C-e" 'compile) (global-set-key "\C-x\C-g" 'goto-line) (global-set-key "\C-z" 'undo) (global-set-key "\C-n" 'bs-cycle-next) (global-set-key [delete] 'delete-char) (global-set-key [home] 'beginning-of-buffer) (global-set-key [end] 'end-of-buffer) (global-set-key [F7] 'ispell-buffer) ;; xemacs 20.4 hates this too ;(if (not running-xemacs) (cond ((not running-xemacs) ;;; Ctrl-Tab and Ctrl-Shift-Tab cycle through buffers ;; (global-set-key [\C-tab] 'bs-cycle-next) ;; (global-set-key [\C-\S-tab] 'bs-cycle-previous) (global-set-key [\C-\S-.] 'bs-cycle-next) (global-set-key [\C-\S-,] 'bs-cycle-previous) )) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;; This will save your life some day ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (setq auto-save-default t) ; Yes auto save good (setq auto-save-interval 100) ; Number of input chars between auto-saves (setq auto-save-timeout 300) ; Number of seconds idle time before auto-save ;; xemacs 20.4 doesn't hate this, it just ignores it ;; and covers your FS with a billion ~ files which is ;; worse than not using it at all (cond ((not running-xemacs) ;; make backup files in ~/.backups/ rather than scattered around all ;; over the filesystem. ;; To put the backup~ files in ~/.backups (setq backup-by-copying t) ; don't clobber symlinks (setq backup-directory-alist '(("." . "~/.backups"))) ; don't litter my fs tree (setq delete-old-versions t) ; clean up a little (setq kept-new-versions 6) ; keep 6 new (setq kept-old-versions 2) ; keep only 2 old (setq version-control t) ; use versioned backups )) ;--------------------------------------------------------------------------- ; This section sets up some default values for when you are editing in C-mode ;--------------------------------------------------------------------------- (defun my-c-setup () (c-set-offset 'substatement-open 0) ;(c++-set-offset 'substatement-open 0) ;(java-set-offset 'substatement-open 0) (setq c-indent-level 2) ; set indentation to 4 spaces (setq c-continued-statement-offset 2) ; sets the amount to indent cont'd lines (setq c-tab-always-indent nil) ; indent if at beg of line else ins TAB (setq c-brace-offset 0) ; sets the indent for braces (setq c-brace-imaginary-offset 0) (setq c-argdecl-indent 0) (setq c-label-indent 2) (setq c-label-offset 9) (auto-fill-mode 1)) (add-hook 'c-mode-common-hook 'my-c-setup) ;(add-hook 'c-mode-hook 'my-c-setup) ;(add-hook 'c++mode-hook 'my-c-setup) ;(add-hook 'java-mode-hook 'my-c-setup) ;; We hate K&R C and since the new XINU code ;; no longer uses it we turn it off! (setq c-recognize-knr-p nil) ;(setq c-indent-level 2) ; set indentation to 4 spaces ;(setq c-continued-statement-offset 2) ; sets the amount to indent cont'd lines ;(setq c-tab-always-indent nil) ; indent if at beg of line else ins TAB ;(setq c-brace-offset 0) ; sets the indent for braces ;(setq c-brace-imaginary-offset 0) ;(setq c-argdecl-indent 0) ;(setq c-label-indent 2) ;(setq c-label-offset 9) ;(auto-fill-mode 1) (autoload 'matlab-mode "/home/nolandd/elisp/matlab-mode.el" "Enter Matlab mode." t) (load "/home/nolandd/elisp/header2.el") (setq header-copyright-notice "Copyright (C) Dan Noland 2003\n") (setq make-header-hooks '(header-mode-line header-file-name header-copyright header-author header-creation-date header-modification-author header-modification-date header-update-count header-status header-end-line)) ;------------------------------------------------------------------ ; This section programs a date function (useful for logging times ; in job notes, etc). The date function is attached to . ; Added Thu Apr 16 15:39:12 EST 1987 :-) ;------------------------------------------------------------------ (defun current-date-and-time () "Insert the current date and time (as given by UNIX date) at dot." (interactive) (call-process "date" nil t nil)) (global-set-key "\C-x\C-d" 'current-date-and-time) ;--------------------------------------------------------------- ; Get rid of the infernal windoze chars ; Added Mon Aug 26 04:44:09 EST 2002 ;--------------------------------------------------------------- (defun turn-to-unix () (interactive) (set-buffer-file-coding-system 'iso-8859-1-unix)) (global-set-key "\C-x\C-u" 'turn-to-unix) ;--------------------------------------------------------------- ; Best Function yet! Indent the whole buffer! ; Added Sat Sep 14 02:58:03 EST 2002 ;--------------------------------------------------------------- (defun indent-whole-buffer () (interactive) (indent-region (point-min) (point-max) nil)) (global-set-key "\C-x\C-i" 'indent-whole-buffer) (put 'downcase-region 'disabled nil) ;--------------------------------------------------------------- ; Start a new shell window ; Added Tue Feb 10 09:24:18 EST 2004 ;--------------------------------------------------------------- (defun starta-shell() (interactive) (shell) (rename-buffer "emacs-term")) (global-set-key "\M-$" 'starta-shell)