;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; ;; File: steve.emacs.el aka .emacs ;; ;; Purpose: I always misplace, lose, or forget to take my .emacs file with ;; me because it is so hidden. This file has all of my emacs ;; customizations, but it is visible, and I can keep it in ;; "~/Emacs" where I will not forget to take it with me. ;; "~Emacs" holds everything having to do with my emacs ;; customizations. ;; ;; ;; Usage: hook this file up to .emacs by placing the following in .emacs: ;; (add-to-list 'load-path "~/Emacs/") ;; (load "steve.emacs.el") ;; ;; ;; ;; Notes: .emacs is a hidden nix file that provides various settings and ;; tweaks for the emacs ide. It is usually located in your home ;; directory. ;; ;; For the changes in this file to take effect you can do either of ;; the following: ;; ;; 1. Restart emacs ;; ;; 2. ESC x load-file .emacs ;; ;; '~' means to start the path from my home directory ;; ;; ;; ;; Author: Steve Russell 07/2002 ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; Make "emacs -nw" "emacs" in the shell ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; One way this can be done is to make aliases in your .bashrc file: ;; ;; alias emacs="emacs -nw" ;; alias gemacs="/usr/local/bin/emacs" ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; Mode Line ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; DISPLAY THE TIME (setq display-time-day-and-date t) (display-time) ;; DISPLAY THE CURRENT LINE NUMBER (line-number-mode 1) ;; DISPLAY THE CURRENT COLUMN NUMBER (column-number-mode 1) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; MISC Preferences ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; MAKE TEXT FILL THE DEFAULT MODE (setq default-major-mode 'text-mode) (setq text-mode-hook 'turn-on-auto-fill) ;; Get Rid Of Confirmation Prompts For These Commands (put 'narrow-to-region 'disabled nil) ;; narrowing (put 'downcase-region 'disabled nil) ;; text to lower case (put 'downcase-region 'disabled nil) ;; text to upper case ;; Turn on syntax highlighting (global-font-lock-mode t ) ;; Parenthesis matching (show-paren-mode t) ;; Highlight selected regions (transient-mark-mode t) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; Custom Key Bindings ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; ;; To make the process of binding keys interactively eaiser, use the ;; following "trick": First bind the key interactively, then immediately ;; type `C-x C-a C-k C-g'. Now, the command needed to bind ;; the key is in the kill ring, and can be yanked into your `.emacs' file. ;; ;; The function quoted-insert will echo the code for the key you type. ;; Type C-q yourkey to see the code of your key ;; ;; The function help-for help -l will echo up to the last 100 keystrokes ;; you typed, but expresses the code in a different way. ;; ;; These are useful for when you can't figure what the *&^% code for a key ;; is. ;; ;; Note. Not all terminals support all key combinations. The above ;; techniques will help you figure this out. For example, keybindings ;; with C- and arrow/function keys will not work on some terminals. ;; The terminal will send the same code a C- and arrow ( ie ) ;; pressed together as if only the key was pressed. You can ;; see if this is the situation using the 2 functions above. If the ;; codes for two differnt keystrokes match ( ie C- & ) ;; are the same bindings for C- will not work. ;; ;; If you know your terminal type ( "echo $TERM" at a prompt ) you can ;; go to the lisp/term subdirectory in your gnu emacs install directory ;; to find a file by the same name as your terminal type. Read the ;; README file in that directory. You can then open the appropiate ;; term file and add a line like the following to get your terminal ;; to send codes for keystrokes it doesn't know. ie: ;; ;; (define-key function-key-map (kbd "") (kbd "C-")) ;; ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; Make a key and function to directly to the Emacs Manual (define-key help-map "r" 'info-emacs-manual) (defun info-emacs-manual () (interactive) (info "emacs")) ;; Make C-z 'undo instead of suspend-emacs (global-set-key[?\C-z] 'undo) ;; MAKE esc c THE COMPILE COMMAND ;;(define-key esc-map "c" 'compile) ;; In case of funky command shells ;; make the Backspace key backspace and the Delete key delete ;; set "help" at C-x-h ;; (if (eq window-system 'nil) ;; ;; adjust backspace key ;; ;;(global-set-key [?\C-h] 'delete-backward-char) ;; ;; put "help" on C-x-h ;; ;;(global-set-key [?\C-x h] 'help) ;; ;; adjust delete key ;; ;;(global-set-key [?\C-d] 'delete-char)) ;; Move help from C-h to C-x h ;;(global-set-key [?\C-x?h] 'help-for-help) ;; Make delete, delete by swapping DEL and C-d ;;(keyboard-translate ?\C-? ?\C-d) ;; Make C-f use isearch-forwa ;;(global-set-key[?\C-f] 'isearch-forward) ;;(define-key isearch-mode-map (kbd "C-f") 'isearch-repeat-forward) ;; MAKE USE OUT OF THOSE FUNCTION KEYS (global-set-key [f1] 'help-for-help) ;; go directly to help (global-set-key [f2] 'split-window) ;; horizontally (global-set-key [f3] 'delete-other-windows) ;; that the cursor is not in (global-set-key [f4] 'query-replace-regexp) (global-set-key [f5] 'save-buffer) (global-set-key [f6] 'find-file) (global-set-key [f7] 'buffer-menu) (global-set-key [f8] 'enlarge-window-horizontally) (global-set-key [f9] 'shrink-window-horizontally) (global-set-key [f10] 'tmm-menubar) ;; use menus in the shell (global-set-key [f11] 'CUA-cmd-begin-rectangle) (global-set-key [f12] 'other-window) ;; move to the next window ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; Custom Functions ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ( defun count-words-buffer () "Count The Words In The Buffer" (interactive ) (save-excursion ( let ( (count 0 ) ) ( goto-char (point-min ) ) ( while ( < (point)(point-max) ) (forward-word 1) ( setq count (1+ count) ) ) (message "buffer has %d words" count) ) )) (defun trim-cr () "Remove trailing ^M in buffer" (interactive) (top-replace-regexp "\015$" " " nil) ) (defun top-replace-regexp (from-string to-string delimited) "starting at top of buffer, do replace-regexp" (interactive (query-replace-read-args "Replace regexp" t)) (goto-char (point-min)) (replace-regexp from-string to-string delimited) ) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; Load Extensions ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; If emacs is not being run in a commad shell load GUI stuff (if window-system (load-file "~/Emacs/gui.emacs.el")) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; END OF FILE steve.emacs ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;