;; user name (user-full-name "Jamie Wilkinson") ;; mouse wheel support (mwheel-install) ;; gnuserv support (gnuserv-start) ;; tramp remote file access (require 'tramp) ;; my elisp packages (add-to-list 'load-path "~/.xemacs") ;; set up cfengine-mode (autoload 'cfengine-mode "cfengine" "" t nil) (add-to-list 'auto-mode-alist '("cf\\." . cfengine-mode)) (add-to-list 'auto-mode-alist '("cf[^\/]*\\.conf$" . cfengine-mode)) (add-to-list 'auto-mode-alist '("update.conf$" . cfengine-mode)) ;; zonefile mode (autoload 'zonefile-mode "zonefile") (add-to-list 'auto-mode-alist '("/var/named/master" . zonefile-mode)) (add-to-list 'auto-mode-alist '("/var/named/slave" . zonefile-mode)) ;; set up flex-mode ;(autoload 'flex-mode "flex") ;(add-to-list 'auto-mode-alist '("\\.l$" . flex-mode)) ;; set up bison-mode ;(autoload 'bison-mode "bison") ;(add-to-list 'auto-mode-alist '("\\.y$" . bison-mode)) ;; set up filtergen-mode (autoload 'filtergen-mode "filtergen") (add-to-list 'auto-mode-alist '("rules.filter" . filtergen-mode)) ;; set up graphviz mode (autoload 'graphviz-mode "graphviz") (add-to-list 'auto-mode-alist '("\\.dot$" . graphviz-mode)) ;; set up nagios mode (autoload 'nagios-mode "nagios") (add-to-list 'auto-mode-alist '("nagios/.*\.cfg" . nagios-mode)) ;; scons files (add-to-list 'auto-mode-alist '("SConstruct" . python-mode)) (add-to-list 'auto-mode-alist '("SConscript" . python-mode)) ;; indentation (setq tab-width 4) (setq haskell-indent-offset 4) (setq indent-tabs-mode nil) (setq bison-rule-separator-column 4) (setq bison-rule-enumeration-column 6) (setq bison-decl-type-column 7) (setq bison-decl-token-column 16) (setq cfengine-indent 4) (setq c-basic-offset 4) ;; python-mode fixes (defun python-mode-fix () (setq py-smart-indentation nil py-indent-offset 4 tab-width 4 indent-tabs-mode t) ) (add-hook 'python-mode-hook 'python-mode-fix) ;; warn about trailing whitespace ;(mapc (lambda (hook) ; (add-hook hook (lambda () ; (setq show-trailing-whitespace t)))) ; '(text-mode-hook ; c-mode-hook ; emacs-lisp-mode-hook ; java-mode-hook ; python-mode-hook ; shell-script-mode-hook)) ;; fill column for cvs commit messages (add-hook 'cvs-edit-hook '(lambda () (setq fill-column 60))) ;; compile button (setq compile-command "make") (global-set-key [f7] `toolbar-compile) ;; turn on auto-fill for text files (add-hook 'text-mode-hook 'turn-on-auto-fill) ;; cc-mode tweaks (defun my-c-setup () (c-set-offset 'case-label '*) (c-set-offset 'statement-case-intro '*) (define-key c-mode-base-map "\C-m" 'newline-and-indent) ;(c-toggle-hungry-state 1) ) (add-hook 'c-mode-common-hook 'my-c-setup) ;; If we're in a SCons build tree, set the compile-command correctly ;; The cond can be extended for other build system files, too (add-hook 'c-mode-common-hook (lambda () (cond ((or (file-exists-p "SConstruct") (file-exists-p "SConscript")) (set (make-local-variable 'compile-command) "scons -D"))))) ;; Some literal character functions from http://list-archive.xemacs.org/xemacs/199810/msg00032.html ;;; literal character ;;; literal character (defun insert-literal-char (arg) "Insert a character into a buffer by specifying its ascii code" (interactive "nEnter decimal value of chracter to insert: ") (insert (format "%c" arg)) ) ;;; literal tab (defun insert-literal-tab () (interactive) (insert-literal-char 9) ) ;;; literal form feed (defun insert-literal-form-feed () (interactive) (insert-literal-char 12) ) ;; bind the functions to keys ;(global-set-key [(iso-left-tab)] 'insert-literal-tab) (global-set-key "\C-z" 'insert-literal-form-feed) ;; font lock is pretty (turn-on-font-lock) ;; wanderlust as mailer (autoload 'wl-user-agent-compose "wl-draft" nil t) (if (boundp 'mail-user-agent) (setq mail-user-agent 'wl-user-agent)) (if (fboundp 'define-mail-user-agent) (define-mail-user-agent 'wl-user-agent 'wl-user-agent-compose 'wl-draft-send 'wl-draft-kill 'mail-send-hook)) ;; and finally, desktop mode (load "desktop") (desktop-load-default) (desktop-read)