summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2015-10-18 13:12:32 -0400
committerDavid Robillard <d@drobilla.net>2015-10-18 13:12:32 -0400
commit58f86dee43bb74b37ec58392b1b7031c89f40938 (patch)
treefecd4273b7d57625677ead133efd6821b3e1089d
parent6eba4ec47fa87cfd9fb1a1f7842149b7516879b6 (diff)
downloaddotfiles-58f86dee43bb74b37ec58392b1b7031c89f40938.tar.gz
dotfiles-58f86dee43bb74b37ec58392b1b7031c89f40938.tar.bz2
dotfiles-58f86dee43bb74b37ec58392b1b7031c89f40938.zip
Clean up emacs configuration
-rw-r--r--emacs.d/init.el217
1 files changed, 99 insertions, 118 deletions
diff --git a/emacs.d/init.el b/emacs.d/init.el
index 4df64c0..a354631 100644
--- a/emacs.d/init.el
+++ b/emacs.d/init.el
@@ -1,61 +1,58 @@
-(add-to-list 'load-path "/home/drobilla/.emacs.d/site-lisp")
+;;; System
-(require 'package)
-(package-initialize)
-
-(require 'psvn)
-(require 'tramp)
-(require 'window-numbering)
-(require 'dash)
-(require 'spaceline-config)
+(add-to-list 'load-path (expand-file-name "~/.emacs.d/site-lisp"))
+(setq-default
+ gc-cons-threshold 10000000
+ backup-by-copying t
+ backup-directory-alist `((".*" . ,temporary-file-directory))
+ auto-save-file-name-transforms `((".*" ,temporary-file-directory t))
+ scheme-program-name "mzscheme"
+ browse-url-generic-program (executable-find "sensible-browser")
+ browse-url-browser-function 'browse-url-generic)
-(setq tramp-default-method "scp")
+;;; Packages
+(require 'package)
(setq package-archives
'(("gnu" . "http://elpa.gnu.org/packages/")
("melpa-stable" . "http://stable.melpa.org/packages/")))
-;; Garbage collect much less often (every 10 MiB)
-(setq-default gc-cons-threshold 10000000)
-
-(spaceline-emacs-theme)
-
-;; Save backup and autosave files to /tmp instead of polluting file system
-(setq
- backup-by-copying t ; Don't clobber symlinks
- backup-directory-alist `((".*" . ,temporary-file-directory))
- auto-save-file-name-transforms `((".*" ,temporary-file-directory t))
- delete-old-versions t
- kept-new-versions 6
- kept-old-versions 2
- version-control t)
+(package-initialize)
+(require 'psvn)
+(require 'spaceline-config)
+(require 'tramp)
+(require 'window-numbering)
-;; Replace annoying "yes" or "no" prompt with "y" or "n" prompt
-(fset 'yes-or-no-p 'y-or-n-p)
+;;; Basic editor configuration
-;; Default text editing configuration
-(setq-default tab-width 4)
-(setq-default indent-tabs-mode nil)
-(setq-default scroll-margin 3)
+(setq-default tab-width 4)
+(setq-default indent-tabs-mode nil)
+(setq-default scroll-margin 3)
(setq-default show-trailing-whitespace t)
-
-(global-set-key "\C-m" 'newline-and-indent)
(delete-selection-mode 1)
+(defalias 'yes-or-no-p 'y-or-n-p)
+(spaceline-emacs-theme)
+(winner-mode 1)
+
+;;; Variables
-;; Custom configuration
(custom-set-variables
;; custom-set-variables was added by Custom.
;; If you edit it by hand, you could mess it up, so be careful.
;; Your init file should contain only one such instance.
;; If there is more than one, they won't work right.
+ '(backup-by-copying t)
+ '(backup-directory-alist (\` ((".*" \, temporary-file-directory))))
'(column-number-mode t)
'(compilation-scroll-output t)
+ '(delete-old-versions t)
'(dired-listing-switches "-al --time-style=long-iso")
'(erc-mode-line-format "%t")
'(fill-column 79)
'(font-lock-maximum-decoration t)
'(frame-background-mode (quote dark))
'(fringe-mode 0 nil (fringe))
+ '(gc-cons-threshold 10000000)
'(grep-find-command
"find . -type f -not -name \"*.svn-base\" -print0 | xargs -0 grep -I -n -s -F ")
'(indicate-empty-lines t)
@@ -72,9 +69,10 @@
'(show-paren-mode t)
'(speedbar-use-images f)
'(split-window-preferred-function (quote split-window-horizontally))
- '(tool-bar-mode nil))
+ '(tool-bar-mode nil)
+ '(version-control t))
-;; Set colours from solarized palette http://ethanschoonover.com/solarized
+;;; Colours
(custom-set-faces
;; custom-set-faces was added by Custom.
;; If you edit it by hand, you could mess it up, so be careful.
@@ -86,9 +84,9 @@
'(diff-added ((t (:foreground "#859900"))))
'(diff-file-header ((((class color) (min-colors 88) (background dark)) (:weight bold))))
'(diff-header ((((class color) (min-colors 88) (background dark)) (:foreground "#6C71C4"))))
- '(diff-refine-added ((t (:inherit diff-refine-change :background "#1a201a"))))
+ '(diff-refine-added ((t (:inherit diff-refine-change :background "#336633" :foreground "#EEFFEE"))))
'(diff-refine-change ((((class color) (min-colors 88) (background dark)) (:background "grey20"))))
- '(diff-refine-removed ((t (:inherit diff-refine-change :background "#241a1a"))))
+ '(diff-refine-removed ((t (:inherit diff-refine-change :background "#663333"))))
'(diff-removed ((t (:foreground "#D30102"))))
'(dired-directory ((t (:foreground "#268BD2"))))
'(escape-glyph ((((background dark)) (:foreground "cyan"))))
@@ -107,8 +105,8 @@
'(link-visited ((default (:inherit link)) (((class color) (background dark)) (:foreground "#6C71C4"))))
'(magit-item-highlight ((t (:background "gray12"))))
'(minibuffer-prompt ((((background dark)) (:foreground "white"))))
- '(mode-line ((t (:background "#2D3232" :foreground "black" :box (:line-width -1 :color "black")))))
- '(mode-line-inactive ((t (:inherit mode-line :background "gray20" :foreground "gray15" :box (:line-width 2 :color "#1A1A1A")))))
+ '(mode-line ((t (:background "#2D3232" :foreground "#AFB3B2" :box (:line-width 2 :color "#1A1A1A")))))
+ '(mode-line-inactive ((t (:inherit mode-line :background "gray20" :foreground "#4F5352" :box (:line-width 2 :color "#1A1A1A")))))
'(nobreak-space ((((class color) (min-colors 88)) (:inherit escape-glyph :underline t))))
'(powerline-active2 ((t (:inherit mode-line :background "#2D3232"))))
'(smerge-refined-change ((t (:background "gray20"))))
@@ -122,40 +120,47 @@
'(woman-bold ((t (:inherit bold :foreground "#859900"))))
'(woman-italic ((t (:inherit italic :slant italic)))))
-;; Compilation and fast error navigation key bindings
+;;; Windows
-(defun switch-to-previous-buffer ()
- (interactive)
- (switch-to-buffer (other-buffer (current-buffer) 1)))
+(defun compile-autoclose (buffer string)
+ "Close compilation window on success"
+ (cond ((and (string-match "compilation" (buffer-name buffer))
+ (string-match "finished" string))
+ (bury-buffer "*compilation*")
+ (winner-undo)
+ (message "Build successful."))
+ (t
+ (message "Compilation exited abnormally: %s" string))))
(defun rotate-windows ()
- "Rotate your windows"
+ "Rotate windows"
(interactive)
- (cond
- ((not (> (count-windows) 1))
- (message "You can't rotate a single window!"))
- (t
- (let ((i 0)
- (num-windows (count-windows)))
- (while (< i (- num-windows 1))
- (let* ((w1 (elt (window-list) i))
- (w2 (elt (window-list) (% (+ i 1) num-windows)))
- (b1 (window-buffer w1))
- (b2 (window-buffer w2))
- (s1 (window-start w1))
- (s2 (window-start w2)))
- (set-window-buffer w1 b2)
- (set-window-buffer w2 b1)
- (set-window-start w1 s2)
- (set-window-start w2 s1)
- (setq i (1+ i))))))))
+ (if (> (count-windows) 1)
+ (let ((i 0)
+ (num-windows (count-windows)))
+ (while (< i (- num-windows 1))
+ (let* ((w1 (elt (window-list) i))
+ (w2 (elt (window-list) (% (+ i 1) num-windows)))
+ (b1 (window-buffer w1))
+ (b2 (window-buffer w2))
+ (s1 (window-start w1))
+ (s2 (window-start w2)))
+ (set-window-buffer w1 b2)
+ (set-window-buffer w2 b1)
+ (set-window-start w1 s2)
+ (set-window-start w2 s1)
+ (setq i (+ i 1)))))))
-(global-set-key (kbd "C-b") 'compile)
-(global-set-key (kbd "M-p") 'previous-error)
-(global-set-key (kbd "M-n") 'next-error)
-(global-set-key [C-up] 'previous-error)
-(global-set-key [C-down] 'next-error)
-(global-set-key [C-tab] 'switch-to-previous-buffer)
+(setq split-height-threshold nil)
+(setq split-width-threshold 0)
+(setq compilation-finish-functions 'compile-autoclose)
+
+;;; Key bindings
+
+(global-set-key (kbd "\C-m") 'newline-and-indent)
+(global-set-key (kbd "C-p") 'previous-error)
+(global-set-key (kbd "C-n") 'next-error)
+(global-set-key (kbd "C-c b") 'compile)
(global-set-key (kbd "C-c r") 'replace-string)
(global-set-key (kbd "C-c R") 'replace-regexp)
(global-set-key (kbd "C-c a") 'align)
@@ -169,26 +174,12 @@
(global-set-key (kbd "C-c w") 'rotate-windows)
(global-set-key (kbd "C-c e") 'erc-track-switch-buffer)
-;; Don't split vertically
-(setq split-height-threshold nil)
-(setq split-width-threshold 0)
+;;; File modes
-;; Close compilation window on success
-(winner-mode 1)
-(defun compile-autoclose (buffer string)
- (cond ((and (string-match "compilation" (buffer-name buffer))
- (string-match "finished" string))
- (bury-buffer "*compilation*")
- (winner-undo)
- (message "Build successful."))
- (t
- (message "Compilation exited abnormally: %s" string))))
-(setq compilation-finish-functions 'compile-autoclose)
+;; C/C++
-;; C/C++ style
(defconst my-c-style
- '(;(c-doc-comment-style . ((c-mode . doxygen) (c++-mode . doxygen) (java-mode . javadoc)))
- (c-block-comment-prefix . " ")
+ '((c-block-comment-prefix . " ")
(c-comment-only-line-offset . 0)
(c-auto-align-backslashes . nil)
(c-label-minimum-indentation . 0)
@@ -259,43 +250,33 @@
(add-hook 'c-mode-common-hook 'my-c-mode-common-hook)
(add-hook 'c++-mode-common-hook 'my-c-mode-common-hook)
-;; Python style
-(defun sane-python-mode ()
- (setq tab-width 4)
- (setq indent-tabs-mode nil)
- (setq python-indent-offset 4))
-(add-hook 'python-mode-hook 'sane-python-mode)
+;; Python
+
+(add-hook 'python-mode-hook
+ (lambda ()
+ (setq tab-width 4)
+ (setq indent-tabs-mode nil)))
+
+;; Associations
-;; Program names
-(setq scheme-program-name "mzscheme"
- browse-url-generic-program (executable-find "sensible-browser")
- browse-url-browser-function 'browse-url-generic)
+(add-to-list 'auto-mode-alist '("\\.pl\\'" . prolog-mode))
+(add-to-list 'auto-mode-alist '("\\.n3" . ttl-mode))
+(add-to-list 'auto-mode-alist '("\\.ttl" . ttl-mode))
+(add-to-list 'auto-mode-alist '("\\.owl" . ttl-mode))
+(add-to-list 'auto-mode-alist '("\\.ll" . llvm-mode))
+(add-to-list 'auto-mode-alist '("\\.md" . markdown-mode))
-;; File modes
-(autoload 'llvm-mode "llvm-mode" "Edit LLVM assembly" t)
-(autoload 'ttl-mode "ttl-mode" "Edit N3 or Turtle files" t)
-(setq auto-mode-alist
- (append
- (list
- '("\\.pl" . prolog-mode)
- '("\\.n3" . ttl-mode)
- '("\\.ttl" . ttl-mode)
- '("\\.owl" . ttl-mode)
- '("\\.ll" . llvm-mode)
- '("\\.md" . markdown-mode))
- auto-mode-alist))
+;;; IRC
-;; IRC configuration
-(require 'erc)
+(when (require 'erc nil :noerror)
+ (erc-autojoin-mode t)
+ (setq erc-autojoin-channels-alist
+ '((".*\\.freenode.net" "#ardour" "#ardour-dev" "#ardour-mixbus-dev" "#ingen" "#lv2", "#portalmod")))
-(erc-autojoin-mode t)
-(setq erc-autojoin-channels-alist
- '((".*\\.freenode.net" "#ardour" "#ardour-dev" "#ardour-mixbus-dev" "#ingen" "#lv2", "#portalmod")))
+ (erc-track-mode t)
+ (setq erc-track-exclude-types '("JOIN" "NICK" "PART" "QUIT" "MODE"
+ "324" "329" "332" "333" "353" "477")))
-(erc-track-mode t)
-(setq erc-track-exclude-types '("JOIN" "NICK" "PART" "QUIT" "MODE"
- "324" "329" "332" "333" "353" "477"))
+;;; Launch
-;; Start server for emacsclient
(server-start)
-(put 'narrow-to-region 'disabled nil)