From 58a9e7cea375c91374826f8dd4743382225f2db1 Mon Sep 17 00:00:00 2001 From: Adam Goldsmith Date: Sun, 16 Aug 2015 21:32:07 -0400 Subject: [PATCH] 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 --- .emacs | 228 ++++++++---------- .../el-get-user/init-files/init-ace-window.el | 1 - .../init-files/init-arduino-mode.el | 3 - .emacs.d/el-get-user/init-files/init-avy.el | 4 - .../init-files/init-company-jedi.el | 4 - .../el-get-user/init-files/init-company.el | 7 - .../init-files/init-gnuplot-mode.el | 1 - .../el-get-user/init-files/init-hs-mode.el | 3 - .emacs.d/el-get-user/init-files/init-magit.el | 1 - .../init-files/init-markdown-mode.el | 7 - .../init-files/init-smart-mode-line.el | 7 - .../el-get-user/init-files/init-smarttabs.el | 1 - .emacs.d/el-get-user/init-files/init-smex.el | 4 - .../init-files/init-todotxt-mode.el | 2 - .../el-get-user/init-files/init-undo-tree.el | 2 - .../el-get-user/init-files/init-yasnippet.el | 1 - .emacs.d/el-get-user/recipies/jedi.rcp | 6 - .../el-get-user/recipies/kerboscript-mode.rcp | 5 - .emacs.d/el-get-user/recipies/scad-mode.rcp | 7 - .../init-files => }/init-hydra.el | 0 20 files changed, 100 insertions(+), 194 deletions(-) delete mode 100644 .emacs.d/el-get-user/init-files/init-ace-window.el delete mode 100644 .emacs.d/el-get-user/init-files/init-arduino-mode.el delete mode 100644 .emacs.d/el-get-user/init-files/init-avy.el delete mode 100644 .emacs.d/el-get-user/init-files/init-company-jedi.el delete mode 100644 .emacs.d/el-get-user/init-files/init-company.el delete mode 100644 .emacs.d/el-get-user/init-files/init-gnuplot-mode.el delete mode 100644 .emacs.d/el-get-user/init-files/init-hs-mode.el delete mode 100644 .emacs.d/el-get-user/init-files/init-magit.el delete mode 100644 .emacs.d/el-get-user/init-files/init-markdown-mode.el delete mode 100644 .emacs.d/el-get-user/init-files/init-smart-mode-line.el delete mode 100644 .emacs.d/el-get-user/init-files/init-smarttabs.el delete mode 100644 .emacs.d/el-get-user/init-files/init-smex.el delete mode 100644 .emacs.d/el-get-user/init-files/init-todotxt-mode.el delete mode 100644 .emacs.d/el-get-user/init-files/init-undo-tree.el delete mode 100644 .emacs.d/el-get-user/init-files/init-yasnippet.el delete mode 100644 .emacs.d/el-get-user/recipies/jedi.rcp delete mode 100644 .emacs.d/el-get-user/recipies/kerboscript-mode.rcp delete mode 100644 .emacs.d/el-get-user/recipies/scad-mode.rcp rename .emacs.d/{el-get-user/init-files => }/init-hydra.el (100%) diff --git a/.emacs b/.emacs index 2114d6f..4e934e8 100644 --- a/.emacs +++ b/.emacs @@ -1,150 +1,122 @@ ;; indentation (setq c-default-style "linux" - c-basic-offset 4 - sgml-basic-offset 4) + c-basic-offset 4 + sgml-basic-offset 4) (c-set-offset `inline-open 0) (setq-default tab-width 4) (add-hook 'sh-mode-hook (lambda () (setq tab-width 4))) ;; various options (setq compilation-scroll-output 1 - read-file-name-completion-ignore-case t - inhibit-startup-screen t - vc-follow-symlinks t) + read-file-name-completion-ignore-case t + inhibit-startup-screen t + vc-follow-symlinks t) (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)) + (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 "") '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 "") 'markdown-demote) + (local-set-key (kbd "S-") '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"))) diff --git a/.emacs.d/el-get-user/init-files/init-ace-window.el b/.emacs.d/el-get-user/init-files/init-ace-window.el deleted file mode 100644 index 5d5c341..0000000 --- a/.emacs.d/el-get-user/init-files/init-ace-window.el +++ /dev/null @@ -1 +0,0 @@ -(global-set-key (kbd "M-p") 'ace-window) diff --git a/.emacs.d/el-get-user/init-files/init-arduino-mode.el b/.emacs.d/el-get-user/init-files/init-arduino-mode.el deleted file mode 100644 index c64044e..0000000 --- a/.emacs.d/el-get-user/init-files/init-arduino-mode.el +++ /dev/null @@ -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)) diff --git a/.emacs.d/el-get-user/init-files/init-avy.el b/.emacs.d/el-get-user/init-files/init-avy.el deleted file mode 100644 index 4f65390..0000000 --- a/.emacs.d/el-get-user/init-files/init-avy.el +++ /dev/null @@ -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) diff --git a/.emacs.d/el-get-user/init-files/init-company-jedi.el b/.emacs.d/el-get-user/init-files/init-company-jedi.el deleted file mode 100644 index d22c546..0000000 --- a/.emacs.d/el-get-user/init-files/init-company-jedi.el +++ /dev/null @@ -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) diff --git a/.emacs.d/el-get-user/init-files/init-company.el b/.emacs.d/el-get-user/init-files/init-company.el deleted file mode 100644 index 41fe6a9..0000000 --- a/.emacs.d/el-get-user/init-files/init-company.el +++ /dev/null @@ -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 "") 'company-manual-begin) diff --git a/.emacs.d/el-get-user/init-files/init-gnuplot-mode.el b/.emacs.d/el-get-user/init-files/init-gnuplot-mode.el deleted file mode 100644 index ac24cc7..0000000 --- a/.emacs.d/el-get-user/init-files/init-gnuplot-mode.el +++ /dev/null @@ -1 +0,0 @@ -(setq auto-mode-alist (append '(("\\.gp$" . gnuplot-mode)) auto-mode-alist)) diff --git a/.emacs.d/el-get-user/init-files/init-hs-mode.el b/.emacs.d/el-get-user/init-files/init-hs-mode.el deleted file mode 100644 index 597feb1..0000000 --- a/.emacs.d/el-get-user/init-files/init-hs-mode.el +++ /dev/null @@ -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) diff --git a/.emacs.d/el-get-user/init-files/init-magit.el b/.emacs.d/el-get-user/init-files/init-magit.el deleted file mode 100644 index ec8daad..0000000 --- a/.emacs.d/el-get-user/init-files/init-magit.el +++ /dev/null @@ -1 +0,0 @@ -(global-set-key (kbd "C-x g") 'magit-status) diff --git a/.emacs.d/el-get-user/init-files/init-markdown-mode.el b/.emacs.d/el-get-user/init-files/init-markdown-mode.el deleted file mode 100644 index 1cbe135..0000000 --- a/.emacs.d/el-get-user/init-files/init-markdown-mode.el +++ /dev/null @@ -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 "") 'markdown-demote) - (local-set-key (kbd "S-") 'markdown-promote)) -(add-hook 'markdown-mode-hook '(lambda() (markdown-custom))) diff --git a/.emacs.d/el-get-user/init-files/init-smart-mode-line.el b/.emacs.d/el-get-user/init-files/init-smart-mode-line.el deleted file mode 100644 index 80106cb..0000000 --- a/.emacs.d/el-get-user/init-files/init-smart-mode-line.el +++ /dev/null @@ -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")) diff --git a/.emacs.d/el-get-user/init-files/init-smarttabs.el b/.emacs.d/el-get-user/init-files/init-smarttabs.el deleted file mode 100644 index a7c6173..0000000 --- a/.emacs.d/el-get-user/init-files/init-smarttabs.el +++ /dev/null @@ -1 +0,0 @@ -(smart-tabs-insinuate 'c 'c++ 'javascript 'python) diff --git a/.emacs.d/el-get-user/init-files/init-smex.el b/.emacs.d/el-get-user/init-files/init-smex.el deleted file mode 100644 index c0a7a29..0000000 --- a/.emacs.d/el-get-user/init-files/init-smex.el +++ /dev/null @@ -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) diff --git a/.emacs.d/el-get-user/init-files/init-todotxt-mode.el b/.emacs.d/el-get-user/init-files/init-todotxt-mode.el deleted file mode 100644 index 403893a..0000000 --- a/.emacs.d/el-get-user/init-files/init-todotxt-mode.el +++ /dev/null @@ -1,2 +0,0 @@ -(require 'todotxt-mode) -(setq todotxt-default-file (expand-file-name "~/Sync/todo/todo.txt")) diff --git a/.emacs.d/el-get-user/init-files/init-undo-tree.el b/.emacs.d/el-get-user/init-files/init-undo-tree.el deleted file mode 100644 index e78db7d..0000000 --- a/.emacs.d/el-get-user/init-files/init-undo-tree.el +++ /dev/null @@ -1,2 +0,0 @@ -(add-hook 'after-init-hook 'global-undo-tree-mode) -(global-set-key (kbd "M-/") 'undo-tree-visualize) diff --git a/.emacs.d/el-get-user/init-files/init-yasnippet.el b/.emacs.d/el-get-user/init-files/init-yasnippet.el deleted file mode 100644 index a237b49..0000000 --- a/.emacs.d/el-get-user/init-files/init-yasnippet.el +++ /dev/null @@ -1 +0,0 @@ -(yas-global-mode 1) diff --git a/.emacs.d/el-get-user/recipies/jedi.rcp b/.emacs.d/el-get-user/recipies/jedi.rcp deleted file mode 100644 index 4d413db..0000000 --- a/.emacs.d/el-get-user/recipies/jedi.rcp +++ /dev/null @@ -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)) diff --git a/.emacs.d/el-get-user/recipies/kerboscript-mode.rcp b/.emacs.d/el-get-user/recipies/kerboscript-mode.rcp deleted file mode 100644 index 182605f..0000000 --- a/.emacs.d/el-get-user/recipies/kerboscript-mode.rcp +++ /dev/null @@ -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)) diff --git a/.emacs.d/el-get-user/recipies/scad-mode.rcp b/.emacs.d/el-get-user/recipies/scad-mode.rcp deleted file mode 100644 index d191522..0000000 --- a/.emacs.d/el-get-user/recipies/scad-mode.rcp +++ /dev/null @@ -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)))) diff --git a/.emacs.d/el-get-user/init-files/init-hydra.el b/.emacs.d/init-hydra.el similarity index 100% rename from .emacs.d/el-get-user/init-files/init-hydra.el rename to .emacs.d/init-hydra.el