From b2a41f953efda8e90dcf5fc0da1910b9df5cdb9e Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Wed, 30 Jul 2014 22:59:53 -0400 Subject: clean up emacs config --- .config/emacs/init.el | 303 +++++++++++++++++++++++--------------------------- 1 file changed, 138 insertions(+), 165 deletions(-) (limited to '.config/emacs/init.el') diff --git a/.config/emacs/init.el b/.config/emacs/init.el index 11765b0..5647398 100644 --- a/.config/emacs/init.el +++ b/.config/emacs/init.el @@ -1,12 +1,48 @@ +; Use XDG-ish locations +(setq xdg-cache-home (file-name-as-directory (or (getenv "XDG_CACHE_HOME") "~/.cache"))) +(setq + package-user-dir (concat xdg-cache-home "emacs/elpa") + ido-save-directory-list-file (concat xdg-cache-home "emacs/ido.last.el") + el-get-dir (concat xdg-cache-home "emacs/el-get/") + eshell-directory-name (concat xdg-cache-home "emacs/eshell/") + wl-score-files-directory (concat xdg-cache-home "emacs/wl-score-files/") + elmo-msgdb-directory (concat xdg-cache-home "emacs/elmo-msgdb/") + elmo-cache-directory (concat xdg-cache-home "emacs/elmo-cache/") + auto-save-list-file-prefix (concat xdg-cache-home "emacs/auto-save-list/saves-") + tramp-persistency-file-name (concat xdg-cache-home "emacs/tramp-cache.el") + custom-file (concat user-emacs-directory "custom.el") + wl-init-file (concat user-emacs-directory "wl.el") + ) + +;; The basics I can't live without ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +(show-paren-mode 1) +(column-number-mode 1) +(line-number-mode 1) +(ido-mode 1) +(unless (daemonp) (server-mode 1)) +(when (require 'whitespace nil t) + (setq whitespace-style '( + tab-mark + space-mark + newline-mark + empty + )) + (global-set-key "\C-cw" 'global-whitespace-mode)) +(setq minibuffer-prompt-properties '( + read-only t + point-entered minibuffer-avoid-prompt + face minibuffer-prompt + )) + ;; Preliminary settings ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (set-face-attribute 'default nil :height 80) -(setq notify-method 'notify-via-libnotify) -(add-to-list 'load-path "~/.emacs.d/") -(add-to-list 'load-path "~/.emacs.d/el-get/el-get") -(setq custom-file "~/.emacs.d/custom.el") +(add-to-list 'load-path user-emacs-directory) +(load custom-file 'noerror) -; derived from ELPA installation +;; Bootstrap ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + +; Derived from ELPA installation ; http://tromey.com/elpa/install.html (defun eval-url (url) (let ((buffer (url-retrieve-synchronously url))) @@ -17,123 +53,115 @@ (eval-region (point) (point-max)) (kill-buffer (current-buffer))))) -;; ELPA stuff ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; - -(unless (require 'package nil t) - (eval-url "http://tromey.com/elpa/package-install.el")) - -(setq package-archives '(("ELPA" . "http://tromey.com/elpa/") - ("marmalade" . "http://marmalade-repo.org/packages/") - ("gnu" . "http://elpa.gnu.org/packages/"))) - -;; el-get stuff ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; - -(setq el-get-install-branch "master") ;; live life on the edge +(add-to-list 'load-path (concat el-get-dir "el-get")) (unless (require 'el-get nil t) - (eval-url "https://github.com/dimitri/el-get/raw/master/el-get-install.el")) + (let ((el-get-install-branch "master")) ;; live life on the edge + (eval-url "https://github.com/dimitri/el-get/raw/master/el-get-install.el"))) -(setq el-get-sources '( - (:name nxhtml - :type http - :url "http://ourcomments.org/Emacs/DL/elisp/nxhtml/zip/nxhtml-2.08-100425.zip" - :build ("unzip nxhtml-2.08-100425.zip") - :load "nxhtml/autostart.el") - )) - -(setq my-el-get-packages - '(el-get -; nxhtml - apel flim semi wanderlust - smarttabs - )) +;; Install plugins ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -;; Now load all of that ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +(add-to-list 'package-archives '("melpa" . "http://melpa.milkbox.net/packages/")) +(setq package-enable-at-startup nil) -;; ELPA -(package-initialize) -;; el-get -(when (require 'el-get nil t) (el-get 'sync my-el-get-packages)) -;; custom -(load custom-file 'noerror) +(setq el-get-sources '( + (:name dtrt-indent :type elpa + :after (dtrt-indent-mode 1)) + (:name coffee-mode :type elpa + :after (add-hook 'coffee-mode-hook + '(lambda () + (set (make-local-variable 'tab-width) 2) + (set (make-local-variable 'indent-tabs-mode) nil) + ))) + (:name smart-tabs-mode :type elpa + :after (progn + (smart-tabs-mode-enable) + (apply 'smart-tabs-insinuate (mapcar 'car smart-tabs-insinuate-alist)))) + (:name graphviz-dot-mode :type elpa) + (:name markdown-mode :type elpa + :after (add-to-list 'auto-mode-alist '("\\.ronn\\'" . markdown-mode))) + (:name nginx-mode :type elpa + :after (put 'nginx-indent-level 'safe-local-variable 'integerp)) + (:name scss-mode :type elpa) + )) +(el-get 'sync '(el-get + apel flim semi wanderlust + dtrt-indent + smart-tabs-mode + nginx-mode + markdown-mode + ;nxhtml + )) ;; General settings ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -(require 'go-mode-load) -(require 'uniquify) +(if (fboundp 'tool-bar-mode) (tool-bar-mode -1)) -(require 'mailcrypt) -(mc-setversion "gpg") -(add-hook 'wl-summary-mode-hook 'mc-install-read-mode) -(add-hook 'wl-mail-setup-hook 'mc-install-write-mode) +(defadvice align-regexp (around align-with-spaces) + (let ((indent-tabs-mode nil)) ad-do-it)) -(defun mc-wl-verify-signature () - (interactive) - (save-window-excursion - (wl-summary-jump-to-current-message) - (mc-verify))) - -(defun mc-wl-decrypt-message () - (interactive) - (save-window-excursion - (wl-summary-jump-to-current-message) - (let ((inhibit-read-only t)) - (mc-decrypt)))) - -(eval-after-load "mailcrypt" - '(setq mc-modes-alist - (append - (quote - ((wl-draft-mode (encrypt . mc-encrypt-message) - (sign . mc-sign-message)) - (wl-summary-mode (decrypt . mc-wl-decrypt-message) - (verify . mc-wl-verify-signature)))) - mc-modes-alist))) - -;(load "mdmua") +(require 'go-mode-load nil t) +(require 'uniquify) (load "emacsutils") -(set-default 'truncate-lines t) -(tool-bar-mode -1) -(ido-mode t) -(show-paren-mode 1) -(setq org-log-done 'time) -(setq gamegrid-user-score-file-directory "/var/games/emacs/") -;(xclip-mode 1) - -(load "whitespace") -(setq whitespace-style '( - tab-mark - space-mark - newline-mark - empty -)) - - -;; These are my preferred settings; we let dtrt-indent detect when we play with other's files -(setq-default tab-width 8) -(setq-default c-basic-offset 8) -(setq-default indent-tabs-mode t) - - +(when (require 'mailcrypt nil t) + (mc-setversion "gpg") + (add-hook 'wl-summary-mode-hook 'mc-install-read-mode) + (add-hook 'wl-mail-setup-hook 'mc-install-write-mode) + (defun mc-wl-verify-signature () + (interactive) + (save-window-excursion + (wl-summary-jump-to-current-message) + (mc-verify))) + (defun mc-wl-decrypt-message () + (interactive) + (save-window-excursion + (wl-summary-jump-to-current-message) + (let ((inhibit-read-only t)) + (mc-decrypt)))) + (eval-after-load "mailcrypt" + '(setq mc-modes-alist + (append + (quote + ((wl-draft-mode (encrypt . mc-encrypt-message) + (sign . mc-sign-message)) + (wl-summary-mode (decrypt . mc-wl-decrypt-message) + (verify . mc-wl-verify-signature)))) + mc-modes-alist))) + ) + +(setq-default truncate-lines t) +(setq + inhibit-startup-screen t + org-log-done 'time + gamegrid-user-score-file-directory "/var/games/emacs/" + ) + +;; Indent settings +(setq-default + indent-tabs-mode t + tab-width 8 + c-basic-offset 8 + sh-basic-offset 8 + sh-indent-comment t + ) + +;; Backup settings (setq backup-by-copying t ;; don't clobber symlinks - backup-directory-alist '(("." . "~/.emacs.d/saves")) ;; don't litter my fs tree + backup-directory-alist '(("." . "~/.cache/emacs/emacs/saves")) ;; don't litter my fs tree delete-old-versions t kept-new-versions 6 kept-old-versions 2 version-control t ;; use versioned backups -) - -(setq column-number-mode t - inhibit-startup-screen t - line-number-mode t - server-use-tcp t - server-mode t) - -(setq browse-url-generic-program (executable-find "v-www-browser") - browse-url-browser-function 'browse-url-generic) + ) +;; Web browser settings +(setq + browse-url-generic-program (executable-find "v-www-browser") + browse-url-browser-function 'browse-url-generic + ) +;; Make work like in every other program (defun toggle-fullscreen (&optional f) (interactive) (let ((current-value (frame-parameter nil 'fullscreen))) @@ -142,25 +170,11 @@ (if (boundp 'old-fullscreen) old-fullscreen nil) (progn (setq old-fullscreen current-value) 'fullboth))))) - -;; Custom keybindings ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; - (global-set-key [f11] 'toggle-fullscreen) -(global-set-key "\C-cw" 'global-whitespace-mode) -;; mode-hooks ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (add-hook 'text-mode-hook 'turn-on-auto-fill) -; for term-mode -;; (add-hook 'after-make-frame-functions -;; (lambda (frame) -;; (set-variable 'term-default-fg-color -;; (face-foreground 'default)) -;; (set-variable 'term-default-bg-color -;; (face-background 'default))) -;; t) - (add-hook 'lisp-mode-hook '(lambda () (set (make-local-variable 'indent-tabs-mode) nil) @@ -171,21 +185,14 @@ (set (make-local-variable 'indent-tabs-mode) nil) )) -(add-hook 'coffee-mode-hook - '(lambda () - (set (make-local-variable 'tab-width) 2) - )) - (add-hook 'term-mode-hook '(lambda () - (setq term-prompt-regexp "^[^#$%>\n]*[#$%>] *") - (make-local-variable 'mouse-yank-at-point) - ;(make-local-variable 'transient-mark-mode) - (setq mouse-yank-at-point t) - ;(setq transient-mark-mode nil) (auto-fill-mode -1) + (setq term-prompt-regexp "^[^#$%>\n]*[#$%>] *") + (set (make-local-variable 'mouse-yank-at-point) t) (setq tab-width 8 ) - (setq autopair-dont-activate t) ;; Don't let autopair break ansi-term + (setq truncate-lines nil) + (set (make-local-variable 'autopair-dont-activate) t) ;; Don't let autopair break ansi-term )) (add-hook 'ruby-mode-hook @@ -195,46 +202,12 @@ (set (make-local-variable 'tab-width) 4) )) -(add-hook 'coffee-mode-hook - '(lambda () - (set (make-local-variable 'indent-tabs-mode) nil) - )) - (add-to-list 'auto-mode-alist '("PKGBUILD" . sh-mode)) (add-to-list 'auto-mode-alist '("SRCBUILD" . sh-mode)) -(add-to-list 'auto-mode-alist '("\\.md\\'" . markdown-mode)) -(add-to-list 'auto-mode-alist '("\\.ronn\\'" . markdown-mode)) - -;(require 'flymake) -;(add-hook 'php-mode-hook (lambda() (flymake-mode 1))) -;(define-key php-mode-map '[M-S-up] 'flymake-goto-prev-error) -;(define-key php-mode-map '[M-S-down] 'flymake-goto-next-error) - -;(setq tramp-debug-buffer t) -;(setq tramp-verbose 10) - -;; (add-to-list 'load-path "/usr/share/emacs/site-lisp/mu4e") -;; (require 'mu4e) -;; (require 'mu4e-speedbar) - -;; (setq -;; mu4e-maildir "~/Maildir" ;; top-level Maildir -;; mu4e-sent-folder "/.Sent" ;; folder for sent messages -;; mu4e-drafts-folder "/.Draft" ;; unfinished messages -;; mu4e-trash-folder "/.Trash" ;; trashed messages -;; mu4e-refile-folder "/archive") ;; saved messages -;; (setq mu4e-get-mail-command "offlineimap") -;; (setq mu4e-use-fancy-chars "t") -;; ;; enable inline images -;; (setq mu4e-view-show-images t) -;; ;; use imagemagick, if available -;; (when (fboundp 'imagemagick-register-types) -;; (imagemagick-register-types)) - - -(defun sm-try-smerge () + +(defun try-smerge-mode () (save-excursion (goto-char (point-min)) (when (re-search-forward "^<<<<<<< " nil t) (smerge-mode 1)))) -(add-hook 'find-file-hook 'sm-try-smerge t) +(add-hook 'find-file-hook 'try-smerge-mode t) -- cgit v1.2.3-2-g168b