The very unofficial .emacs home JavierOviedo.emacs
emacs
Sections
home
what is this all about ?
customization basics
special topics
local dotfiles
dotfiles on the web
new and updated pages
useful sites and pages
search locally
EMacro
OS/2 Emacs
Latest Additions
local files:
John J. Glynn
David Jolley

linked files:


articles:


links:
The Emacs wiki
ODP search for Emacs


dmoz.org
;;; Javier Oviedo's Emacs init file.
;;; joviedo@glue.umd.edu
;;; 
;;; This file contains my emacs customizations. Most of this file I have 
;;; borrowed from other files, but some(very little) I wrote myself.
;;; gnu.help.emacs has been an invaluable resource.
;;;
;;; I have "tried" to organize this file into managable and logical sections,
;;; but there still seems to be a little over lap. I am now considering
;;; breaking this file up into seperate files according to the sections that
;;; I have created.
;;;
;;; Anyway, I am always trying to improve this file so please feel free to
;;; e-mail any suggestions. Again, I can only take true credit for about
;;; 5-10% of this file. The other 90-95% has been obtained through other
;;; peoples .emacs files and newsgroups.

;;; LAST MODIFIED ON:  Wed 31-Jan-2001 14:27:58
;;; LAST MODIFIED BY:  Javier Oviedo


;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; various setups

