Saturday, May 20, 2017

my .emacs favs

(menu-bar-mode nil)

(defun force-revert-buffer ()
  "Force revert of buffer"
  (interactive)
  (revert-buffer t t nil)
  (message "Reverted"))

(global-set-key [S-up] 'previous-error) ; shift and up-arrow
(global-set-key [S-down] 'next-error)   ; shift and down-arrow
(global-set-key "\C-cb" 'compile)
(global-set-key "\C-cd" 'delete-rectangle)
(global-set-key "\C-cr" 'force-revert-buffer) ; read what's on disk
(global-set-key "\C-cg" 'goto-line)
(global-unset-key "\C-xm")

(setq inhibit-startup-message t)

(setq visible-bell t)

(setq line-number-mode t)
(setq column-number-mode t)

(show-paren-mode t)

(auto-fill-mode -1)
(remove-hook 'text-mode-hook #'turn-on-auto-fill)

(setq-default indent-tabs-mode t)

(setq transient-mark-mode t)

; get a unified context diff with RCS mode:
(setq vc-rcs-diff-switches "-u")

; set colors for vc-diff to be like "git diff"
(custom-set-faces
 '(diff-added ((t (:foreground "SeaGreen" :weight bold))) 'now)
 '(diff-removed ((t (:foreground "Red" :weight bold))) 'now)
 )

(setq indent-tabs-mode t)

(defun set-linux-kernel-c-mode ()
  "C mode with adjusted defaults for use with the Linux kernel."
  (interactive)
  (c-set-style "linux")
  (setq indent-tabs-mode t)
  (message "Linux kernel C style"))

(add-hook 'c-mode-hook   'linux-kernel-mode)
(add-hook 'c++-mode-hook 'linux-kernel-mode)

;; tell emacs C/C++ mode to fill comments all the way to the end of the screen.
;; The default value for fill-column is 70.
(setq-default fill-column 79)