;; ------------------------------------------------ ;; Custom .emacs file ;; ------------------------------------------------ ;; Load Gentoo site files (load "/usr/share/emacs/site-lisp/site-gentoo") (require 'site-gentoo) ;; ------------------------------------------------ ;; Ebuild mode (defun ebuild-mode () (shell-script-mode) (sh-set-shell "bash") (make-local-variable 'tab-width) (setq tab-width 4) ) (setq auto-mode-alist (cons '("\\.ebuild\\'" . ebuild-mode) auto-mode-alist)) (setq auto-mode-alist (cons '("\\.eclass\\'" . ebuild-mode) auto-mode-alist)) ;; ------------------------------------------------ ;; ------------------------------------------------ ;; show bracket matching (require 'paren) (show-paren-mode t) ;; ------------------------------------------------ ;; ------------------------------------------------ ;; match parenthesis (defun match-paren (arg) "Go to the matching parenthesis if on parenthesis otherwise insert %." (interactive "p") (cond ((looking-at "\\s\(") (forward-list 1) (backward-char 1)) ((looking-at "\\s\)") (forward-char 1) (backward-list 1)) (t (self-insert-command (or arg 1))) ) ) (global-set-key "%" 'match-paren) ;; ------------------------------------------------ ;; ------------------------------------------------ (defun indent-buffer () (interactive) (save-excursion (indent-region (point-min) (point-max) nil)) ) (global-set-key [f2] 'indent-buffer) ;; ------------------------------------------------ (load "~/next-buffer.el") (global-set-key "\M-g" 'goto-line) (global-set-key "\C-x\C-b" 'bs-show) ;; ------------------------------------------------ ;; Disable any auto saves (auto-save-mode -1) (setq-default make-backup-files nil) (setq-default auto-save-default nil) (setq-default auto-save-interval -1) ;; ------------------------------------------------ (setq-default truncate-lines t) ;; highlight selected regions (transient-mark-mode t) ;; turn on Syntax Highlighting (if (fboundp 'global-font-lock-mode) (global-font-lock-mode 1) ; GNU Emacs (setq font-lock-auto-fontify t)) ; XEmacs ;;(global-font-lock-mode) ;; we like pretty colours for syntax highlighting (setq font-lock-support-mode 'jit-lock-mode) (setq font-lock-maximum-decoration t) ;;(setq-default font-lock-maximum-decoration t) ;; Display the column number of the point in the mode line (column-number-mode t) (line-number-mode t) ;; use spaces instead of tabs (setq-default indent-tabs-mode nil) (when (fboundp 'scroll-bar-mode) ;; disable scroll bar in XEmacs (scroll-bar-mode -1) ;; disable tool bara in XEmacs (tool-bar-mode -1) ) ;; Disable the menu bar (menu-bar-mode -1) (set-foreground-color "white") (set-background-color "black") ;; Ensure title include Emacs: filename (setq frame-title-format "Emacs: %f") (setq icon-title-format "Emacs: %b") ;; ------------------------------------ ;; Turn on sgml highlighting ;; from http://www.emacswiki.org/cgi-bin/wiki/PsgmlMode (setq sgml-set-face t) (setq sgml-auto-activate-dtd t) (setq sgml-indent-data t) (setq sgml-markup-faces '( (start-tag . font-lock-keyword-face) (end-tag . font-lock-keyword-face) (comment . font-lock-comment-face) (pi . font-lock-constant-face) ;; (sgml . font-lock-type-face) (doctype . bold) (entity . italic) (shortref . font-lock-reference-face))) ;; ------------------------------------ ;; ------------------------------------ ;; Colours from wolfgangs works .emacs file (copy-face 'bold 'keyword-face) (set-face-foreground 'keyword-face "Orange") (setq font-lock-keyword-face 'keyword-face) (copy-face 'bold 'string-face) (set-face-foreground 'string-face "Yellow") (set-face-underline-p 'string-face 1) (setq font-lock-string-face 'string-face) (copy-face 'bold 'comment-face) (set-face-foreground 'comment-face "turquoise") (setq font-lock-comment-face 'comment-face) (copy-face 'bold 'doc-string-face) (set-face-foreground 'doc-string-face "pink") (setq font-lock-doc-string-face 'doc-string-face) (copy-face 'bold 'function-face) (set-face-foreground 'function-face "Green") (setq font-lock-function-name-face 'function-face) (copy-face 'bold 'type-face) (set-face-foreground 'type-face "Red") (setq font-lock-type-face 'type-face) ;; ------------------------------------ ;; Set tab width to 4 (setq tab-width 4) ;; Set default font. Used in most of my terminals (set-face-font 'default "lucidasanstypewriter-14") ;;(set-default-font "Bitstream Vera Sans Mono-14") ;;(set-face-font 'default "-bitstream-bitstream vera sans mono-medium-r-normal-*-*-120-100-100-m-0-iso8859-16") ;;(set-face-font 'default "-adobe-courier-medium-r-normal-*-14-100-*-*-*-*-iso10646-1") ;; Disable the splash screen (setq inhibit-splash-screen t) ;; Load scroll mouse (load "~/.emacs.d/mwheel.el") ;;try to fix strange stuff in css mode. (setq cssm-indent-level 4) (setq cssm-newline-before-closing-bracket t) (setq cssm-indent-function #'cssm-c-style-indenter) (setq cssm-mirror-mode nil)