;;------------------------------------------------------------------- ;; Tabitha Tipper's Personal ;; .emacs file, settings for *all* machines. ;; ;; Per-machine settings are in ~/.emacs.d/emacs-modules.el for this method ;; of doing things ~/.emacs.d/emacs-modules.el ;; ;; Remember use "emacs -batch -f batch-byte-compile .emacs" to compile it. ;; ;; Mostly cannabalised from: http://home.in.tum.de/~baueran/emacs/emacs.conf ;; With parts from the default Redhat 7.3 Emacs config. ;;------------------------------------------------------------------- ;;--- If you want to have GNU and Lucid cooperating you need this: (defvar running-xemacs (string-match "XEmacs\\|Lucid" emacs-version)) ;; And to uncomment tehse ;(cond ((eq running-xemacs nil) (load "~/.emacs.d/emacs")) ; (load-file "~/.xemacs/init.el") ; ) ;;------------------------------------------------------------------- ;; Fix the load-path to include "~/.emacs.d" ;;------------------------------------------------------------------- ;; Make sure that the users .emacs.d is in their load-path ;; Note: 'nil' is current directory, then other dirs are loaded by just adding ;; then in quotes after the first. (setq load-path (append (list nil "~/.emacs.d") load-path) ) ;;------------------------------------------------------------------- ;; Display Options (Includes all Text & Graphical options) ;;------------------------------------------------------------------- ;; Because I know where to find the help file ;;(setq inhibit-startup-message t) ;; Start up the wheel mice code (cond (window-system (progn (mwheel-install) (tool-bar-mode 0) (blink-cursor-mode 0)))) ;; Scrollbar on the right hand side (cond ((and window-system (> emacs-major-version 19)) (set-scroll-bar-mode 'right) )) ;;(menu-bar-mode (if window-system 1 -1)) ; Switch off menubar if not GUI ;; (display-time) ; Mail/time in statusbar, Annoying for screen ;; (setq blink-cursor-mode nil) ; Distracting (setq column-number-mode t) ; Col and line showing (setq line-number-mode t) (setq indicate-empty-lines t) ; Like vim's tildes (setq size-indication-mode t) ; Show file size (setq tool-bar-mode nil) ; Toolbars suck (setq transient-mark-mode t) ; show selected regions (show-paren-mode) ; More reliable for some reason (which-function-mode) ; Which function are we in? (setq visible-bell t) ; Beeping software sucks (global-font-lock-mode t) ; Syntax hilighting ;;------------------------------------------------------------------- ;; Colour Setup example, try: color-theme.el ;;------------------------------------------------------------------- ;;(if (equal window-system 'x) ;; (progn ;; (add-to-list 'default-frame-alist '(foreground-color . "Black")) ;; (add-to-list 'default-frame-alist '(cursor-color . "Black")) ;; (add-to-list 'default-frame-alist '(background-color . "Ivory")))) ;;------------------------------------------------------------------- ;; General Behaviour Options ;;------------------------------------------------------------------- ;; No annoying backup files (setq make-backup-files nil backup-inhibited t) ;; See http://en.wikipedia.org/wiki/User:Marudubshinki/.emacs ;; Change backup behavior to save in a directory, not in a miscellany ;; of files all over the place. ;; ;;(setq ;; backup-by-copying t ; don't clobber symlinks ;; backup-directory-alist ;; '(("." . "~/.saves")) ; don't litter my fs tree ;; delete-old-versions t ;; kept-new-versions 6 ;; kept-old-versions 2 ;; version-control t) ; use versioned backups ;; Stop at the end of the file, not just add lines (setq next-line-add-newlines nil) ;; Text files supposedly end in new lines. Or they should. (setq require-final-newline t) ;; Don't insert new lines when scrolling (setq next-line-add-newlines nil) ;; Replace highlighted/marked areas ;;(delete-selection-mode t) ;; Scroll only one line at the end of the text (setq scroll-step 1) ;; See http://en.wikipedia.org/wiki/User:Marudubshinki/.emacs ;; Switch off the message buffer. Commet out for debugging. (setq message-log-max nil) (kill-buffer "*Messages*") ;; Provide a useful error trace if loading this .emacs fails. (setq debug-on-error t) ;; Don't echo passwords when dealing with interactive programs (add-hook 'comint-output-filter-functions 'comint-watch-for-password-prompt) ;; Keep relative column position when scrolling (setq scroll-preserve-screen-position t) ;; Push the mouse out of the way when the cursor approaches. (mouse-avoidance-mode 'exile) ;;(if (display-mouse-p) (mouse-avoidance-mode 'animate)) ;;(defconst mouse-avoidance-nudge-var 20) ;;(defconst mouse-avoidance-threshold 10) ;;(defconst mouse-avoidance-nudge-dist (* mouse-avoidance-threshold 3)) ;;------------------------------------------------------------------- ;; Modes: auto-mode setup as well as setup for specific modes ;;------------------------------------------------------------------- ;; Make sure that auto-fill-mode is a default minor mode for all text ;; related major modes. (add-hook 'text-mode-hook 'turn-on-auto-fill) ;; Antiword stuff. (defun no-word () "Run antiword on the entire buffer." (shell-command-on-region (point-min) (point-max) "antiword - " t t)) (add-to-list 'auto-mode-alist '("\\.doc\\'" . no-word)) ;; For kernel stuff ;;(defun linux-c-mode () ;; "C mode with adjusted defaults for use with the Linux kernel." ;; (interactive) ;; (c-mode) ;; (c-set-style "K&R") ;; (setq c-basic-offset 8)) ;; Indentation for all C modes and Java (setq c-basic-offset 4) (setq c-default-style "user") (add-hook 'java-mode-hook (lambda () (c-set-style "user"))) ;; set up HTML mode to do indenting (add-hook 'html-mode-hook (lambda () (setq indent-line-function 'indent-relative)) ) ;; Deals with compressed files automatically (auto-compression-mode 1) ;; Turn on auto-indenting ;;(require 'scheme) ;;(define-key scheme-mode-map (kbd "RET") 'newline-and-indent) (setq auto-mode-alist (mapcar 'purecopy '(;;("/usr/src/linux.*/.*\\.[ch]$" . linux-c-mode) ("\\.c$" . c-mode) ("\\.cpp$". c++-mode) ("\\.cxx$". c++-mode) ("\\.cc$". c++-mode) ("\\.C$". c++-mode) ("\\.h$" . c-mode) ("\\.hh$" . c++-mode) ("\\.hpp$". c++-mode) ("\\.bib$" . bibtex-mode) ("\\.tex$" . LaTeX-mode) ("\\.txi$" . Texinfo-mode) ("\\.el$" . emacs-lisp-mode) (".emacs$" . emacs-lisp-mode) ("\\.html$" . html-mode) ("\\.php$" . html-mode) ("\\.sgml$" . sgml-mode) ("\\.xml$" . xml-mode) ("\\.cl$" . lisp-mode) ("\\.lsp$" . lisp-mode) ("\\.lisp$" . lisp-mode) ("\\.txt$" . text-mode) ("\\.me$" . text-mode) ("\\.README$" . text-mode) (".*READ\\.ME$" . text-mode) ("\\.doc$" . text-mode) ("\\.csh$" . csh-mode) ("\\.sh$" . sh-mode) ("\\.java$" . java-mode) ("\\.pl$" . cperl-mode) ("\\/tmp/mutt*" . post-mode) ("\\.a$" . c-mode)))) ;;------------------------------------------------------------------- ;; Shortcuts and Keyboard Bindings ;;------------------------------------------------------------------- ;; Alt-G to jump to certain line number (global-set-key "\M-g" 'goto-line) ;; When writing programs and/or tex documents (global-set-key [f1] 'compile) ;; Because CMA+cokebottle+Shift+f12 is a bugger to rememeber. (global-set-key [M-s] 'query-replace-regexp) ;; This is hijacked from: http://www.geocities.com/kensanata/dot-emacs.html ;; Insertion of Dates. (defun insert-date-string () "Insert a nicely formated date string." (interactive) (insert (format-time-string "%Y-%m-%d")) ) ;; C-c i calls insert-date-string (global-set-key (kbd "C-c i") 'insert-date-string) ;; Only browse interesting buffers (global-set-key "\C-x\C-b" 'bs-show) ;;------------------------------------------------------------------- ;; Modules/Loading external configs (done last to overwrite .emacs) ;;------------------------------------------------------------------- ;; Shift where the custom config stuff goes. End of modules (setq custom-file "~/.emacs.d/emacs-modules.el") ;; If there is an ~/.emacs.d/emacs-modules file load it. (if (file-readable-p "~/.emacs.d/emacs-modules.el") (load "emacs-modules") 'emacs-modules-file-not-found )