move from el-get to quelpa and use-package

reasoning: better update support, much cleaner .emacs (also flat, though
I could have done that with el-get).
also dropped a lot of code from .emacs that I might add back in later
This commit is contained in:
Adam Goldsmith 2015-08-16 21:32:07 -04:00
parent 9901af8897
commit 58a9e7cea3
20 changed files with 100 additions and 194 deletions

216
.emacs
View File

@ -14,137 +14,109 @@
(load-theme 'fred t) (load-theme 'fred t)
(savehist-mode 1) (savehist-mode 1)
(show-paren-mode 1) (show-paren-mode 1)
(when (display-graphic-p) (tool-bar-mode -1)
(tool-bar-mode -1))
;; Keybinds ;; save backups and autosaves in tmp
(setq backup-directory-alist `((".*" . ,temporary-file-directory))
auto-save-file-name-transforms `((".*" ,temporary-file-directory t)))
;; keybinds
(global-set-key (kbd "C-z") `recompile) (global-set-key (kbd "C-z") `recompile)
(global-set-key (kbd "C-S-z") `compile) (global-set-key (kbd "C-S-z") `compile)
;; save backups and autosaves in tmp ;; windmove keybinds
(setq backup-directory-alist
`((".*" . ,temporary-file-directory)))
(setq auto-save-file-name-transforms
`((".*" ,temporary-file-directory t)))
;; use windmove to move point with shift+arrow key
(when (fboundp 'windmove-default-keybindings) (when (fboundp 'windmove-default-keybindings)
(windmove-default-keybindings)) (windmove-default-keybindings))
;; define function for inserting today's date ;; install/load quelpa
(defun insert-date () (package-initialize)
(interactive) (unless (require 'quelpa nil t)
(insert (format-time-string "%Y.%m.%d"))) (with-temp-buffer
(url-insert-file-contents "https://raw.github.com/quelpa/quelpa/master/bootstrap.el")
(eval-buffer)))
;; load el-get ;; hopefully temporary: install specific commit of use-package
(add-to-list 'load-path "~/.emacs.d/el-get/el-get") (quelpa '(use-package
(unless (require 'el-get nil 'noerror) :fetcher github
(with-current-buffer :repo "jwiegley/use-package"
(url-retrieve-synchronously :files ("use-package.el")
"https://raw.githubusercontent.com/dimitri/el-get/master/el-get-install.el") :commit "7154ad996d2468c468b6206fb132e18b12c3ffd2"))
(goto-char (point-max))
(eval-print-last-sexp))
(el-get-elpa-build-local-recipes))
(add-to-list 'el-get-recipe-path "~/.emacs.d/el-get-user/recipies") ;; install quelpa-use-package
(setq el-get-user-package-directory "~/.emacs.d/el-get-user/init-files") (quelpa '(quelpa-use-package
(setq my-packages-core :fetcher github
'(el-get :repo "quelpa/quelpa-use-package"))
smart-mode-line (require 'quelpa-use-package)
avy
smex
ace-window
company
hideif
undo-tree
hydra
multiple-cursors))
(setq my-packages-extra
'(company-quickhelp
pos-tip
tramp
magit
lua-mode
pkgbuild-mode
arduino-mode
gnuplot-mode
csharp-mode
markdown-mode
todotxt-mode
php-mode
scad-mode
qml-mode
smarttabs
jedi
company-jedi))
;;auctex))
(el-get-cleanup (append my-packages-core my-packages-extra))
(el-get 'sync my-packages-core)
(el-get 'sync)
;;allow saving files that need root ;; external packages (required)
(defun find-file-as-root(buffer) (use-package company :quelpa
"use sudo to open a file" :config
(interactive "FFind file as root: ") (global-company-mode)
(find-file (concat "/sudo::" buffer))) (setq company-idle-delay 0.1
(global-set-key (kbd "C-x C-S-f") `find-file-as-root) company-dabbrev-downcase nil
company-dabbrev-ignore-case nil
company-clang-arguments (quote ("-I/usr/include" "-I/usr/arm-frc-linux-gnueabi/include/")))
(global-set-key (kbd "<C-tab>") 'company-manual-begin))
(use-package smart-mode-line :quelpa
:config
(setq sml/no-confirm-load-theme t)
(sml/setup)
(sml/apply-theme 'respectful)
(add-to-list 'sml/replacer-regexp-list '("^~/Programs/" ":Prog:") t)
(add-to-list 'sml/replacer-regexp-list '("^:Doc:Google Drive/" ":GDrive:") t)
(add-to-list 'sml/replacer-regexp-list '("^:GDrive:Dublin2014-2015/" ":Dublin:") t)
(setq rm-blacklist '(" company" " Undo-Tree")))
(use-package avy :quelpa
:config
(eval-after-load "isearch"
'(define-key isearch-mode-map (kbd "C-'") 'avy-isearch))
:bind ("C-;" . avy-goto-char)
:bind ("C-'" . avy-goto-char-2))
(use-package smex :quelpa
:bind ("M-x" . smex)
:bind ("M-X" . smex-major-mode-commands)
:config (global-set-key (kbd "C-c C-c M-x") 'execute-extended-command)) ;;normal M-x.
(use-package ace-window :quelpa
:bind ("M-p" . ace-window))
(use-package undo-tree :quelpa
:config
(global-undo-tree-mode)
:bind ("M-/" . undo-tree-visualize))
(use-package hydra :quelpa
:config
;config is in separate file because it is really big
(load-file "~/.emacs.d/init-hydra.el"))
(use-package multiple-cursors :quelpa)
(use-package company-quickhelp :quelpa)
(use-package magit :quelpa
:bind ("C-x g" . magit-status))
(defadvice save-buffer (around save-buffer-as-root-around activate)
"Use sudo to save the current buffer."
(interactive "p")
(if (and (buffer-file-name) (not (file-writable-p (buffer-file-name))))
(let ((buffer-file-name (format "/sudo::%s" buffer-file-name)))
ad-do-it)
ad-do-it))
;; c++ headers insertion ;; optional external packages
(defun c++-headers () (use-package arduino-mode
(interactive) :mode "\\.pde\\'"
(if (buffer-file-name) :mode "\\.ino\\'")
(let* (use-package company-jedi
((fName (upcase (file-name-nondirectory (file-name-sans-extension buffer-file-name)))) :config
(ifDef (concat "#ifndef " fName "_H" "\n#define " fName "_H" "\n")) (add-hook 'python-mode-hook (lambda() (add-to-list 'company-backends 'company-jedi))))
(line 3) ;TODO: Make this better (use-package csharp-mode)
) (use-package gnuplot-mode
(progn :mode ("\\.gp$" . gnuplot-mode))
;If less then 5 characters are in the buffer, insert the class definition (use-package lua-mode)
(if (< (- (point-max) (point-min)) 5 ) (use-package markdown-mode
(progn :config
(insert "\nclass " (capitalize fName) "{\npublic:\n\nprivate:\n\n};\n") (setq markdown-command "markdown_py -x markdown.extensions.wikilinks -x markdown.extensions.smarty -x markdown.extensions.extra -x latex -x markdown.extensions.sane_lists -x markdown.extensions.toc -x markdown_checklist.extension -c ~/markdownConfig.yml"
(setq line 6) markdown-enable-math t)
) (local-set-key (kbd "<tab>") 'markdown-demote)
) (local-set-key (kbd "S-<tab>") 'markdown-promote)
;Insert the Header Guard :mode "\\.md\\'")
(goto-char (point-min)) (use-package php-mode)
(insert ifDef) (use-package pkgbuild-mode)
(goto-char (point-max)) (use-package qml-mode)
(insert "\n#endif" " //" fName "_H") (use-package scad-mode)
(goto-line line)) (use-package smarttabs
) :config
;else (smart-tabs-insinuate 'c 'c++ 'javascript))
(message (concat "Buffer " (buffer-name) " must have a filename")) (use-package todotxt-mode
) :config
) (setq todotxt-default-file (expand-file-name "~/Sync/todo/todo.txt")))
(eval-after-load "cc-mode"
'(progn
(define-key c-mode-map (kbd "C-c o") 'ff-find-other-file)
(define-key c++-mode-map (kbd "C-c o") 'ff-find-other-file)
(define-key c-mode-map (kbd "C-c h") 'c++-headers)
(define-key c++-mode-map (kbd "C-c h") 'c++-headers)))
(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.
'(safe-local-variable-values
(quote
((company-clang-arguments "-I/usr/include" "-I/usr/arm-frc-linux-gnueabi/include/")))))
(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.
)

View File

@ -1 +0,0 @@
(global-set-key (kbd "M-p") 'ace-window)

View File

@ -1,3 +0,0 @@
;; Arduino mode autoload
(add-to-list 'auto-mode-alist '("\\.pde\\'" . arduino-mode))
(add-to-list 'auto-mode-alist '("\\.ino\\'" . arduino-mode))

View File

@ -1,4 +0,0 @@
(eval-after-load "isearch"
'(define-key isearch-mode-map (kbd "C-'") 'avy-isearch))
(global-set-key (kbd "C-;") 'avy-goto-char)
(global-set-key (kbd "C-'") 'avy-goto-char-2)

View File

@ -1,4 +0,0 @@
(defun my/python-mode-hook ()
(add-to-list 'company-backends 'company-jedi))
(add-hook 'python-mode-hook 'my/python-mode-hook)

View File

@ -1,7 +0,0 @@
;; load company mode
(add-hook 'after-init-hook 'global-company-mode)
(setq company-idle-delay 0.1
company-dabbrev-downcase nil
company-dabbrev-ignore-case nil
company-clang-arguments (quote ("-I/usr/include" "-I/usr/arm-frc-linux-gnueabi/include/")))
(global-set-key (kbd "<C-tab>") 'company-manual-begin)

View File

@ -1 +0,0 @@
(setq auto-mode-alist (append '(("\\.gp$" . gnuplot-mode)) auto-mode-alist))

View File

@ -1,3 +0,0 @@
(global-set-key (kbd "C-c C-x h") `hs-hide-block)
(global-set-key (kbd "C-c C-x s") `hs-show-block)
(global-set-key (kbd "C-c C-x l") `hs-hide-level)

View File

@ -1 +0,0 @@
(global-set-key (kbd "C-x g") 'magit-status)

View File

@ -1,7 +0,0 @@
(defun markdown-custom ()
"markdown-mode-hook"
(setq markdown-command "markdown_py -x markdown.extensions.wikilinks -x markdown.extensions.smarty -x markdown.extensions.extra -x latex -x markdown.extensions.sane_lists -x markdown.extensions.toc -x markdown_checklist.extension -c ~/markdownConfig.yml"
markdown-enable-math t)
(local-set-key (kbd "<tab>") 'markdown-demote)
(local-set-key (kbd "S-<tab>") 'markdown-promote))
(add-hook 'markdown-mode-hook '(lambda() (markdown-custom)))

View File

@ -1,7 +0,0 @@
(setq sml/no-confirm-load-theme t)
(sml/setup)
(sml/apply-theme 'respectful)
(add-to-list 'sml/replacer-regexp-list '("^~/Programs/" ":Prog:") t)
(add-to-list 'sml/replacer-regexp-list '("^:Doc:Google Drive/" ":GDrive:") t)
(add-to-list 'sml/replacer-regexp-list '("^:GDrive:Dublin2014-2015/" ":Dublin:") t)
(setq rm-blacklist '(" company" " Undo-Tree"))

View File

@ -1 +0,0 @@
(smart-tabs-insinuate 'c 'c++ 'javascript 'python)

View File

@ -1,4 +0,0 @@
(global-set-key (kbd "M-x") 'smex)
(global-set-key (kbd "M-X") 'smex-major-mode-commands)
;; This is your old M-x.
(global-set-key (kbd "C-c C-c M-x") 'execute-extended-command)

View File

@ -1,2 +0,0 @@
(require 'todotxt-mode)
(setq todotxt-default-file (expand-file-name "~/Sync/todo/todo.txt"))

View File

@ -1,2 +0,0 @@
(add-hook 'after-init-hook 'global-undo-tree-mode)
(global-set-key (kbd "M-/") 'undo-tree-visualize)

View File

@ -1 +0,0 @@
(yas-global-mode 1)

View File

@ -1,6 +0,0 @@
(:name jedi
:description "An awesome Python auto-completion for Emacs"
:type github
:pkgname "tkf/emacs-jedi"
:submodule nil
:depends (epc python-environment))

View File

@ -1,5 +0,0 @@
(:name kerboscript-mode
:description "basic syntax highlighting for kOS's scripting language kerboscript"
:type github
:pkgname "frosch03/kerboscript-mode"
:after (require 'kerboscript-mode))

View File

@ -1,7 +0,0 @@
(:name scad-mode
:type http
:description "OpenSCAD Mode"
:url "https://raw.githubusercontent.com/openscad/openscad/3c3ac52576297c5bc4b8bacce83f69fa33c730b9/contrib/scad-mode.el"
:after (progn
(autoload 'scad-mode "scad-mode" "Major mode for editing SCAD code." t)
(add-to-list 'auto-mode-alist '("\\.scad$" . scad-mode))))