(add-to-list 'load-path "/home/drobilla/.emacs.d/site-lisp") ;(add-to-list 'load-path "/home/drobilla/.emacs.d/site-lisp/sublimity") ;(require 'highlight-beyond-fill-column) (require 'psvn) (require 'tramp) (require 'window-numbering) ;(require 'sublimity) ;(require 'sublimity-scroll) (setq tramp-default-method "scp") ;; Garbage collect much less often (every 10 MiB) (setq-default gc-cons-threshold 10000000) ;; 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) ;; Replace annoying "yes" or "no" prompt with "y" or "n" prompt (fset 'yes-or-no-p 'y-or-n-p) ;; Default text editing configuration (setq-default tab-width 4) (setq-default indent-tabs-mode nil) (setq-default scroll-margin 3) (global-set-key "\C-m" 'newline-and-indent) (delete-selection-mode 1) ;; 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. '(column-number-mode t) '(compilation-scroll-output t) '(fill-column 79) '(font-lock-maximum-decoration t) '(frame-background-mode (quote dark)) '(fringe-mode 0 nil (fringe)) '(grep-find-command "find . -type f -not -name \"*.svn-base\" -print0 | xargs -0 -e grep -I -n -s -F ") '(indicate-empty-lines t) '(inhibit-startup-screen t) '(jshint-mode-node-program "nodejs") '(magit-diff-refine-hunk (quote all)) '(menu-bar-mode nil) '(quack-pretty-lambda-p t) '(quack-run-scheme-always-prompts-p nil) '(scroll-bar-mode (quote right)) '(scroll-conservatively 5) '(send-mail-function (quote sendmail-send-it)) '(show-paren-mode t) '(speedbar-use-images f) '(split-window-preferred-function (quote split-window-horizontally)) '(tool-bar-mode nil) '(dired-listing-switches "-al --time-style=long-iso")) ;; Set colours from solarized palette http://ethanschoonover.com/solarized (custom-set-faces ;; custom-set-faces 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. '(default ((t (:stipple nil :background "grey10" :foreground "grey80" :inverse-video nil :box nil :strike-through nil :overline nil :underline nil :slant normal :weight normal :height 130 :width normal :foundry "unknown" :family "Droid Sans Mono")))) '(bold ((t (:weight bold)))) '(cursor ((t (:background "grey80")))) '(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-change ((((class color) (min-colors 88) (background dark)) (:background "grey20")))) '(diff-refine-removed ((t (:inherit diff-refine-change :background "#241a1a")))) '(diff-removed ((t (:foreground "#D30102")))) '(dired-directory ((t (:foreground "#268BD2")))) '(escape-glyph ((((background dark)) (:foreground "cyan")))) '(font-lock-comment-face ((((class color) (min-colors 88) (background dark)) (:foreground "#268BD2")))) '(font-lock-constant-face ((((class color) (min-colors 88) (background dark)) (:weight bold)))) '(font-lock-doc-face ((t (:inherit font-lock-string-face :foreground "#6C71C4")))) '(font-lock-function-name-face ((((class color) (min-colors 88) (background dark)) (:foreground "gray95")))) '(font-lock-keyword-face ((((class color) (min-colors 88) (background dark)) (:foreground "#859900")))) '(font-lock-preprocessor-face ((nil (:foreground "#D33682")))) '(font-lock-string-face ((((class color) (min-colors 88) (background dark)) (:foreground "#CB4B16")))) '(font-lock-type-face ((((class color) (min-colors 88) (background dark)) (:foreground "#2AA198")))) '(font-lock-variable-name-face ((t (:foreground "white")))) '(font-lock-warning-face ((((class color) (min-colors 88) (background dark)) (:foreground "#D30102" :weight bold)))) '(fringe ((((class color) (background dark)) (:background "grey25")))) '(link ((((class color) (min-colors 88) (background dark)) (:foreground "#268BD2" :inverse-video nil :underline t)))) '(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 ((((class color) (min-colors 88)) (:background "gray35" :foreground "black" :box (:line-width -1 :color "black"))))) '(mode-line-inactive ((default (:inherit mode-line)) (((class color) (min-colors 88) (background dark)) (:background "gray20" :foreground "gray15" :box nil)))) '(nobreak-space ((((class color) (min-colors 88)) (:inherit escape-glyph :underline t)))) '(smerge-refined-change ((t (:background "gray20")))) '(whitespace-newline ((t (:foreground "grey20" :weight normal)))) '(whitespace-space ((t (:foreground "grey20")))) '(whitespace-tab ((t (:foreground "grey20")))) '(woman-addition ((t (:inherit font-lock-builtin-face :foreground "#268BD2")))) '(woman-bold ((t (:inherit bold :foreground "#859900")))) '(woman-italic ((t (:inherit italic :slant italic))))) ;; Compilation and fast error navigation key bindings (defun switch-to-previous-buffer () (interactive) (switch-to-buffer (other-buffer (current-buffer) 1))) (defun rotate-windows () "Rotate your 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)))))))) (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) (global-set-key (kbd "C-c r s") 'replace-string) (global-set-key (kbd "C-c r r") 'replace-regexp) (global-set-key (kbd "C-c a") 'align) (global-set-key (kbd "C-c s") 'sort-lines) (global-set-key (kbd "C-c g") 'grep-find) (global-set-key (kbd "C-c c") 'comment-region) (global-set-key (kbd "C-c u") 'uncomment-region) (global-set-key (kbd "C-c f") 'ff-find-other-file) (global-set-key (kbd "C-c d") 'svn-status-show-svn-diff) (global-set-key (kbd "C-c m") 'magit-status) (global-set-key (kbd "C-c w") 'rotate-windows) ;; Shrink fringe and remove scroll bars ;(fringe-mode 'minimal) (scroll-bar-mode -1) ;; Don't split vertically (setq split-height-threshold nil) (setq split-width-threshold 0) ;; 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) (require 'smarttabs) ;; 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-comment-only-line-offset . 0) (c-auto-align-backslashes . nil) (c-label-minimum-indentation . 0) (c-hungry-delete-key . t) (c-indent-comments-syntactically-p . nil) (c-hanging-braces-alist . ((brace-list-open after) (defun-open after) (defun-close before after) (class-open after) (class-close before after) (namespace-open after) (inline-open after) (inline-close before after) (block-open after) (block-close . c-snug-do-while) (extern-lang-open after) (extern-lang-close after) (statement-case-open after) (substatement-open after))) (c-hanging-colons-alist . ((case-label) (label after) (access-label after) (member-init-intro before) (inher-intro))) (c-hanging-semi&comma-criteria . (c-semi&comma-no-newlines-for-oneline-inliners c-semi&comma-inside-parenlist c-semi&comma-no-newlines-before-nonblanks)) (c-cleanup-list . (brace-catch-brace brace-else-brace brace-elseif-brace compact-empty-funcall defun-close-semi empty-defun-braces list-close-comma one-liner-defun scope-operator)) (c-offsets-alist . ((func-decl-cont . ++) (member-init-intro . +) (inher-intro . ++) (comment-intro . 0) (arglist-close . c-lineup-arglist) (topmost-intro . 0) (block-open . 0) (inline-open . 0) (substatement-open . 0) (label . /) (case-label . 0) (statement-case-open . +) (statement-case-intro . +) (access-label . -) (innamespace . 0) (inextern-lang . 0) (extern-lang-open . 0) (label . -))))) (c-add-style "drobilla" my-c-style) (defun my-c-mode-common-hook () "C mode for people with taste." (require 'smarttabs) (auto-fill-mode 1) (set-fill-column 79) (setq tab-width 4) (setq indent-tabs-mode t) (setq truncate-lines t) (c-set-style "drobilla")) (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) ;; Program names (setq scheme-program-name "mzscheme" browse-url-generic-program (executable-find "sensible-browser") browse-url-browser-function 'browse-url-generic) ;; 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)) ;; Start server for emacsclient (server-start) (put 'narrow-to-region 'disabled nil) (add-to-list 'load-path "/home/drobilla/src/others/jshint-mode") (require 'flymake-jshint) (add-hook 'javascript-mode-hook (lambda () (flymake-mode t)))