; -*-Lisp-*- ; $Id: emacs,v 1.21 2004/02/09 11:00:21 dave Exp $ (add-to-list 'load-path "~/elisp") ;(load-library "php-mode-102") (cond ((string-match "GNU" (emacs-version)) (message "customizing GNU Emacs") ; emacs (setq custom-file "~/.gnuemacs-custom") ) ((string-match "XEmacs" (emacs-version)) (message "customizing XEmacs") ; xemacs (setq custom-file "~/.xemacs-custom") ) ) (if window-system (setq using-gui t) (setq using-gui nil) ) (load-file custom-file) ;; XSL mode (autoload 'xsl-mode "xslide" "Major mode for XSL stylesheets." t) (setq auto-mode-alist (append (list ;; perl tests '("\\.t\\'" . cperl-mode) ;; os x term files '("\\.term\\'" . sgml-mode) ;; xsl '("\\.xsl\\'" . xsl-mode) '("\\.entry\\'" . sgml-mode) ;; css works okay in c-mode '("\\.css\\'" . c-mode) ) auto-mode-alist)) ;;; emacs server and clients ;(require 'gnuserv) ;(gnuserv-start) ;;; tab complete etc buffers (iswitchb-default-keybindings) (setq iswitchb-buffer-ignore '("^ " "*Buffer")) (setq default-directory "~/") (setq-default indent-tabs-mode nil) (setq inhibit-startup-message t) (setq frame-title-format "%b %f") (put 'narrow-to-region 'disabled nil) (show-paren-mode) (transient-mark-mode t) ;;; beeps are annoying with headphones (setq visible-bell t) ;;; no menu unless we're on a mac (if (not (eq window-system 'mac)) (menu-bar-mode nil) ) (if (eq window-system 'mac) (cond (window-system (setq default-frame-alist (append '((font . "-*-Monaco-*-100-*")) default-frame-alist)) )) ) ;;; yes = y , no = n :) (fset 'yes-or-no-p 'y-or-n-p) ; GNU only (global-font-lock-mode 1) ;; delete -> delete forwards (normal-erase-is-backspace-mode 1) ;;; key bindings ; (global-set-key "\C-z" 'undo) (global-set-key "\M-g" 'goto-line) (global-set-key [(control tab)] 'bury-buffer) ; mousewheel - doesn't work under xemacs (global-set-key [mouse-4] 'scroll-down) (global-set-key [mouse-5] 'scroll-up) (setq backup-directory "~/.emacs.backup") ;;; colour themes are lovely (require 'color-theme) ;; and here's mine (load-file "~/elisp/color-theme-e101.elc") (if using-gui (color-theme-e101) (color-theme-ld-dark) ) (defun color-theme-random () "Use a random color theme" (interactive) (random t) (setq the-theme (car (nth (random (length color-themes)) color-themes))) (funcall the-theme) (message "Using color-theme %s" the-theme)) ;;; a pretty modeline ; show 24 hr clock, day, date in modeline (setq supress-day-of-week nil) (setq display-time-24hr-format t) (setq display-time-day-and-date t) (display-time) ; show line and column numbers too (setq-default line-number-mode t column-number-mode t) (setq minibuffer-prompt-properties (append minibuffer-prompt-properties (list 'face 'minibuffer-prompt))) ;;; my not-too bright random function/variable help thing (require 'randomhelp) ;(display-random-help) ;;; autoheaders (require 'auto-header) (setq header-field-list '(filename description author created modified_by modified)) (define-key global-map "\C-x\C-hp" 'header-make-perl-shebang) (defun header-make-perl-shebang () (interactive) (beginning-of-buffer) (insert "#!/usr/bin/perl -w\n\nuse strict;\n") ) (define-key global-map "\C-x\C-hs" 'shift-self) (defun shift-self () (interactive) (insert "my $self = shift;\n") ) (defconst header-function-my-short '("Function: " funcname "\n" "Description: " mark "\n") "Example of a short function-header style.") (setq header-function-hdrstyle header-function-my-short) ;; cperl stuff ; switch it on for perl (defun modify-alist (alist-symbol key value &optional search-cdr) (let ((alist (symbol-value alist-symbol))) (while alist (if (eq (if search-cdr (cdr (car alist)) (car (car alist))) key) (setcdr (car alist) value) (setq alist (cdr alist)))))) (modify-alist 'interpreter-mode-alist 'perl-mode 'cperl-mode t) (modify-alist 'auto-mode-alist 'perl-mode 'cperl-mode t) (setq cperl-indent-level 4) (setq cperl-brace-offset 0) (setq cperl-continued-brace-offset -4) (setq cperl-label-offset -4) (setq cperl-merge-trailing-else t) (setq cperl-continued-statement-offset 4) (setq cperl-font-lock t) ; enable this to get rid of those silly underscores ;(setq cperl-invalid-face nil) (setq cperl-extra-perl-args "-w") (add-hook 'cperl-mode-hook (lambda nil (add-hook 'find-file-hook (lambda nil (imenu-add-menubar-index) ))))