diff options
author | Luke Shumaker <lukeshu@lukeshu.com> | 2017-02-11 18:23:08 -0500 |
---|---|---|
committer | Luke Shumaker <lukeshu@sbcglobal.net> | 2017-02-11 18:27:06 -0500 |
commit | b4209c316c27c49cebabe51804376640656d6e78 (patch) | |
tree | 358669f404b4f6cd3c1546c16909d0c78ee426b5 /.config/emacs/init.el | |
parent | 25ff8d52b6420a6bd3b43acb5d5b9a674f49af5d (diff) |
emacs: migrate to use-package
Diffstat (limited to '.config/emacs/init.el')
-rw-r--r-- | .config/emacs/init.el | 167 |
1 files changed, 67 insertions, 100 deletions
diff --git a/.config/emacs/init.el b/.config/emacs/init.el index f1650a4..8d8859e 100644 --- a/.config/emacs/init.el +++ b/.config/emacs/init.el @@ -45,107 +45,79 @@ (set-face-attribute 'default nil :height 80) -;;;; Bootstrap el-get ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -;; This downloads and installs el-get (package management) if isn't -;; installed. +;;;; Package management ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -;; Derived from ELPA installation -;; http://tromey.com/elpa/install.html -(defun eval-url (url) - (let ((buffer (url-retrieve-synchronously url))) - (save-excursion - (set-buffer buffer) - (goto-char (point-min)) - (re-search-forward "^$" nil 'move) - (eval-region (point) (point-max)) - (kill-buffer (current-buffer))))) - -(add-to-list 'load-path (concat el-get-dir "el-get")) -(unless (require 'el-get nil t) - (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 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-based programming for what -;; to do once a package is loaded, using :after. - -;; For some reason, el-get adds a bunch of 3rd-party repos to -;; package-archives. I guess I'm ok with that? I don't have to -;; manage them. +;; package.el +(require 'package) +(add-to-list 'package-archives '("melpa" . "http://melpa.org/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 '( - ;; 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 - :before (advice-add 'page-break-lines-mode-maybe - :override #'page-break-lines-mode) - :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 bison-mode :type elpa) - (:name coffee-mode :type elpa - :after (add-hook 'coffee-mode-hook +(package-initialize) +;; use-package.el +(setq use-package-always-ensure t) +(add-to-list 'load-path (concat user-emacs-directory "use-package")) +(require 'use-package) +(require 'bind-key) + +;; Minor modes +(use-package dtrt-indent ;; Detect indent style for existing files + :config (dtrt-indent-mode 1)) +(use-package page-break-lines ;; Display form-feeds pretty + :init (advice-add 'page-break-lines-mode-maybe + :override #'page-break-lines-mode) + :config (global-page-break-lines-mode 1)) +(use-package smart-tabs-mode ;; Indent with tabs, align with spaces + :config (progn + (smart-tabs-mode 1) + (apply 'smart-tabs-insinuate + (mapcar 'car smart-tabs-insinuate-alist)))) +;; Major modes +(use-package bison-mode + :mode (("\\.l\\'" . bison-mode) + ("\\.y\\'" . bison-mode) + ("\\.jison\\'" . jison-mode))) +(use-package coffee-mode + :mode ("\\.coffee\\'" + "\\.iced\\'" + "\\Cakefile\\'" + "\\.cson\\'") + :interpreter "coffee" + :config (add-hook 'coffee-mode-hook '(lambda () (set (make-local-variable 'tab-width) 2) (set (make-local-variable 'indent-tabs-mode) nil) ))) - (:name glsl-mode :type elpa) - (:name go-mode :type elpa) - (:name graphviz-dot-mode :type elpa) - (:name haml-mode :type elpa) - (:name markdown-mode :type elpa - :after (add-to-list 'auto-mode-alist '("\\.ronn\\'" . markdown-mode))) - (:name mediawiki :type elpa) - (:name nginx-mode :type elpa - :after (put 'nginx-indent-level 'safe-local-variable 'integerp)) - (:name scss-mode :type elpa) - (:name yaml-mode :type elpa) - )) -;; What packages el-get should install, both from above, and its -;; internal list of sources. -(el-get 'sync (append - '(el-get) - ;; Minor modes - '(dtrt-indent - page-break-lines - smart-tabs-mode - ) - ;; Major modes - (if (file-exists-p "~/Maildir") ; wanderlust is huge, only use on emailing boxes - '(apel flim semi wanderlust) - '()) - '( - ;;nxhtml ; nxhtml is invasive, only enable if actively using - bison-mode - coffee-mode - glsl-mode - go-mode - graphviz-dot-mode - haml-mode - markdown-mode - yaml-mode - mediawiki - nginx-mode - php-mode-improved - scss-mode - yaml-mode - ))) +;;(use-package php-mode-improved +;; :mode (("\\.php[s34]?\\'" . php-mode) +;; ("\\.phtml\\'" . php-mode) +;; ("\\.inc\\'" . php-mode)) +;; :config (add-hook 'php-mode-hook +;; '(lambda () +;; (c-set-offset 'cpp-macro 0) +;; ))) +(use-package php-mode :mode ("\\.php[s345t]?\\'" "/\\.php_cs\\(\\.dist\\)?\\'" "\\.phtml\\'" "/Amkfile\\'" "\\.amk\\'")) +(use-package glsl-mode :mode ("\\.vert\\'" "\\.frag\\'" "\\.geom\\'" "\\.glsl\\'")) +(use-package go-mode :mode "\\.go\\'") +(use-package graphviz-dot-mode :mode ("\\.dot\\'" "\\.gv\\'")) +(use-package haml-mode :mode "\\.haml\\'") +(use-package less-css-mode :mode "\\.less\\'") +(use-package markdown-mode :mode ("\\.markdown\\'" "\\.md\\'" "\\.ronn\\'")) +(use-package nginx-mode :mode ("nginx\\.conf\\'" "/nginx/.+\\.conf\\'")) +(use-package scss-mode :mode "\\.scss\\'") +(use-package yaml-mode :mode "\\.e?ya?ml\\'") + +;;(use-package nxhtml) ; nxhtml is invasive, only enable if actively using + +(if (file-exists-p "~/Maildir") + ;;'(apel flim semi wanderlust) + (use-package wanderlust + :config (progn + (define-mail-user-agent + 'wl-user-agent + 'wl-user-agent-compose + 'wl-draft-send + 'wl-draft-kill + 'mail-send-hook) + (setq mail-user-agent 'wl-user-agent)))) ;; Misc. crap @@ -314,11 +286,6 @@ sh-script.el is broken." (set (make-local-variable 'tab-width) 4) )) -(add-hook 'php-mode-hook - '(lambda () - (c-set-offset 'cpp-macro 0) - )) - (add-hook 'tex-mode-hook '(lambda () (set (make-local-variable 'tab-always-indent) nil) |