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)
(savehist-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-S-z") `compile)
;; save backups and autosaves in tmp
(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
;; windmove keybinds
(when (fboundp 'windmove-default-keybindings)
(windmove-default-keybindings))
;; define function for inserting today's date
(defun insert-date ()
(interactive)
(insert (format-time-string "%Y.%m.%d")))
;; install/load quelpa
(package-initialize)
(unless (require 'quelpa nil t)
(with-temp-buffer
(url-insert-file-contents "https://raw.github.com/quelpa/quelpa/master/bootstrap.el")
(eval-buffer)))
;; load el-get
(add-to-list 'load-path "~/.emacs.d/el-get/el-get")
(unless (require 'el-get nil 'noerror)
(with-current-buffer
(url-retrieve-synchronously
"https://raw.githubusercontent.com/dimitri/el-get/master/el-get-install.el")
(goto-char (point-max))
(eval-print-last-sexp))
(el-get-elpa-build-local-recipes))
;; hopefully temporary: install specific commit of use-package
(quelpa '(use-package
:fetcher github
:repo "jwiegley/use-package"
:files ("use-package.el")
:commit "7154ad996d2468c468b6206fb132e18b12c3ffd2"))
(add-to-list 'el-get-recipe-path "~/.emacs.d/el-get-user/recipies")
(setq el-get-user-package-directory "~/.emacs.d/el-get-user/init-files")
(setq my-packages-core
'(el-get
smart-mode-line
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)
;; install quelpa-use-package
(quelpa '(quelpa-use-package
:fetcher github
:repo "quelpa/quelpa-use-package"))
(require 'quelpa-use-package)
;;allow saving files that need root
(defun find-file-as-root(buffer)
"use sudo to open a file"
(interactive "FFind file as root: ")
(find-file (concat "/sudo::" buffer)))
(global-set-key (kbd "C-x C-S-f") `find-file-as-root)
;; external packages (required)
(use-package company :quelpa
:config
(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))
(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
(defun c++-headers ()
(interactive)
(if (buffer-file-name)
(let*
((fName (upcase (file-name-nondirectory (file-name-sans-extension buffer-file-name))))
(ifDef (concat "#ifndef " fName "_H" "\n#define " fName "_H" "\n"))
(line 3) ;TODO: Make this better
)
(progn
;If less then 5 characters are in the buffer, insert the class definition
(if (< (- (point-max) (point-min)) 5 )
(progn
(insert "\nclass " (capitalize fName) "{\npublic:\n\nprivate:\n\n};\n")
(setq line 6)
)
)
;Insert the Header Guard
(goto-char (point-min))
(insert ifDef)
(goto-char (point-max))
(insert "\n#endif" " //" fName "_H")
(goto-line line))
)
;else
(message (concat "Buffer " (buffer-name) " must have a filename"))
)
)
(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.
)
;; optional external packages
(use-package arduino-mode
:mode "\\.pde\\'"
:mode "\\.ino\\'")
(use-package company-jedi
:config
(add-hook 'python-mode-hook (lambda() (add-to-list 'company-backends 'company-jedi))))
(use-package csharp-mode)
(use-package gnuplot-mode
:mode ("\\.gp$" . gnuplot-mode))
(use-package lua-mode)
(use-package markdown-mode
:config
(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)
:mode "\\.md\\'")
(use-package php-mode)
(use-package pkgbuild-mode)
(use-package qml-mode)
(use-package scad-mode)
(use-package smarttabs
:config
(smart-tabs-insinuate 'c 'c++ 'javascript))
(use-package todotxt-mode
:config
(setq todotxt-default-file (expand-file-name "~/Sync/todo/todo.txt")))

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))))