;;{{{ Various Variable and misc setups...

;;; Set the load path
(setq load-path (cons "~/site-lisp" load-path))
(setq load-path (cons "~/site-lisp/GAMES" load-path))
(setq load-path (cons "~/site-lisp/TEST-STUFF/" load-path))
(setq enable-local-eval t)
;;;

;;;
(set-default-font
       "-adobe-courier-medium-r-normal--12-120-75-75-m-70-iso8859-1");;;
;;;

;;; return to same line on a scroll back
(setq scroll-preserve-screen-position t)
;;;

;;; Use spaces instead of tabs to indent
(setq-default indent-tabs-mode nil)
;;;

;;;
(setq abbreviated-home-dir
      "/afs/wam.umd.edu/home/wam/j/o/joviedo/home\\(/\\|$\\)")
(setq frame-title-format '("<WAM> " (buffer-file-name " %f")))
;; (setq frame-title-format '("<Telogy> %b" (buffer-file-name ": %f")))
;; (setq frame-title-format '("<Telogy> " (buffer-file-name " %f")))
;;;

;;; Paste at cursor NOT mouse pointer position
(setq mouse-yank-at-point t)
;;;

;;; Extended video modes; these are for ATi Mach32 SVGA
(setq screen-dimensions-25x132 35)
(setq screen-dimensions-44x132 51)
;;;

;;; Type 'y' instead of 'yes'
(fset 'yes-or-no-p 'y-or-n-p)
;;;

;;; Turn off backup files.
(setq make-backup-files nil)
;;;

;;; Display the column number on modeline
(condition-case err
    (column-number-mode t)
   (error
	(message "Cannot display Column Number %s" (cdr err))))
;;;

;;; This is to not display the initial message (which says to a novice
;;; user what to do first if he/she is confused).
(setq inhibit-startup-message t)
;;;

;;; ...and this inhibits the startup blurb in the echo area.
(setq inhibit-startup-echo-area-message "john_doe")
;;;

;;; This disables down-arrow and C-n at the end of a buffer from adding
;;; a new line to that buffer.
(setq next-line-add-newlines nil)
;;;

;;; Overlap between window-fulls when scrolling by pages
(setq next-screen-context-lines 3)
;;;

;;;
(setq blink-matching-paren t)
;;;

;;; Turn on auto-fill. 
(setq auto-fill-mode t)
(setq comment-multi-line t)
(setq fill-column 75)
;;;

;;; Get rid of old versions of files
(setq delete-old-versions t)
;;;

;;; Highlight during query
(setq query-replace-highlight t)
;;;

;;; Highlight incremental search
(setq search-highlight t)
;;;

;;; SCroll stuff
(setq scroll-conservatively 5)
(setq scroll-step 1)
;;;

;;;
(setq-default transient-mark-mode nil)
;;;

;;; Set for visual bell
(setq visible-bell t)
;;;

;;; Line number mode true
(setq line-number-mode t)
;;;

;;; Make searches case insensitive
(setq case-fold-search t)
;;;

;;; Modeline stuff
(setq default-mode-line-format
      '("-"
       mode-line-mule-info
       mode-line-modified
       mode-line-frame-identification
       mode-line-buffer-identification
       "  "
       global-mode-string
       "   %[(" mode-name mode-line-process minor-mode-alist "%n" ")%]--"
       (line-number-mode "L%l--")
       (column-number-mode "C%c--")
       (-3 . "%p")
       "-%-"))
;;;

;;; Automatically makes the matching paren stand out in color.
(condition-case err
    (show-paren-mode t)
  (error
   (message "Cannot show parens %s" (cdr err))))
;;;

;;; Display the time on modeline
(condition-case err
    (display-time)
  (error
   (message "Cannot display time %s" (cdr err))))
;;; 

;;;
(setq auto-save-timeout 1800)
(setq require-final-newline t)
(setq search-highlight t)
(setq compilation-window-height 12)
(setq compilation-ask-about-save nil)
;;;

;;; This makes `apropos' and `super-apropos' do everything that they can.
;;; Makes them run 2 or 3 times slower.  Set this non-nil if you have a
;;; fast machine.
(setq apropos-do-all t)
;;;

;;; This will prevent newlines from being inserted after semicolons
;;; when there is a non-blank following line. Otherwise, it makes no
;;; determination. To use, add this to the front of the
;;; c-hanging-semi&comma-criteria list.
(defun c-semi&comma-no-newlines-before-nonblanks ()
  (save-excursion
    (if (and (eq last-command-char ?\;)
             (zerop (forward-line 1))
             (not-modified (looking-at "^[ \t]*$")))
        'stop
      nil)))


(custom-set-variables
 '(c-hanging-semi&comma-criteria (quote (c-semi&comma-no-newlines-before-nonblanks c-semi&comma-inside-parenlist))))
(custom-set-faces)

;;;

;;; Defines the expand list for cc-mode.
(defconst c-expand-list
  '(
    ;("ife" "if() \n{\n\n}\nelse \n{\n \n}" (4 9 21))
    ("ift" "if() \n{\n\n" (4 9))
    ("uns" "unsigned ")
    ("fo" "for(;;) \n{\n\n" (5 7 12))
    ("switch" "switch() \n{\n\n" (8 13))
    ("case" "case :\n\nbreak;\n" (6 8 16))
    ;("dow" "do \n{\n\n} while ();" (6 16))
    ("whi" "while() \n{\n\n" (7 12))
    ("default" "default:\nbreak;" 10)
    ("main" "int main(int argc, char * argv[])\n{\n\n\n" 37))
  "Expansions for C mode")
;;;

;;; open files with appropriate mode according to its extension.
(setq auto-mode-alist
      (append '(("\\.pl$" . perl-mode)
		("\\.prolog$" . c++-mode)
		("\\.make$" . makefile-mode)
		("\\makefile$" . makefile-mode)
		("\\CONFIG$" . makefile-mode)
		("\\.m$"  . matlab-mode)
  		("cshrc" . shell-script-mode)
		("emacs" . emacs-lisp-mode)
		("\\.csh$" . shell-script-mode)
		("\\.tar$" . tar-mode)
		("\\.java$" . c++-mode)
		("\\.c$"  . c-mode)
		("\\.C$"  . c-mode)
		("\\.cc$" . c++-mode)
		("\\.cpp$" . c++-mode)
		("\\.cxx$" . c++-mode)
		("\\.CC$"  . c++-mode)
		("\\.h$"  . c-mode)
		("\\.H$"  . c-mode)
		("\\.hpp$" . c++-mode)
		("\\.hxx$" . c++-mode)
		("\\.hh$" . c++-mode))
	      auto-mode-alist))
;;;

;;;
;;; Enable some commands we need.
(put 'narrow-to-region 'disabled nil)
(put 'downcase-region 'disabled nil)
(put 'upcase-region 'disabled nil)
;;;

;;;Setting this to t makes scrolling faster, but may momentarily present
;;;unfontified areas when you scroll into them.
					;(setq lazy-lock-defer-driven t)
(setq lazy-lock-defer-on-scrolling t)
;;;

;;;This enables archive browsing and editing.
(setq auto-mode-alist
      (cons '("\\.\\(arc\\|zip\\|lzh\\|zoo\\)\\'" . archive-mode)
            auto-mode-alist))
;;;

;;;This enables automatic resizing of the minibuffer when its contents
;;;won't fit into a single line.
(condition-case err
    (resize-minibuffer-mode 1)
  (error
   (message "Cannot resize minibuffer %s" (cdr err))))
;;;

;;; Ps-Print customization.
(setq ps-header-lines 3)
(setq ps-paper-type 'ps-a4)
;;;

;;;
(setq circulate-include "")

;;}}}

;;; end - various setups
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;


;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; font-lock section

;;{{{ Configure font-lock features...

;;; Set up support for lazy-lock
(setq font-lock-support-mode '((t . lazy-lock-mode)))
;;;

;;; Set the maximum buffer size for coloured text to unlimited
(setq-default font-lock-maximum-size nil)
;;;

;;;
;; (setq lazy-lock-defer-driven nil)
(setq lazy-lock-defer-on-scrolling t)
;;;

;;;--------------------------------
;;; face font-lock
;;;
;;; [colors] gold,orange,gray,cyan,magenta,brown,pink,light*,dark*
;;;-------------------------------
;;; where FACE should be one of the face symbols, and the subsequent element
;;; items should be the attributes for the corresponding Font Lock mode
;;; faces.  Attributes FOREGROUND and BACKGROUND should be strings (default
;;; if nil), while BOLD-P, ITALIC-P, and UNDERLINE-P should specify the
;;; corresponding face attributes (yes if non-nil).
;;;
;;; (FACE FOREGROUND BACKGROUND BOLD-P ITALIC-P UNDERLINE-P)

(set-face-foreground 'default "white")
(set-face-background 'default "black")

(set-foreground-color "slategray")
(set-background-color "black")

(set-face-foreground 'region "wheat")
(set-face-background 'region "darkslategray")
(set-face-italic-p 'region t)

(set-face-foreground 'highlight "red")
(set-face-background 'highlight "Blue4")

(set-face-foreground 'secondary-selection "yellow")
(set-face-background 'secondary-selection "MidnightBlue")

(set-cursor-color "red")

(set-face-foreground 'modeline "gold")
;; (set-face-background 'modeline "black")
(set-face-background 'modeline "MidnightBlue")

(set-face-foreground 'show-paren-match-face "white")
(set-face-background 'show-paren-match-face "blueviolet")
(set-face-bold-p 'show-paren-match-face t)

(set-face-foreground 'show-paren-mismatch-face "black")
(set-face-background 'show-paren-mismatch-face "yellow")
(set-face-italic-p 'show-paren-mismatch-face t)

;;; (font-lock-SOMETHING-face  FOREGROUND BACKGROUND BOLD ITALIC UNDERLINE)
(setq font-lock-face-attributes
      '((font-lock-comment-face        "SteelBlue" nil nil 1 nil)
	(font-lock-string-face         "cyan" nil nil 1 nil)
	(font-lock-keyword-face        "darkorange"  nil nil nil nil)
	(font-lock-type-face           "yellow" nil nil nil nil)
	(font-lock-function-name-face  "DeepSkyBlue"  nil nil nil 1)
	(font-lock-variable-name-face  "magenta" nil nil nil nil)
	(font-lock-reference-face      "blue" nil nil nil nil)
	(font-lock-builtin-face        "lightblue" nil nil nil nil)
	(font-lock-constant-face       "cornflowerblue" nil nil nil nil)
	(font-lock-warning-face        "red" nil nil nil nil)))
;;;

;;;
(global-font-lock-mode t)
;;;

;;; Font-locking faces set-up
(setq font-lock-maximum-decoration t)
;;;

;;}}}

;;; end - font-lock section
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;


;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; load/require section

;;{{{ Lisp files to be loaded as needed...

;; (require 'my-tetris)

(autoload 'folding-mode          "folding" "Folding mode" t)
(autoload 'turn-off-folding-mode "folding" "Folding mode" t)
(autoload 'turn-on-folding-mode  "folding" "Folding mode" t)

(require 'ishl)
(ishl-mode t)

(require 'my-line-number)

;;; Require c/c++ files only in c/c++ mode
(defun my-c-load-stuff ()
  (require 'misc-c-functions)
  (require 'cc-mode-block-comment)
  (require 'get-includes)
  (require 'align)
  (require 'my-ifdef)
  (require 'glasses)
 
  (require 'ctypes)
  (setq ctypes-write-types-at-exit t)
  (ctypes-read-file "~/site-lisp/_ctypes")
  (ctypes-auto-parse-mode 1)

  (require 'cwarn)
  (global-cwarn-mode 1))
;;;

;;; Load follow-mouse
;; (require 'follow-mouse)
;; (toggle-follow-mouse 1)
;; (setq follow-mouse-deselect-active-minibuffer nil)
;;;

;;; Load matlab-mode
(require 'matlab)
;;;

;;; Load comment-out-region
(require 'comment)
;(autoload 'comment-out-region "comment" nil t)
;;;

;;; Load misc.el
(require 'misc)
;;;

;;; Require dired files only in dired mode
(defun my-dired-load-stuff ()
  (require 'my-dired)
  (autoload 'tar-mode "tar-mode")
  (require 'dired-tar))
;;;

;;; Turn on highlighting for Dired (C-x d) and list-buffers (C-b)
(require 'linemenu)

(defadvice list-buffers (after highlight-line activate)
  (save-excursion
    (set-buffer "*Buffer List*")
    (linemenu-initialize)))
(defadvice electric-buffer-menu-looper (after highlight-line activate)
  (linemenu-highlight-current-line))
(add-hook 'dired-after-readin-hook 'linemenu-initialize)
(add-hook 'electric-buffer-menu-hook 'linemenu-initialize)
;;;
   
;;; Load mic-paren.el
(require 'mic-paren)  
(paren-activate)
(add-hook 'c-mode-common-hook
          (function (lambda ()
                       (paren-toggle-open-paren-context 1))))
;;;

;;; Loads scroll-inplace.el
(require 'scroll-in-place)
;;;

;;;This loads a package which enables automatic scrolling when long
;;;lines are truncated.
(condition-case err
    (require 'auto-show)
  (error
   (message "Cannot auto-scroll long lines %s" (cdr err))))
;;;

;;;
(require 'misc-lisp-functions)
;;;

;;}}}

;;; end - load/require section
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;


;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; mode stuff (various different modes)

;;{{{ Functions that are added to specific mode hooks...

;;; This defines and sets up my customized c-mode indentation.
(defun my-c-stuff ()
  "My own C stuff.  Swaps RET and LFD (^J) and customizes
indentation style and dynamic abbrevs."
  (modify-syntax-entry ?_ "w")

  (c-set-offset 'defun-open 0 nil)
  (c-set-offset 'defun-block-intro 3 nil)  
  (c-set-offset 'statement 0 nil)
  (c-set-offset 'statement-block-intro 3 nil)
  (c-set-offset 'substatement 3 nil)
  (c-set-offset 'statement-case-intro 3 nil)
  (c-set-offset 'statement-case-open 3 nil)
  (c-set-offset 'inclass 5 nil)
  (c-set-offset 'case-label 3 nil)
  (c-set-offset 'inline-open 0 nil)
  (c-set-offset 'access-label -2 nil)
  (c-set-offset 'label 10 nil)

  (local-set-key (kbd "TAB") 'indent-or-expand)

  (set (make-local-variable 'c-indent-level) 0)
  (setq c-electric-pound-behavior '(alignleft))
  (setq c-progress-interval 8);; or else I tend to think it crashed
  (setq c-macro-shrink-window-flag t)
  (setq c-macro-prompt-flag t)
  (setq c-toggle-auto-state t)
  (set (make-local-variable 'dabbrev-case-fold-search) nil)
  (set (make-local-variable 'dabbrev-case-replace) nil)
  (define-key c-mode-map "\C-c %" 'match-paren)
  (define-key c-mode-map "\C-j" 'newline)
  (define-key c-mode-map "\C-m" 'newline-and-indent)
  (setq c-tab-always-indent t)
  (setq c-basic-offset 0)

  (setq c-auto-newline t)
  (setq c-hanging-braces-alist
        '((substatement-open . (before after))
          (brace-list-open)
          (brace-list-close)
          (brace-list-intro)
          (brace-entry-open)
	(block-close . my-c-snug-do-while))))
;;;
(add-hook 'c-mode-common-hook 'my-c-load-stuff)
(add-hook 'c-mode-common-hook 'my-c-stuff)
(add-hook 'c-mode-common-hook 'turn-on-font-lock)
(add-hook 'c-special-indent-hook 'comment-block-close)
(add-hook 'c-mode-hook
	  (function
	   (lambda ()
	   (expand-add-abbrevs c-mode-abbrev-table c-expand-list)
	   (abbrev-mode 1))))
;;;

;;; Bind RET to newline-and-indent for c and c++
(add-hook 'c-mode-common-hook
	  '(lambda ()
	     (local-set-key "\C-m" 'newline-and-indent)))
;;;

;;; Change the face color for #define
(font-lock-add-keywords 'c-mode '(("^#[         ]*define[       ]+\\(\\sw+\\)\\s-*$" 1 font-lock-constant-face)))
;;;

;;; Makefile stuff
(defun my-makefile-stuff ()
  "My own makefile-mode"
  (setq makefile-tab-after-target-colon t))
;;;
(add-hook 'makefile-mode-hook 'my-makefile-stuff)
(add-hook 'makefile-mode-hook 'turn-on-font-lock)
;;;

;;; Perl stuff
(defun my-perl-stuff ()
  "My own Perl-mode."
  
  (setq perl-indent-level 3)
  (setq perl-continued-statement-offset 3)
  (setq perl-continued-brace-offset -3)
  (setq perl-brace-offset 0)
  (setq perl-brace-imaginary-offset 0)
  (setq perl-label-offset 0)

  (setq perl-tab-to-comment t)
  (setq perl-tab-always-indent t))
;;;
(add-hook 'perl-mode-hook 'my-perl-stuff)
(add-hook 'perl-mode-hook 'turn-on-font-lock)
;;;

;;;
(defun my-textmode-stuff ()
  "My own Text-Mode routine. Customizes dynamic abbrevs."
  (set (make-local-variable 'dabbrev-case-fold-search) nil)
  (set (make-local-variable 'dabbrev-case-replace) t)
  (set (make-local-variable 'dabbrev-upcase-means-case-search) t)
  (local-set-key (kbd "TAB") 'indent-or-expand)
  (setq fill-column 75))
;;;
(add-hook 'text-mode-hook 'turn-on-auto-fill)
(add-hook 'text-mode-hook 'my-textmode-stuff)
;;;

;;;
(defun my-fundamental-mode ()
  "My own fundamental mode stuff."
  (set (make-local-variable 'dabbrev-case-fold-search) nil)
  (set (make-local-variable 'dabbrev-case-replace) t)
  (set (make-local-variable 'dabbrev-upcase-means-case-search) t)
  (local-set-key (kbd "TAB") 'indent-or-expand))
;;;
(add-hook 'fundamental-mode-hook 'turn-on-auto-fill)
(add-hook 'fundamental-mode-hook 'my-fundamental-mode)
;;;

;;;
(defun my-elisp-stuff ()
  "My own Emacs Lisp stuff.  Currently remaps ^J and ^M and customizes
dynamic abbrevs."
  (set (make-local-variable 'dabbrev-case-fold-search) nil)
  (set (make-local-variable 'dabbrev-case-replace) nil)
  (define-key emacs-lisp-mode-map "\C-j" 'newline)
  (define-key emacs-lisp-mode-map "\C-m" 'newline-and-indent)
  (local-set-key (kbd "TAB") 'indent-or-expand))
;;;
(add-hook 'emacs-lisp-mode-hook 'my-elisp-stuff)
(add-hook 'emacs-lisp-mode-hook 'turn-on-font-lock)
;;;

;;;
(defun my-matlab-mode ()
  "My own matlab-mode stuff"
  (local-set-key (kbd "TAB") 'indent-or-expand)
  (setq matlab-indent-function t)
  (setq matlab-verify-on-save-flag nil)
  (setq fill-column 70)
  (local-set-key "\C-cc" 'matlab-comment-region)
  (local-set-key "\C-cq" 'matlab-uncomment-region))
;;;
(add-hook 'matlab-mode-hook 'my-matlab-mode)
;;;

;;;
(defun my-info-stuff ()
  "My own Info stuff.  Currently sets faces and some variables."
  (set-face-foreground 'info-xref     "yellow")
  (set-face-background 'info-xref     "gray")
  (set-face-foreground 'info-node     "red")
  (set-face-background 'info-node     "gray")
  (setq automatic-footnotes "On"))

(add-hook 'Info-mode-hook 'my-info-stuff)
(setq auto-mode-alist
      (append '(("\\.txh$"  . texinfo-mode))
              auto-mode-alist))
;;;

;;;
(defun my-texinfo-stuff ()
  "My own Texinfo mode customizations."
  (set (make-local-variable 'dabbrev-case-fold-search) nil)
  (set (make-local-variable 'dabbrev-case-replace) nil)
  (define-key emacs-lisp-mode-map "\C-j" 'newline)
  (define-key emacs-lisp-mode-map "\C-m" 'newline-and-indent))

(add-hook 'texinfo-mode-hook 'my-texinfo-stuff)
(add-hook 'texinfo-mode-hook 'turn-on-font-lock)
(add-hook 'change-log-mode-hook 'turn-on-font-lock)
;;;

;;; Electric Buffer Menu mode customization.
(defun my-ebuf-stuff ()
  "My own Electric Buffer Menu stuff.  Currently binds some
convenience keys."
  (define-key electric-buffer-menu-mode-map [up] 'previous-line)
  (define-key electric-buffer-menu-mode-map [down] 'next-line)
  (define-key electric-buffer-menu-mode-map [next] 'scroll-up)
  (define-key electric-buffer-menu-mode-map [previous] 'scroll-down)
  (define-key electric-buffer-menu-mode-map [left] 'scroll-right)
  (define-key electric-buffer-menu-mode-map [right] 'scroll-left))

(add-hook 'electric-buffer-menu-mode-hook 'my-ebuf-stuff)
;;;

;;;This fontifies the compilation buffer when compilation exits.
(defun my-compilation-finish-function (buf msg)
  "This is called after the compilation exits.  Currently just
highlights the compilation messages."
  (save-excursion
    (set-buffer buf)
    (font-lock-fontify-buffer)))
;;;

;;;
(defun my-compilation-mode-stuff ()
  "My own compilation set up"
  (setq compilation-finish-function 'my-compilation-finish-function)
  (setq compilation-window-height 20)
  (setq compilation-ask-about-save t)
  (setq compilation-read-command t)
  (setq compile-auto-highlight t)
  (eetq compile-command "make"))
(add-hook 'compilation-mode-hook 'my-compilation-mode-stuff)
(add-hook 'compilation-mode-hook 'fm-start)
;;;


(add-hook 'dired-load-hook 'my-dired-load-stuff)

;;; This installs `dired-x.el' when `dired' is first invoked, and also
;;; replaces `find-file' with `dired-x-find-file'.
(add-hook 'dired-load-hook
          (function (lambda ()
	  (setq dired-x-hands-off-my-keys nil)
	  (load "dired-x")
	  ;; Set dired-x global variables here.  For example:
	  ;; (setq dired-guess-shell-gnutar "gtar")
	  ;(setq dired-local-variables-file "_dired")
	  (setq dired-no-confirm
		'(byte-compile chmod compress copy load move
			       print shell symlink uncompress)))))
;;;

;;}}}

;;; end - mode stuff (various different modes)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;


;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; key customizations (GLOBAL)

;;{{{ Key bindings and customizations...

;;;
(global-set-key "\M-z" (function (lambda () (interactive) (scroll-down 1))))
(global-set-key "\C-z" (function (lambda () (interactive) (scroll-up 1))))
(global-set-key "\C-l" (function (lambda () (interactive) (recenter 5))))
;;;

;;; PC Function Keys
(global-set-key [f1] 'delete-other-windows)
(global-set-key [f2] 'delete-window)
(global-set-key [f3] 'indent-region)
(global-set-key [f4] 'align)
(global-set-key [f5] 'select-all)
(global-set-key [f7] 'my-site-lisp-load)
(global-set-key [f8] 'my-load-DOTemacs)

(global-set-key [home] 'beginning-of-buffer)
(global-set-key [end] 'end-of-buffer)
(global-set-key [DEL] 'delete-char)
(global-set-key [delete] 'delete-char)

(global-unset-key [S-insert])
(global-set-key [S-insert] 'yank-and-indent)

(global-set-key [C-home] 'joc-top-of-page)
(global-set-key [C-end] 'joc-bottom-of-page)
(global-set-key [C-next] 'shrink-window)
(global-set-key [C-backspace] 'backward-kill-word)
(global-set-key [C-delete] 'kill-word)
(global-set-key [C-SPC] 'set-mark-command)
(global-set-key [C-minus] 'undo)

(global-set-key [M-home] 'previous-window)
(global-set-key [M-end] 'other-window)
(global-set-key [M-backspace] 'my-hungry-delete)
(global-set-key [M-kp-divide] 'dabbrev-expand)
;;;

;;; Misc keys
(global-unset-key "\C-y")
(global-set-key "\C-y" 'yank-and-indent)

(global-set-key "\C-x\C-s" 'save-buffer)
(global-set-key "\C-x]" 'my-expand-jump-to-next-slot)
(global-set-key "\C-x[" 'my-expand-jump-to-previous-slot)
(global-set-key "\C-t" 'my-toggle-source-header)
(global-set-key "\C-n" 'next-buffer)
(global-set-key "\C-cd" 'dup-line)
(global-set-key "\C-ci" 'ifdef:ifdef-region)
(global-set-key "\C-cn" 'ifdef:ifndef-region)
(global-set-key "\C-ce" 'ifdef:ifdef-else-region)
(global-set-key "\C-cs" 'my-split-different-windows)
(global-set-key "|" 'match-paren)
(global-set-key "\C-cq" 'my-uncomment-and-align)
(global-set-key "\C-cc" 'comment-out-region)
(global-set-key "\C-x\C-k" 'kill-this-buffer)
(global-set-key "\M-l" 'load-library)
(global-set-key "\C-x\C-l" 'goto-line)
(global-set-key "\C-o" 'other-window)
(global-set-key "\M-sr" 'query-replace-regexp)
(global-set-key "\C-b" 'electric-buffer-list)
(global-set-key "\C-xu" 'undo)
(global-set-key "\C-xg" 'goto-line)

(fset 'kill-whole-line [home ?\C-k ?\C-k])
(global-set-key [vertical-scroll-bar down-mouse-1] 'scroll-bar-drag)
;;;

;;; Dired-x installation and customization.
;;; This makes `dired-jump' and `dired-jump-other-window' work
;;; even *before* `dired' has been loaded.
(define-key global-map "\C-x\C-j" 'dired-jump)
;;;

;;; Recalling from search ring...allows user to scroll through search
;;; history.
(define-key minibuffer-local-isearch-map [up] 'isearch-ring-retreat-edit)
(define-key minibuffer-local-isearch-map [down] 'isearch-ring-advance-edit)
(define-key isearch-mode-map [up] 'isearch-ring-retreat)
(define-key isearch-mode-map [down] 'isearch-ring-advance)
;;;

;;; Paste in isearch minibuffer.
(define-key isearch-mode-map (quote [mouse-2]) 'isearch-yank-kill)
(define-key isearch-mode-map (quote [down-mouse-2]) nil)
;;;

;;}}}

;;; end - key customizations (GLOBAL)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;


;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; OLD STUFF -- I don't use but don't want to throw away

;;{{{ Old configurations that I no longer use...

;; (global-set-key "\C-x\C-b" 'electric-buffer-list)
;; (global-set-key "\M-i" 'indent-relative)
;; (global-set-key "\C-xy" 'insert-register)
;; (global-set-key "\M-*" 'query-replace-regexp)

;; (global-set-key "\M-[" 'my-align-entire)
;; (global-set-key "\C-x\C-a" 'my-align-entire)
;; (global-set-key "\C-x\C-a" 'align)

;; (global-set-key [M-right] 'end-of-line)
;; (global-set-key [M-left] 'beginning-of-line)
;; (global-set-key [C-end] 'joc-bottom-of-page)
;; (global-set-key [C-prior] 'enlarge-window)

;; (global-set-key [f2] 'split-window-vertically)
;; (global-set-key [f6] 'shell-toggle)
;; (global-set-key [f7] 'shell-toggle-cd)
;; (global-set-key [f8] 'insert-file)
;; (global-set-key [f9] 'compile)
;; (global-set-key [f10] 'my-header-file)
;; (global-set-key [f11] 'my-site-lisp-load)
;; (global-set-key [f12] 'my-load-DOTemacs)

;; (global-unset-key "\C-x\C-s")
;; (global-set-key "\C-x\C-s" 'my-save-buffer)
;; (define-key global-map [C-f1] 'ifdef:ifdef-region)
;; (define-key global-map [C-S-f2] 'ifdef:ifndef-region)
;; (define-key global-map [C-S-f3] 'ifdef:ifdef-else-region)
;; (define-key global-map [M-S-f4] 'ifdef:if-region)
;; (define-key global-map [M-S-f5] 'ifdef:if-else-region)
;; (global-set-key "\C-cq" (kbd "C-u C-c c")) ;; uncomment region
;; (global-set-key [C-backspace] 'kill-whole-line)
;; (global-set-key "\C-xt" 'shell-toggle)
;; (global-set-key "\C-i" 'iconify-or-deiconify-frame)
;; (global-set-key [end] 'end-of-line)
;; (global-set-key [home] 'beginning-of-line)
;; (global-set-key [f8] 'next-buffer)
;; (global-set-key [f4] 'kill-buffer)
;; (global-set-key [f2] 'save-buffer)
;; (global-set-key [end] 'end-of-line)
;; (global-set-key [home] 'beginning-of-line)
;; (global-set-key [f1] 'info)

;;; Control window size, position, and font.
;; (set-frame-height (selected-frame) 40)
;; (set-frame-width (selected-frame) 80)
;; (set-frame-position (selected-frame) 10 30)
;; (set-default-font "-*-courier-normal-r-*-*-13-*-*-*-c-*-*-iso8859-1")
;; (set-face-font 'italic "7X14")
;;;

;;;
;; (set-face-font 'italic
;;        "-schumacher-clean-medium-i-normal--12-120-75-75-c-60-iso8859-1")
;;;

;;; Start off in "C:/" dir... for use with pc-emacs
;; (cd "C:/")
;;;

;;; C-x C-e runs the command eval-last-sexp:

;;;This installs the `saveplace' package and defines where the places
;;;in visited files are saved between sessions.
;; (condition-case err
;;     (require 'saveplace)
;;   (error
;;    (message "Cannot save places %s" (cdr err))))
;; (setq-default save-place t)  
;; (setq save-place-file    "~/_places.sav")
;;;

;;; define extra C types to font-lock
;; (setq c-font-lock-extra-types
;;       (append
;;        '("CHAR" "BOOL" "BYTE" "SOCKET" "boolean" "UINT" "UINT16" "UINT32" "ULONG" "FLOAT" "INT" "INT16" "INT32" "uint" "ulong" "string" "BOOLEAN" "\\sw+_T")
;;        c-font-lock-extra-types))
;;;

;;; define extra C++ types to font-lock
;; (setq c++-font-lock-extra-types
;;       (append
;;        c-font-lock-extra-types
;;        c++-font-lock-extra-types))
;;;

;;; Hungry state
;; (add-hook 'c-mode-common-hook
;; 	  (function
;; 	   (lambda ()
;; 	     (c-toggle-hungry-state t))))
;;;



;;;;;;;;;;;WINDOWS 95/98/NT  STUFF  
;;; Start off in "C:/" dir... for use with pc-emacs
;; (cd "C:/")
;;;
;; (setq load-path (cons "C:/Javier/site-lisp" load-path))
;; (setq load-path (cons "C:/joviedo/emacs-20.7/site-lisp" load-path))
;; (setq load-path (cons "C:/joviedo/emacs-20.7/site-lisp/games" load-path))

;; (setq w32-enable-italics t)
;; (set-default-font "-*-Courier New-normal-r-*-*-12-90-96-96-c-*-iso8859-1")
;; (set-face-font 'italic "-*-Courier New-normal-i-*-*-11-*-*-*-c-*-iso8859-1")
;; (set-face-font 'bold-italic "-*-Courier New-bold-i-*-*-11-*-*-*-c-*-iso8859-1")
;; (set-default-font "-*-Courier New-normal-r-*-*-11-82-96-96-c-*-iso8859-1")

;;}}}

;;; end - OLD STUFF
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;


;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; NEW STUFF --- Still testing, or not tested yet.

;;{{{ New stuff that is still being tested, or that hasn't yet..

;; Emacs.pane.menubar.foreground: white
;; Emacs.pane.menubar.background: black
;; Emacs.pane.menubar.font: -b&h-lucida-medium-r-normal-*-*-100-*-*-p-*-iso8859-1
;; Emacs.pane.menubar.foreground: Black
;; Emacs.pane.menubar.background: bisque3
;; 
;; or something similar into your ~/.Xdefaults file.

;; (require 'emvaders)

;; Insert the following code in your .emacs file to create a Go To Line
;; item on Emacs Edit menu and bind goto-line to C-M-g.

;; Add go to line command to the Emacs Edit menu.
;; Author: Paul Kinnucan (paulk@pkinnucan.mediaone.net)
;; (if (not (string-match "XEmacs" emacs-version))
;;     (let* ((mb (assq 'menu-bar global-map))
;;            (edit-menu (assq 'edit mb)))
;;       (define-key-after (cdr (cdr edit-menu)) [goto-line]
;;         '("Go To Line..." . goto-line) 'spell)
;;       (global-set-key (read-kbd-macro "C-M-g") 'goto-line)))


;; The following little lump of lisp will ensure the first assignment operators
;; on each of the lines line up. This is part of our local formatting style
;; 'cos it looks nice ;-)
;; The style of the lisp however, is atrocious. All the problems come from ==,
;; which looks too much like 'op='.
;; Paul Hudson
;; (defun align-equals (start end)
;;   "Make the first assignment operator on each line line up vertically"
;;   (interactive "*r")
;;   (save-excursion
;;     (let ((indent 0))
;;       (narrow-to-region start end)
;;       (beginning-of-buffer)
;;       (while (not (eobp))
;;         (if (find-assignment)
;;             (progn
;;               (exchange-point-and-mark)
;;               (setq indent (max indent (current-column)))
;;               (delete-horizontal-space)
;;               (insert " ")))
;;         (forward-line 1))
;;       (beginning-of-buffer)
;;       (while (not (eobp))
;;         (if (find-assignment)
;;             (indent-to-column (1+ (- indent  (- (mark) (point))))))
;;         (forward-line 1)))
;;    (widen)))




;; (require 'func-menu)
;; (global-set-key [C-home] 'function-menu)

;; (if window-system 
;;       (require 'func-menu)
;;       (define-key global-map [S-down-mouse-3] 
;;         'function-menu))

;; One might think this would do it:
;; (defun insert-right-paren ()
;;   (interactive)
;;   (insert "()")
;;   (goto-char (1- (point))))
;; 
;; (defun insert-right-brace ()
;;   (interactive)
;;   (insert "{\n\n}")
;;   (goto-char (- (point) 2)))
;; 
;; (global-set-key [\(] 'insert-right-paren)
;; (global-set-key [{] 'insert-right-brace)

;; (define-key global-map "(" 'skeleton-pair-insert-maybe)
;; (define-key global-map "{" 'skeleton-pair-insert-maybe)
;; (define-key global-map "[" 'skeleton-pair-insert-maybe)
;; (define-key global-map "\"" 'skeleton-pair-insert-maybe)
;; (setq skeleton-pair t)

;; (load "complete")
;; (partial-completion-mode)

;;}}}

;;; end - NEW STUFF
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
All content copyright by the contributors. Website maintained with Emacs , wsmake and html-helper-mode
Emacs community logo by Daniel Lundin Last updated on Sat Jan 22 14:49:24 2005 by Ingo Koch