From 0e67aadb031f8b16e50e97b60fef56060185e789 Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Fri, 10 Oct 2014 17:09:23 -0400 Subject: Update emacs config --- .config/emacs/custom.el | 11 +---- .config/emacs/init.el | 114 ++++++++++++++++++++++++++++++++++-------------- 2 files changed, 82 insertions(+), 43 deletions(-) (limited to '.config/emacs') diff --git a/.config/emacs/custom.el b/.config/emacs/custom.el index 0eb22a6..af2aef8 100644 --- a/.config/emacs/custom.el +++ b/.config/emacs/custom.el @@ -3,24 +3,15 @@ ;; 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. - '(ansi-color-faces-vector [default bold shadow italic underline bold bold-italic bold]) - '(ansi-color-names-vector (vector "#ffffff" "#ff9da4" "#d1f1a9" "#ffeead" "#bbdaff" "#ebbbff" "#99ffff" "#002451")) - '(asm-comment-char 35) '(custom-enabled-themes (quote (tango-dark))) '(custom-safe-themes (quote ("9f443833deb3412a34d2d2c912247349d4bd1b09e0f5eaba11a3ea7872892000" "bb08c73af94ee74453c90422485b29e5643b73b05e8de029a6909af6a3fb3f58" "82d2cac368ccdec2fcc7573f24c3f79654b78bf133096f9b40c20d97ec1d8016" "1b8d67b43ff1723960eb5e0cba512a2c7a2ad544ddb2533a90101fd1852b426e" "628278136f88aa1a151bb2d6c8a86bf2b7631fbea5f0f76cba2a0079cd910f7d" "06f0b439b62164c6f8f84fdda32b62fb50b6d00e8b01c2208e55543a6337433a" "1e7e097ec8cb1f8c3a912d7e1e0331caeed49fef6cff220be63bd2a6ba4cc365" "71b172ea4aad108801421cc5251edb6c792f3adbaecfa1c52e94e3d99634dee7" "fc5fcb6f1f1c1bc01305694c59a1a861b008c534cae8d0e48e4d5e81ad718bc6" default))) '(erc-nick "lukeshu") '(explicit-shell-file-name "/bin/bash") - '(page-break-lines-char 45) - '(ruby-deep-arglist nil) - '(ruby-deep-indent-paren nil) '(scroll-bar-mode nil) '(send-mail-function (quote smtpmail-send-it)) '(smtpmail-smtp-server "plus.smtp.mail.yahoo.com") '(smtpmail-smtp-service 587) - '(uniquify-buffer-name-style (quote post-forward-angle-brackets) nil (uniquify)) - '(vc-annotate-background "#2b2b2b") - '(vc-annotate-color-map (quote ((20 . "#bc8383") (40 . "#cc9393") (60 . "#dfaf8f") (80 . "#d0bf8f") (100 . "#e0cf9f") (120 . "#f0dfaf") (140 . "#5f7f5f") (160 . "#7f9f7f") (180 . "#8fb28f") (200 . "#9fc59f") (220 . "#afd8af") (240 . "#bfebbf") (260 . "#93e0e3") (280 . "#6ca0a3") (300 . "#7cb8bb") (320 . "#8cd0d3") (340 . "#94bff3") (360 . "#dc8cc3")))) - '(vc-annotate-very-old-color "#dc8cc3")) + '(uniquify-buffer-name-style (quote post-forward-angle-brackets) nil (uniquify))) (custom-set-faces ;; custom-set-faces was added by Custom. ;; If you edit it by hand, you could mess it up, so be careful. diff --git a/.config/emacs/init.el b/.config/emacs/init.el index 5647398..a36cf37 100644 --- a/.config/emacs/init.el +++ b/.config/emacs/init.el @@ -1,4 +1,5 @@ -; Use XDG-ish locations +; This config requires Emacs 24(+?) +;; 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") @@ -14,7 +15,7 @@ wl-init-file (concat user-emacs-directory "wl.el") ) -;; The basics I can't live without ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; The basics that I can't use Emacs without ;;;;;;;;;;;;;;;;;;;;;;;;; (show-paren-mode 1) (column-number-mode 1) (line-number-mode 1) @@ -33,14 +34,19 @@ point-entered minibuffer-avoid-prompt face minibuffer-prompt )) - -;; Preliminary settings ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; - -(set-face-attribute 'default nil :height 80) (add-to-list 'load-path user-emacs-directory) (load custom-file 'noerror) -;; Bootstrap ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + +;; Early settings ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +; This isn't particularly important, but set it before doing a whole +; lot (loading packages), so there isn't a weird change in text size. +(set-face-attribute 'default nil :height 80) + + +;; Bootstrap el-get ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +; This downloads and installs el-get (package management) if isn't +; installed. ; Derived from ELPA installation ; http://tromey.com/elpa/install.html @@ -58,24 +64,40 @@ (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"))) -;; Install plugins ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + +;; Install packages ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +; This is kinda funny how it works. +; +; package.el/ELPA (The standard package manager in Emacs 24) has +; terrible programatic management. It's great at installing packages, +; but only interactively. So, I +; 1) Disable package.el from getting loading all downloaded packages +; 2) Use el-get to load a specified list of packages from elpa. +; +; This is also nice because I can do event-base programming for what +; to do once a package is loaded, using :after. (add-to-list 'package-archives '("melpa" . "http://melpa.milkbox.net/packages/")) (setq package-enable-at-startup nil) +; What packages el-get should get from ELPA (if it gets them at all) (setq el-get-sources '( - (:name dtrt-indent :type elpa + ; Minor modes + (:name dtrt-indent :type elpa ; Detect indent style for existing files :after (dtrt-indent-mode 1)) + (:name page-break-lines :type elpa ; Display form-feeds pretty + :after (global-page-break-lines-mode 1)) + (:name smart-tabs-mode :type elpa ; Indent with tabs, align with spaces + :after (progn + (smart-tabs-mode 1) + (apply 'smart-tabs-insinuate (mapcar 'car smart-tabs-insinuate-alist)))) + ; Major modes (: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))) @@ -83,18 +105,25 @@ :after (put 'nginx-indent-level 'safe-local-variable 'integerp)) (:name scss-mode :type elpa) )) +; What packages el-get should install, both from above, and it's +; internal list of sources. (el-get 'sync '(el-get - apel flim semi wanderlust + ; Minor modes dtrt-indent smart-tabs-mode - nginx-mode + page-break-lines + ; Major modes + apel flim semi wanderlust markdown-mode - ;nxhtml + nginx-mode + ;nxhtml ; nxhtml is invasive, only enable if actively using + php-mode-improved )) -;; General settings ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + +;; Misc. crap -(if (fboundp 'tool-bar-mode) (tool-bar-mode -1)) +(when (fboundp 'tool-bar-mode) (tool-bar-mode -1)) (defadvice align-regexp (around align-with-spaces) (let ((indent-tabs-mode nil)) ad-do-it)) @@ -103,6 +132,24 @@ (require 'uniquify) (load "emacsutils") +(setq-default truncate-lines t) +(setq + inhibit-startup-screen t + org-log-done 'time + gamegrid-user-score-file-directory "/var/games/emacs/" + ) + + + +;; Make the mouse work in an xterm +(when (fboundp 'xterm-mouse-mode) + (xterm-mouse-mode 1) + (add-hook 'after-make-frame-functions + '(lambda (frame) + (if xterm-mouse-mode (xterm-mouse-mode 1)) + ))) + +;; Use mailcrypt to encrypt/decrypt email (when (require 'mailcrypt nil t) (mc-setversion "gpg") (add-hook 'wl-summary-mode-hook 'mc-install-read-mode) @@ -129,13 +176,6 @@ 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 @@ -148,7 +188,7 @@ ;; Backup settings (setq backup-by-copying t ;; don't clobber symlinks - backup-directory-alist '(("." . "~/.cache/emacs/emacs/saves")) ;; don't litter my fs tree + backup-directory-alist '(("." . (concat xdg-cache-home "emacs/saves"))) ;; don't litter my fs tree delete-old-versions t kept-new-versions 6 kept-old-versions 2 @@ -172,6 +212,16 @@ 'fullboth))))) (global-set-key [f11] 'toggle-fullscreen) +;; Automatically load smerge mode for merge files +(defun try-smerge-mode () + (save-excursion + (goto-char (point-min)) + (when (re-search-forward "^<<<<<<< " nil t) + (smerge-mode 1)))) +(add-hook 'find-file-hook 'try-smerge-mode t) + + +;; All my weird mode-specific settings ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (add-hook 'text-mode-hook 'turn-on-auto-fill) @@ -202,12 +252,10 @@ (set (make-local-variable 'tab-width) 4) )) +(add-hook 'php-mode-hook + '(lambda() + (c-set-offset 'cpp-macro 0) + )) + (add-to-list 'auto-mode-alist '("PKGBUILD" . sh-mode)) (add-to-list 'auto-mode-alist '("SRCBUILD" . sh-mode)) - -(defun try-smerge-mode () - (save-excursion - (goto-char (point-min)) - (when (re-search-forward "^<<<<<<< " nil t) - (smerge-mode 1)))) -(add-hook 'find-file-hook 'try-smerge-mode t) -- cgit v1.2.3