.emacs.d / files / global.el

Full commit
;;; Global settings
;;; Generic emacs settings I cannot live without

;; Winner mode
;; C-c left C-c right switch between window configurations, M-arrows to jump between windows
(when (fboundp 'winner-mode)
  (winner-mode 1))

;; Don't show the startup screen
(setq inhibit-startup-message t)

;; "y or n" instead of "yes or no"
(fset 'yes-or-no-p 'y-or-n-p)

;; Highlight regions and add special behaviors to regions.
;; "C-h d transient" for more info
(setq transient-mark-mode t)

;; Display line and column numbers
(setq line-number-mode    t)
(setq column-number-mode  t)

;; Modeline info
(display-time-mode 1)
;; (display-battery-mode 1)

;; Small fringes
(set-fringe-mode '(1 . 1))

;; Explicitly show the end of a buffer
(set-default 'indicate-empty-lines t)

;; Prevent the annoying beep on errors
(setq visible-bell t)

;; Make sure all backup files only live in one place
(setq backup-directory-alist '(("." . "~/.emacs.d/backups")))

;; Autoload modes
(add-to-list 'auto-mode-alist '("\\.md$" . markdown-mode))

;; Gotta see matching parens
(show-paren-mode t)

;; Don't truncate lines
(setq truncate-lines t)
(setq truncate-partial-width-windows nil)

;; Trailing whitespace is unnecessary
(add-hook 'before-save-hook 'cleanup-buffer-safe)

;; Trash can support
(setq delete-by-moving-to-trash t)

;; zap-up-to-char, forward-to-word, backward-to-word, etc
(require 'misc)

;; Syntax hilight
(global-font-lock-mode t)
(setq font-lock-maximum-decoration t)

;; UTF
(setq locale-coding-system 'utf-8)
(set-terminal-coding-system 'utf-8)
(set-keyboard-coding-system 'utf-8)
(set-selection-coding-system 'utf-8)
(prefer-coding-system 'utf-8)

(setq calendar-week-start-day 1)

;; Some text-mode settings

;; turn on visual-line-mode for text-mode major mode
;; (add-hook 'text-mode-hook 'turn-on-visual-line-mode)

(setq-default cursor-type 'box)
;; variable width font in text buffers ...
(dolist (hook '(text-mode-hook
  (add-hook hook 'init-text-based-modes))

;; Use variable width font faces in current buffer
(defun my-buffer-face-mode-variable ()
  "Set font to a variable width (proportional) fonts in current buffer"
  (setq buffer-face-mode-face '(:family "Verdana" :height 120))
;; Use monospaced font faces in current buffer
(defun my-buffer-face-mode-fixed ()
  "Sets a fixed width (monospace) font in current buffer"
  (setq buffer-face-mode-face '(:family "Consolas" :height 100))

(defun init-text-based-modes ()
  (setq cursor-type 'bar)
  (setq indent-tabs-mode t)

;; ... but not in Org tables
(set-face-attribute 'org-table nil :inherit 'fixed-pitch)

;; (custom-set-faces
;;  '(variable-pitch ((t (:family "Bitstream Vera Serif")))))

(setq ibuffer-saved-filter-groups
      (quote (("default"
               ("Org" ;; all org-related buffers
                (mode . org-mode))
                (or (filename . ".emacs.d")
                    (filename . ".emacs")
                    (filename . "emacs-config")))
                (or (mode . tex-mode)
                    (mode . TeX-mode)
                    (mode . latex-mode)
                    (mode . LaTeX-mode)
                    (filename . ".tex")))
                (or (mode . html-mode)
                    (mode . css-mode)
                    (mode . PHP-mode)))
                (or (mode . sr-mode)))
               ("Programming" ;; prog stuff not already in MyProjectX
                 (mode . c-mode)
                 (mode . perl-mode)
                 (mode . python-mode)
                 (mode . cc-mode)
                 (mode . js-mode)
                 ;; etc

(defun customize-ibuffer-mode ()
  (ibuffer-switch-to-saved-filter-groups "default")
  (setq ibuffer-hidden-filter-groups
        (push "Sunrise" ibuffer-hidden-filter-groups)))
(add-hook 'ibuffer-mode-hook 'customize-ibuffer-mode)