Skip to content

Instantly share code, notes, and snippets.

@c2nes
Created May 2, 2012 23:05
Show Gist options
  • Save c2nes/2581290 to your computer and use it in GitHub Desktop.
Save c2nes/2581290 to your computer and use it in GitHub Desktop.
.emacs
;; .emacs
;; Kill those stupid startup messages
(setq inhibit-startup-message t)
;; Disable menubar, toolbar, and scrollbars
(menu-bar-mode -1)
(tool-bar-mode -1)
(scroll-bar-mode -1)
;; Turn on global syntax highlighting
(global-font-lock-mode 1)
;; Highlight matching bracket
(show-paren-mode 1)
;; enable visual feedback on selections
(transient-mark-mode 1)
;; Fill column to 80 characters
(setq-default fill-column 80)
;; Show trailing whitespace
(setq-default show-trailing-whitespace t)
;; default to better frame titles
(setq frame-title-format (concat "%b - emacs@" system-name))
;; 5 px of fringe on each side
(fringe-mode 5)
;; Add local site path to load path
(add-to-list 'load-path "~/.emacs.d/site-lisp/")
;; Change quit key
(global-unset-key "\C-x\C-c")
(global-set-key "\C-x\C-q" 'save-buffers-kill-emacs)
;; Disable sub/super scripts in tex mode
(eval-after-load "tex-mode" '(fset 'tex-font-lock-suscript 'ignore))
;; Ensure that emacs-lisp-mode is used when .emacs is a symlink
(add-to-list 'auto-mode-alist (cons (file-truename "~/.emacs") 'emacs-lisp-mode))
;; Warn, don't ask when following symlinks to VC controlled files
(setq vc-follow-symlinks nil)
;; Smoother scrolling
(setq mouse-wheel-scroll-amount '(1 ((shift) . 1)))
(setq mouse-wheel-progressive-speed nil)
(setq scroll-step 1)
;; Dispaly line and column number in modeline
(setq column-number-mode t)
(setq line-number-mode t)
;; Indent using 4 spaces and display tabs as 4 characters wide
(setq-default c-basic-offset 4)
(setq-default tab-width 4)
;; Use spaces by default
(setq-default indent-tabs-mode nil)
;; Toggle the use of indents vs. spaces
(defun toggle-indent-tabs-mode () (interactive)
(if indent-tabs-mode
(setq indent-tabs-mode nil)
(setq indent-tabs-mode t)))
;; Put autosave files (ie #foo#) in one place, *not*
;; scattered all over the file system!
(defvar autosave-dir "~/.emacs.d/backups/")
(make-directory autosave-dir t)
(defun auto-save-file-name-p (filename)
(string-match "^#.*#$" (file-name-nondirectory filename)))
(defun make-auto-save-file-name ()
(concat autosave-dir
(if buffer-file-name
(concat "#" (file-name-nondirectory buffer-file-name) "#")
(expand-file-name
(concat "#%" (buffer-name) "#")))))
;; Put backup files (ie foo~) in one place too. (The backup-directory-alist
;; list contains regexp=>directory mappings; filenames matching a regexp are
;; backed up in the corresponding directory. Emacs will mkdir it if necessary.)
(defvar backup-dir (concat "~/.emacs.d/backups/"))
(setq backup-directory-alist (list (cons "." backup-dir)))
;; Apply styles for graphic frames
(defun cmt-set-frame-styles (&optional frame)
(let ((cmt-bgcolor "gray20")
(cmt-fgcolor "white"))
(set-face-attribute 'default frame
:font "DejaVu Sans Mono"
:height 105
:background cmt-bgcolor
:foreground cmt-fgcolor)
(set-face-attribute 'cursor frame
:background cmt-fgcolor
:foreground cmt-bgcolor)
(set-face-attribute 'fringe frame
:background cmt-bgcolor)
(set-face-attribute 'region frame
:background "#464686")
(set-face-attribute 'trailing-whitespace frame
:background cmt-bgcolor
:strike-through "#444446")
(set-face-attribute 'mode-line frame
:background "#28282b"
:foreground "#f2f2f6"
:box nil)
(set-face-attribute 'mode-line-inactive frame
:background "#444446"
:foreground "#929296"
:box nil
:slant 'oblique)
(set-face-attribute 'mode-line-highlight frame
:box nil
:weight 'bold
:slant 'oblique)
(set-face-attribute 'minibuffer-prompt frame
:foreground "palegreen"
:weight 'normal
:slant 'oblique)
;;
;; Syntax highlighting options
(set-face-attribute 'font-lock-builtin-face frame
:foreground "palegreen"
:weight 'normal)
(set-face-attribute 'font-lock-comment-delimiter-face frame
:foreground "SkyBlue"
:weight 'normal)
(set-face-attribute 'font-lock-comment-face frame
:foreground "SkyBlue"
:weight 'normal)
(set-face-attribute 'font-lock-constant-face frame
:foreground "#ffa0a0"
:weight 'normal)
(set-face-attribute 'font-lock-doc-face frame
:foreground "SkyBlue"
:weight 'normal
:slant 'oblique)
(set-face-attribute 'font-lock-function-name-face frame
:foreground "palegreen"
:weight 'normal)
(set-face-attribute 'font-lock-keyword-face frame
:foreground "khaki"
:weight 'bold)
(set-face-attribute 'font-lock-negation-char-face frame
:foreground "indianred"
:weight 'bold)
(set-face-attribute 'font-lock-preprocessor-face frame
:foreground "indianred"
:weight 'normal)
(set-face-attribute 'font-lock-string-face frame
:foreground "#ffa0a0"
:weight 'normal)
(set-face-attribute 'font-lock-type-face frame
:foreground "palegreen"
:weight 'normal)
(set-face-attribute 'font-lock-variable-name-face frame
:foreground cmt-fgcolor
:weight 'normal)
(set-face-attribute 'font-lock-warning-face frame
:foreground cmt-fgcolor
:weight 'bold)
))
(add-hook 'after-make-frame-functions
'(lambda (frame)
(select-frame frame)
(when (window-system frame)
(cmt-set-frame-styles frame))))
(when window-system (cmt-set-frame-styles))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment