; Rich's A-lame dot emacs file (A=anti :) -*- coding: utf-8 -*- ; Disable annoyances (fset 'yes-or-no-p 'y-or-n-p) (setq make-backup-files nil) (setq auto-save-default nil) (setq initial-scratch-message nil) (setq inhibit-splash-screen t) (setq sentence-end-double-space nil) (setq require-final-newline nil) (setq mode-require-final-newline nil) (menu-bar-mode 0) (when (fboundp 'tool-bar-mode) (tool-bar-mode 0)) (global-font-lock-mode 0) (setq default-truncate-lines t) ;(hscroll-global-mode 1) (setq dired-use-ls-dired nil) (set-display-table-slot standard-display-table 'vertical-border ?│) (put 'narrow-to-region 'disabled nil) ; Disable inherent vulns (setq enable-local-variables nil) (setq enable-local-eval nil) ; Line-by-line scrolling (setq scroll-step 1) ;(setq scroll-conservatively 100000000) ; Force unix and utf-8 (setq inhibit-eol-conversion t) (prefer-coding-system 'utf-8) (setq locale-coding-system 'utf-8) (set-terminal-coding-system 'utf-8) (set-keyboard-coding-system 'utf-8) (set-selection-coding-system 'utf-8) (setq file-name-coding-system 'utf-8) (setq coding-system-for-read 'utf-8-unix) ;(setq coding-system-for-write 'utf-8-unix) ; Fix broken bindings (global-set-key "\C-h" 'delete-backward-char) (define-key minibuffer-local-completion-map " " 'self-insert-command) (define-key minibuffer-local-must-match-map " " 'self-insert-command) ; Some extra convenience bindings (global-set-key "\r" 'newline-and-indent) (global-set-key "\C-m" 'newline-and-indent) (global-set-key "\C-j" 'newline) ;(global-set-key [insert] 'auto-fill-mode) ;(global-set-key [insertchar] 'auto-fill-mode) (global-set-key [f1] 'help) (global-set-key [f11] 'typopunct-mode) (global-set-key [f12] 'auto-fill-mode) ; Remove all the brain damage from Emacs' indention.... (defalias 'backward-delete-char-untabify 'backward-delete-char) (defun indent-according-to-mode () (interactive) (save-excursion (goto-char (- (line-beginning-position) 1)) (search-backward-regexp "^[ ]*") ) (if (eq (point) (line-beginning-position)) (insert (match-string 0)) (save-excursion (goto-char (line-beginning-position)) (insert (match-string 0)) ) ) ) (defun newline-and-indent () (interactive) (newline) (indent-according-to-mode)) (defun lisp-indent-line () (interactive) (insert " ")) ; Is there a way to fix this without a hook? (defun my-c-hook () (setq c-electric-flag nil) (defun c-indent-command (n) (interactive "*") (insert " "))) (add-hook 'c-mode-common-hook 'my-c-hook) (defun my-perl-hook () (defun perl-electric-terminator () (interactive "*") (self-insert-command 1)) (defun perl-indent-command () (interactive "*") (insert " "))) (add-hook 'perl-mode-hook 'my-perl-hook) (defun indent-for-tab-command () (interactive "*") (insert " ")) ; Setup mail-mode to behave nice with mutt (defun my-mail-modes-hook () (auto-fill-mode t) ) (add-hook 'mail-mode-hook 'my-mail-modes-hook) (setq auto-mode-alist (append auto-mode-alist '( ("mutt-[A-Za-z0-9-]+-[0-9]+-[0-9]+" . mail-mode) ) ) ) ; TeX mode settings (setq tex-dvi-print-command "dvips -Plj") (setq tex-dvi-view-command "xdvi") ; Override illegible default colors and make some colors nicer (if (>= emacs-major-version 23) (set-face-foreground 'minibuffer-prompt "unspecified")) (set-face-foreground 'mode-line "blue") (set-face-background 'mode-line "white") (set-face-inverse-video-p 'mode-line t) (set-face-foreground 'header-line "white") (set-face-background 'header-line "blue") (setq frame-background-mode "dark") ; Fix unwanted modes (defun dns-mode () (fundamental-mode)) (setq vc-handled-backends nil) ; Fixes to fill behavior for Tibetan text (if (>= emacs-major-version 23) (set-char-table-range fill-nospace-between-words-table '(?་ . ?་) t)) (defun fill-tibetan-nobreak-p () (looking-at "[་-༎]")) (add-hook 'fill-nobreak-predicate 'fill-tibetan-nobreak-p) ; Load other stuff (add-to-list 'load-path "~/.emacs.d/lisp") (setq typopunct-buffer-language 'english) ;(require 'typopunct) (defun vc-git-registered (file) nil)