Defindit Docs and Howto Home

This page last modified: Dec 05 2007
; Tom Laudeman's .emacs file.

;; Non-nil inhibits the startup screen.
;; It also inhibits display of the initial message in the `*scratch*' buffer.
(setq inhibit-splash-screen t)

;; Paste (yank) at the text cursor location, not at the 
;; location of the mouse pointer. This only applies to graphical (X)
;; emacs sessions. 
(setq mouse-yank-at-point t)


;; Disable the nasty zmacs region highlighting in xemacs. Having it on
;; breaks mark-search-cut behavior. 
(setq zmacs-regions nil)

;; Uncomment to automatically load ispell at startup.
;(load "ispell")

;; Uncomment for hexl 
;(autoload 'hexl-find-file "hexl" "Edit file FILENAME in hexl-mode." t)
;(define-key global-map "\C-c\C-h" 'hexl-find-file)

;; disable color crap
;; (setq-default global-font-lock-mode nil)

;; Uncomment if you like lots of backup versions
;(setq version-control t)

(setq inhibit-eol-conversion t)

;; Prevent loading default.el. 
(setq inhibit-default-init 1)

;; valid values for require-final-newline
;; nil
;; t
;; (quote query)
(setq require-final-newline nil)

;; No need to do the uppercase and lowercase versions of keystrokes since
;; that is the default. C-xf also matches C-xF

;; unset undo because I hit \C-? which turns out to be 
;; identical to \C-_ 
;; Even though \C-/ won't (apparently) do anything in -nw mode,
;; unset it anyway so I don't hit it in windowing mode.
(global-unset-key "\C-_" )
(global-unset-key (kbd "C-/") )

;; I hate to additionally map yank (paste) to C-v, but it is
;; necessary. This key is too much a standard across all non-Emacs
;; platforms. Besides, I've always hated scroll-up because scroll-up
;; followed by scroll-down doesn't leave the cursor at the original
;; location.
;;(define-key global-map "\C-v" 'yank)
;; Map this to something safe until I get used to not using it to page down.
(define-key global-map "\C-v" 'forward-char)

(define-key global-map "\C-[#" 'comment-region)
(define-key global-map "\C-x#" 'comment-region)
(define-key global-map "\C-s" 'search-forward)
(define-key global-map "\C-r" 'search-backward)
(define-key global-map "\C-x\C-n" 'next-error)
(define-key global-map "\C-xc" 'compile)
(define-key global-map "\C-h" 'backward-delete-char)
(define-key global-map "\C-[g" 'goto-line)
(define-key global-map "\C-xn" 'other-window)
(define-key global-map "\C-[q" 'query-replace)
(define-key global-map "\C-xf" 'find-file)
(define-key global-map "\C-[\C-[" 'repeat-complex-command)
(define-key global-map "\C-[r" 'replace-string)
(define-key global-map "\C-[f" 'fill-paragraph)
(define-key global-map "\C-z" 'keyboard-quit) ;; something safe



;; Stupid xemacs can't grok "\C-[\C-[" so re-purpose C-x[
;; It normally means page up, but I always use ESC-v for page up.
(global-set-key "\C-x\[" 'repeat-complex-command)

;; Use a new function for page up and page down.
;; This one will place the cursor on the line where you started if
;; you do the opposite. The default Emacs scroll-up and scroll-down
;; don't return the cursor to the same line. That's bad.
;; This still doesn't work quite right if you hit the top or bottom of the buffer.
;; That could be fixed by remembering how far the last scroll was, and
;; reversing when necessary. 
(define-key global-map "\C-[a" 'backward-screen)
(define-key global-map "\C-[z" 'forward-screen)
(define-key global-map [(prior)]   'backward-screen)
(define-key global-map [(next)]   'forward-screen)

;; Not used. Changed. I needed some other key combination
;; for page up and page down.
;; alt-z and alt-a for left handed scrolling.
;;(global-set-key "\C-[z" 'up-one)
;;(global-set-key "\C-[a" 'down-one)

;; alt-n and alt-p for two handed scrolling.
(global-set-key "\C-[p" 'down-one)
(global-set-key "\C-[n" 'up-one)

;; Remap the danged downcase-region keys
;; because I'm always hitting these instead of C-l
;; C-xl might be ok. Consider commenting it out, even 
;; though l is for "lower" which isn't the command. It should
;; be d for "downcase". 
(define-key global-map "\C-[l" 'recenter)
(define-key global-map "\C-x\C-l" 'recenter)

;; Use new kdb syntax available as of 19.30
;; http://tiny-tools.sourceforge.net/emacs-keys.html

;; None of these work in -nw
;(define-key global-map (kbd "C-S-N") 'up-one)
;(define-key global-map (kbd "C-S-P") 'down-one)
;(global-set-key [(control shift n)] 'up-one)
;; (list ?C-S-n (type-of ?C-S-n)) 
;; (list ?C-n (type-of ?C-n)) 
;;(define-key global-map (kbd "C-N") 'up-one)
;;(define-key global-map (kbd "C-P") 'down-one)

(defun forward-screen ()
  "scroll down one screen in display."
  (interactive)
  (forward-line (- (window-height) 2)))

(defun backward-screen ()
  "scroll down one screen in display."
  (interactive)
  (forward-line (- (- (window-height) 2))))

(defun c-fill-paragraph ()
  "overloaded with query-replace"
  (interactive)
  (print "try esc-Q" ))

(defun lisp-fill-paragraph ()
  "overloaded with query-replace"
  (interactive)
  (print "try esc-Q"))

(defun up-one ()
  "scroll up one line in display."
  (interactive)
  (scroll-up 1)
  (forward-line 1))

(defun down-one ()
  "scroll down one line in display."
  (interactive)
  (scroll-down 1)
  (forward-line -1))

(setq auto-mode-alist (cons (cons "\\.java$" 'c-mode) auto-mode-alist))
(setq auto-mode-alist (cons (cons "\\.cgi$" 'perl-mode) auto-mode-alist))

;;; This is an example of keyboard rebinding on the Macintosh.
;;; I've preserved this for historical interest only.
;;; It makes these assignments:
;;;   F5 splits the display vertically
;;;   F6 enlarges the window containing the cursor
;;;   F7 shrinks the window containing the cursor
;;;   F8 eliminates all split windows
;;; See the file ~/lisp/mac/Macintosh-win.el for the codes to define other keys.

(setq mac-raw-map-hooks
	  (list
	   '(define-key mac-raw-map "\040" 'split-window-vertically)
	   '(define-key mac-raw-map "\041" 'enlarge-window)
	   '(define-key mac-raw-map "\042" 'shrink-window)
	   '(define-key mac-raw-map "\044" 'delete-other-windows)))


(put 'downcase-region 'disabled nil)
(put 'upcase-region 'disabled nil)

(assq-delete-all 'font default-frame-alist)
(add-to-list
  'default-frame-alist
  '(font . "-Adobe-Courier-Medium-R-Normal--14-140-75-75-M-90-ISO8859-1"))