;;; -*- Mode: Emacs-Lisp -*- ;;;; Taylor R. Campbell's Emacs Initialization Code ;;; This code is written by Taylor R. Campbell and placed in the Public ;;; Domain. All warranties are disclaimed. (load "~/.emacs-site") ; Load site specifics. (global-set-key (kbd "C-x C-c") nil) (transient-mark-mode 1) ;;; Turn off various annoying UI elements, but be careful to do it in ;;; such a way that they don't end up getting loaded just to disable ;;; them, which slows startup time. (if (featurep 'tool-bar) (tool-bar-mode -1)) (if (and (eq window-system 'x) (featurep 'scroll-bar)) (scroll-bar-mode -1)) (if (featurep 'tooltip) (tooltip-mode -1)) (defun save-scratch-buffer-p () (or (not (eq (current-buffer) (get-buffer "*scratch*"))) (yes-or-no-p "Kill scratch buffer? "))) (add-hook 'kill-buffer-query-functions 'save-scratch-buffer-p) ;;; Path setup (add-to-list 'load-path trc-elisp-directory) (defun add-to-load-path (filename) (add-to-list 'load-path (concat trc-elisp-directory "/" filename))) ;;; lisppaste (does this still work?) (autoload 'lisppaste "lisppaste" "Begin a lisppaste." t) ;;; Circe IRC client (add-to-load-path "circe") (autoload 'circe "circe" "Connect to an IRC server" t) ;;; Auto-fill in text modes (add-hook 'text-mode-hook 'turn-on-auto-fill) (defun boil-kettle (&optional minutes) "Present a message after several minutes for a kettle to boil. By default, present the message after two minutes. With a prefix argument, present the message after the specified number of minutes." (interactive "p") (let ((minutes (or minutes 2))) (message "Kettle will boil in %d minutes." minutes) (run-at-time (* 60 minutes) nil ;Do not repeat. (lambda () (message "Kettle has boiled!") (ding))))) ;;;; Support for Miscellaneous Other Languages ;;; ML (add-to-load-path "tuareg-mode") (setq auto-mode-alist (cons '("\\.ml[iylp]?$" . tuareg-mode) auto-mode-alist)) (autoload 'tuareg-mode "tuareg" "Major mode for editing Caml code." t) (autoload 'tuareg-run-caml "tuareg" "Inferior Caml process." t) (autoload 'camldebug "camldebug" "Caml debugger." t) (add-to-load-path "sml-mode") (setq auto-mode-alist (append '(("\\.sml$" . sml-mode) ("\\.sig$" . sml-mode) ("\\.fun$" . sml-mode)) auto-mode-alist)) (autoload 'sml-mode "sml-mode" "Major mode for editing SML." t) (autoload 'run-sml "sml-proc" "Run an inferior SML process." t) ;;; Haskell (load "haskell-mode/haskell-site-file") ;;; Erlang (autoload 'erlang-mode "erlang" "Major mode for Erlang code." t) (autoload 'run-erlang "erlang" "Run a new Erlang shell." t) (setq auto-mode-alist (cons '("\\.[eh]rl$" . erlang-mode) auto-mode-alist)) (add-hook 'erlang-mode-hook (lambda () ;; For some reason, erlang.el sets this to 48 (setq comment-column 40))) ;;; Dylan (add-to-load-path "dylan") (autoload 'dylan-mode "dylan-mode" "Major mode for Dylan source" t) (setq auto-mode-alist (cons '("\\.dylan$" . dylan-mode) auto-mode-alist)) ;;; Prolog ;; Die, Perl! (setq auto-mode-alist (cons '("\\.pl$" . prolog-mode) auto-mode-alist)) ;;; Mozart/Oz (add-to-load-path "mozart-oz") (setq auto-mode-alist (append '(("\\.oz$" . oz-mode) ("\\.ozg$" . oz-gump-mode)) auto-mode-alist)) (mapc (lambda (fname) (autoload fname "oz" "" t)) '(run-oz oz-mode oz-gump-mode oz-new-buffer)) ;;; E (add-to-load-path "e") (autoload 'run-e "e" "Run an inferior E process." t) (autoload 'e-mode "e-mode" "Major mode for editing E files." t) ;;;; Custom (custom-set-variables ;; custom-set-variables was added by Custom. ;; If you edit it by hand, you could mess it up, so be careful. ;; Your init file should contain only one such instance. ;; If there is more than one, they won't work right. '(blink-cursor-mode t nil (frame)) '(eshell-prompt-function (lambda nil (concat (file-name-nondirectory (eshell/pwd)) (if (= (user-uid) 0) " # " " $ ")))) '(fill-column 71) '(global-font-lock-mode t nil (font-lock)) '(indent-tabs-mode nil) '(inhibit-splash-screen t) '(inhibit-startup-message t) '(next-line-add-newlines nil) '(scheme48-keywords (quote ((dynamic-wind 0 nil) (destructure 1 nil) (enum-case 2 nil) (environment-define! 2 no-font-lock) (environment-set! 2 no-font-lock) (guard 1 nil) (iterate 3 nil) (make-usual-resumer 2 no-font-lock) (mvlet 1 nil) (mvlet* 1 nil) (search-tree-modify! 2 no-font-lock) (usual-resumer 0 no-font-lock) (with-exception-handler 1 nil) (with-handler 1 nil) (with-interaction-environment 1 nil) (with-nondeterminism 0 nil) (call-with-current-input-port 1 nil) (call-with-current-noise-port 1 nil) (call-with-current-output-port 1 nil) (call-with-string-output-port 0 nil) (limit-output 2 no-font-lock) (recurring-write 2 no-font-lock) (silently 0 nil) (with-current-ports 3 nil) (define-interface 1 nil) (define-structure 2 nil) (structure 1 nil) (structures 1 nil) (export 0 nil) (atomically 0 nil) (atomically! 0 nil) (call-ensuring-atomicity 0 nil) (call-ensuring-atomicity! 0 nil) (ensure-atomicity 0 nil) (ensure-atomicity! 0 nil) (interrupt-thread 1 no-font-lock) (let-fluid 2 nil) (let-fluids defun nil) (spawn-on-scheduler 1 no-font-lock) (with-new-proposal 1 nil) (with-current-input-port 2 nil) (with-current-output-port 2 nil) (awk 3 nil) (close-after 2 no-font-lock) (if-match 2 nil) (with-cwd 1 nil) (with-cwd* 1 nil) (let-optionals scheme-let-indent nil) (let-optionals* scheme-let-indent nil) (and-let* 1 nil) (let-values 1 nil) (let*-values 1 nil)))) '(show-paren-delay 0.0) '(texinfo-mode-hook (quote (turn-on-auto-fill))) '(truncate-partial-width-windows nil) '(version-control t) '(visible-bell t)) (custom-set-faces ;; custom-set-faces was added by Custom. ;; If you edit it by hand, you could mess it up, so be careful. ;; Your init file should contain only one such instance. ;; If there is more than one, they won't work right. '(font-lock-string-face ((((class color) (background light)) (:foreground "CadetBlue")))) '(font-lock-variable-name-face ((((class color) (background light)) (:foreground "MidnightBlue"))))) ;;;; Lisp Section ;;; Lisp-related initialization code is in a separate file (but it ;;; must be loaded after the custom variables are set; at least, ;;; SHOW-PAREN-DELAY must be set before SHOW-PAREN-MODE is enabled). (load "~/.emacs-lisp")