From 166ae52efa43e3af5226db918c473cfd94d911ce Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Tue, 22 Apr 2014 14:51:25 +0100 Subject: Emacs: use req-package on top of use-package --- tag-emacs/emacs.d/Cask | 1 + tag-emacs/emacs.d/init.el | 180 ++++++++++++++++++++++++---------------------- 2 files changed, 96 insertions(+), 85 deletions(-) (limited to 'tag-emacs/emacs.d') diff --git a/tag-emacs/emacs.d/Cask b/tag-emacs/emacs.d/Cask index 1d458ef..5df9a3d 100644 --- a/tag-emacs/emacs.d/Cask +++ b/tag-emacs/emacs.d/Cask @@ -47,6 +47,7 @@ (depends-on "puppet-mode") (depends-on "quickrun") (depends-on "redshank") +(depends-on "req-package") (depends-on "s") (depends-on "skewer-mode") (depends-on "smart-tab") diff --git a/tag-emacs/emacs.d/init.el b/tag-emacs/emacs.d/init.el index 484dff8..e1c9c26 100644 --- a/tag-emacs/emacs.d/init.el +++ b/tag-emacs/emacs.d/init.el @@ -32,15 +32,15 @@ (require 'cask) (cask-initialize) -(require 'use-package) -(use-package pallet) +(require 'req-package) +(req-package pallet) ;;;; Style -(use-package linum +(req-package linum :config (setq linum-format " %4d ")) -(use-package whitespace +(req-package whitespace :config (setq whitespace-style '(face space @@ -62,7 +62,7 @@ jit-lock-chunk-size 1000 jit-lock-defer-time 0.01) -(use-package solarized-theme +(req-package solarized-theme :config (load-theme 'solarized-light t)) (when (or (display-graphic-p) @@ -181,7 +181,7 @@ ;;;; Buffers -(use-package ibuffer +(req-package ibuffer :bind (("C-x C-b" . ibuffer)) :config (progn (setq ibuffer-saved-filter-groups @@ -212,19 +212,19 @@ " " filename-and-process))))) -(use-package uniquify +(req-package uniquify :config (progn (setq uniquify-buffer-name-style 'reverse uniquify-separator "/" uniquify-after-kill-buffer-p t uniquify-ignore-buffers-re "^\\*"))) -(use-package fancy-narrow +(req-package fancy-narrow :config (fancy-narrow-mode 1)) ;;;; Communication -(use-package erc +(req-package erc :config (progn (setq erc-user-full-name "Alan Pearce" erc-email-userid "alan@alanpearce.co.uk" @@ -247,13 +247,13 @@ (setq completion-styles '(basic initials partial-completion substring) completion-ignore-case t) -(use-package smart-tab +(req-package smart-tab :init (global-smart-tab-mode) :config (progn (nconc smart-tab-completion-functions-alist '((php-mode . php-complete-function))) (diminish 'smart-tab-mode ""))) -(use-package company +(req-package company :commands (company-mode) :bind (("C-" . company-complete)) :init (progn @@ -263,7 +263,7 @@ ;;;; Dates & Times -(use-package calendar +(req-package calendar :config (progn (setq calendar-week-start-day 1) (calendar-set-date-style 'iso))) @@ -279,9 +279,8 @@ (insert (format-time-string format)))) ;;;; Directory browsing -(use-package dired +(req-package dired :config (progn - (use-package dired-x) (bind-key "" #'dired-find-file dired-mode-map) (bind-key "^" (lambda () (interactive) (find-alternate-file "..")) dired-mode-map) (setq dired-dwim-target t @@ -292,7 +291,11 @@ (setq insert-directory-program "/usr/local/bin/gls")) (put 'dired-find-alternate-file 'disabled nil))) -(use-package dired+ +(req-package dired-x + :require dired) + +(req-package dired+ + :require dired :config (progn (diredp-toggle-find-file-reuse-dir 1) (dired-omit-mode 1) @@ -300,7 +303,7 @@ ;;;; Documentation -(use-package which-func +(req-package which-func :init (which-function-mode) :config (setq which-func-modes t)) @@ -344,16 +347,16 @@ (kill-buffer buffer) (message "File '%s' successfully removed" filename))))) -(use-package recentf +(req-package recentf :init (progn (setq recentf-auto-cleanup 'never recentf-save-file (expand-file-name "recentf" user-emacs-directory)) (recentf-mode 1))) -(use-package saveplace +(req-package saveplace :config (progn (setq-default save-place t) (setq save-place-file (expand-file-name ".saveplace" user-emacs-directory)))) -(use-package tramp +(req-package tramp :config (progn (setq tramp-default-method (if (eq system-type 'windows-nt) "plinkx" "ssh") tramp-default-user-alist '(("\\`su\\(do\\)?\\'" nil "root") (nil nil "alan")) @@ -369,12 +372,13 @@ (add-to-list 'tramp-default-proxies-alist '("localhost" nil nil)) (add-to-list 'tramp-default-proxies-alist '("router" nil nil)))) -(use-package tramp-sh +(req-package tramp-sh + :require tramp :config (progn (add-to-list 'tramp-remote-path "/usr/local/sbin") (add-to-list 'tramp-remote-path "~/bin"))) -(use-package ediff +(req-package ediff :config (progn (setq ediff-split-window-function 'split-window-horizontally ediff-window-setup-function 'ediff-setup-windows-plain))) @@ -390,7 +394,7 @@ '(4 8 12 16 20 24 28 32 36 40 44 48 52 56 60 64 68 72 76 80 84 88 92 96 100 104 108 112 116 120) tab-always-indent 'complete) -(use-package auto-indent-mode +(req-package auto-indent-mode :commands (auto-indent-minor-mode auto-indent-mode) :config (progn @@ -407,7 +411,7 @@ (set (make-local-variable 'auto-indent-assign-indent-level) 2)) (add-hook 'lisp-common-mode-hook #'lisp-auto-indent-mode))) -(use-package smart-tabs-mode +(req-package smart-tabs-mode :commands (smart-tabs-mode smart-tabs-mode-enable smart-tabs-advice) @@ -457,7 +461,7 @@ (set-register ?e `(file . ,*init-file*)) (set-register ?z `(file . ,(expand-file-name ".zshrc" "~"))) -(use-package discover +(req-package discover :config (global-discover-mode)) ;; Enable narrowing functions C-x n @@ -474,12 +478,12 @@ (defalias 'exit-emacs #'delete-frame) (defalias 'exit-emacs #'save-buffers-kill-emacs)) -(use-package helm-config +(req-package helm-config :bind (("C-x i" . helm-imenu)) :config (setq helm-idle-delay .1 helm-input-idle-delay .1)) -(use-package ido +(req-package ido :bind (("C-x b" . ido-switch-buffer)) :init (progn (setq ido-save-directory-list-file (expand-file-name "ido-state" user-emacs-directory)) @@ -504,14 +508,17 @@ (bind-key "s-x b" #'ap/ido-projectile-switch-buffer-dwim) (bind-key "s-x s-b" #'ap/ido-projectile-switch-buffer-dwim) -(use-package ido-vertical-mode +(req-package ido-vertical-mode + :require ido :config (ido-vertical-mode 1)) -(use-package flx-ido +(req-package flx-ido + :require ido :init (progn (flx-ido-mode 1))) -(use-package smex +(req-package smex + :require ido :bind (("M-x" . smex) ("" . smex) ("" . smex) @@ -542,37 +549,37 @@ (add-to-list 'auto-mode-alist '("\\.target\\'" . conf-mode)) (add-to-list 'auto-mode-alist '("\\.socket\\'" . conf-mode)) -(use-package xrdb-mode +(req-package xrdb-mode :mode (("\\.Xdefaults\\'" . xrdb-mode) ("\\.Xresources\\'" . xrdb-mode))) -(use-package haskell-mode +(req-package haskell-mode :mode (("\\.hs\\'" . haskell-mode) ("xmobarrc\\'" . haskell-mode))) -(use-package nginx-mode +(req-package nginx-mode :mode (("nginx.conf" . nginx-mode))) -(use-package lua-mode +(req-package lua-mode :mode (("\\.lua\\'" . lua-mode))) -(use-package puppet-mode +(req-package puppet-mode :mode (("\\.pp\\'" . puppet-mode)) :config (progn (add-hook 'puppet-mode-hook #'autopair-mode))) -(use-package ruby-mode +(req-package ruby-mode :mode (("\\.rb\\'" . ruby-mode) ("\\.cap\\'" . ruby-mode))) -(use-package yaml-mode +(req-package yaml-mode :mode (("/group_vars/.*" . yaml-mode) ("/host_vars/.*" . yaml-mode) ("\\.sls\\'" . yaml-mode))) ;;;; Planning -(use-package org +(req-package org :bind (("C-c C-a" . org-agenda-list) ("C-c a" . org-agenda) ("C-c l" . org-store-link)) @@ -625,13 +632,14 @@ (if (looking-at (concat " +" org-todo-regexp "\\( +\\|[ \t]*$\\)")) (org-todo "STARTED"))))))) -(use-package org-journal +(req-package org-journal + :require org :config (progn (setq org-journal-date-format "%A, %d %B %Y"))) ;;;; Programming -(use-package cedet +(req-package cedet :disabled t :config (progn (semantic-load-enable-code-helpers) @@ -640,12 +648,12 @@ (global-semantic-show-unmatched-syntax-mode t) (global-semantic-decoration-mode t))) -(use-package flycheck +(req-package flycheck :init (global-flycheck-mode)) ;;;; Projects -(use-package projectile +(req-package projectile :bind (("C-c C-f" . projectile-find-file) ("s-x s-f" . projectile-find-file)) :init (projectile-global-mode) @@ -653,16 +661,16 @@ (setq projectile-switch-project-action #'projectile-dired projectile-remember-window-configs t))) -(use-package vc +(req-package vc :config (progn (setq vc-follow-symlinks t))) -(use-package diff-hl +(req-package diff-hl :init (progn (global-diff-hl-mode) (add-hook 'magit-refresh-file-buffer-hook #'diff-hl-update))) -(use-package magit +(req-package magit :commands (magit-status) :bind (("C-x g" . magit-status) ("s-G" . magit-status)) @@ -675,7 +683,7 @@ ;; If aspell is too slow ;; If it is still too slow, use ‘ultra’ instead of ‘fast’ ;; (setq ispell-extra-args '(" --sug-mode=fast")) -(use-package ispell +(req-package ispell :bind (("" . ispell-word))) ;;;; Scripting @@ -683,21 +691,21 @@ (add-hook 'after-save-hook #'executable-make-buffer-file-executable-if-script-p) -(use-package sh-script +(req-package sh-script :mode (("\\.zsh\\'" . shell-script-mode)) :config (setq sh-shell-file "/usr/bin/env zsh")) -(use-package ntcmd +(req-package ntcmd :mode (("\\`.cmd\\'" . ntcmd-mode) ("\\`.bat\\'" . ntcmd-mode))) ;;;; Shells & REPLs -(use-package eshell +(req-package eshell :bind ("C-c s" . eshell) :config (progn (setq eshell-directory-name "~/.emacs.d/eshell") - (use-package em-smart + (req-package em-smart :init (progn (setq eshell-where-to-jump 'begin eshell-review-quick-commands nil @@ -712,11 +720,11 @@ (eshell/cd dir))) (bind-key "C-c S" #'eshell-goto-current-dir) -(use-package shell +(req-package shell :config (define-key shell-mode-map (kbd "C-d") 'comint-delchar-or-eof-or-kill-buffer)) -(use-package multi-term +(req-package multi-term :if (not (eq system-type 'windows-nt)) :bind ("C-`" . multi-term-dedicated-toggle)) @@ -745,14 +753,14 @@ (bind-key "S-SPC" #'set-mark-command) -(use-package subword +(req-package subword :init (global-subword-mode t)) -(use-package misc +(req-package misc :bind (("M-z" . zap-up-to-char) ("M-Z" . zap-to-char))) -(use-package ap-functions +(req-package ap-functions :commands (ap/remove-extra-cr) :bind (("C-x r M-w" . copy-rectangle) ("M-!" . shell-execute))) @@ -760,14 +768,14 @@ (when (boundp 'x-select-request-type) (setq x-select-request-type '(UTF8_STRING COMPOUND_TEXT TEXT STRING))) -(use-package ace-jump-mode +(req-package ace-jump-mode :bind (("C-c SPC" . ace-jump-mode)) :config (progn (ace-jump-mode-enable-mark-sync) (setq ace-jump-word-mode-use-query-char nil ace-jump-mode-scope 'window))) -(use-package autopair +(req-package autopair :commands (autopair-mode autopair-on) :init (progn @@ -778,13 +786,13 @@ (setq autopair-blink nil autopair-skip-whitespace nil))) -(use-package expand-region +(req-package expand-region :bind ("C-M-SPC" . er/expand-region)) -(use-package goto-chg +(req-package goto-chg :bind ("C-x SPC" . goto-last-change)) -(use-package multiple-cursors +(req-package multiple-cursors :config (progn (bind-key "C-." #'mc/mark-next-like-this) (bind-key "C-," #'mc/mark-previous-like-this) @@ -792,11 +800,11 @@ (bind-key "C-" #'mc/mark-more-like-this-extended) (bind-key "C-S-L" #'mc/edit-lines))) -(use-package eldoc +(req-package eldoc :config (progn (eldoc-add-command 'paredit-backward-delete 'paredit-close-round))) -(use-package paredit +(req-package paredit :commands (paredit-mode) :init (progn (add-hook 'lisp-common-mode-hook #'enable-paredit-mode) @@ -808,17 +816,17 @@ (if (eq this-command 'eval-expression) (paredit-mode 1))))) -(use-package shuffle-lines +(req-package shuffle-lines :bind (("C-S-" . move-line-up) ("C-S-" . move-line-down))) -(use-package smart-forward +(req-package smart-forward :bind (("C-M-u" . smart-up) ("C-M-d" . smart-down) ("C-M-p" . smart-backward) ("C-M-n" . smart-forward))) -(use-package undo-tree +(req-package undo-tree :config (progn (global-undo-tree-mode) ;; Keep region when undoing in region @@ -834,7 +842,7 @@ ad-do-it))) :diminish undo-tree-mode) -(use-package visual-regexp +(req-package visual-regexp :bind (("C-c r" . vr/replace) ("C-c q" . vr/query-replace) ("C-c m" . vc/mc-mark))) @@ -857,22 +865,22 @@ (add-hook 'lisp-mode-hook #'ap/lisp-setup) (add-hook 'lisp-mode-hook #'set-common-lisp-indentation) -(use-package elisp-slime-nav +(req-package elisp-slime-nav :commands elisp-slime-nav-mode :diminish elisp-slime-nav-mode) -(use-package geiser +(req-package geiser + :require quack :commands (geiser-mode geiser run-geiser - run-racket) - :config (use-package quack)) + run-racket)) -(use-package redshank +(req-package redshank :init (progn (add-hook 'lisp-common-mode-hook #'turn-on-redshank-mode))) -(use-package slime +(req-package slime :commands (slime) :config (progn (let ((ql-slime-helper (expand-file-name "~/quicklisp/slime-helper.el"))) @@ -884,7 +892,7 @@ (defun imenu-elisp-sections () (setq imenu-prev-index-position-function nil) (add-to-list 'imenu-generic-expression '("Sections" "^;;;; \\(.+\\)$" 1) t) - (add-to-list 'imenu-generic-expression '("Packages" "^(use-package\\s-+\\(\\(\\sw\\|\\s_\\)+\\)$" 1) t)) + (add-to-list 'imenu-generic-expression '("Packages" "^(req-package\\s-+\\(\\(\\sw\\|\\s_\\)+\\)$" 1) t)) (defun init-narrow-to-section () (interactive) @@ -921,10 +929,10 @@ ;;;; Programming -(use-package auto-compile +(req-package auto-compile :init (add-hook 'emacs-lisp-mode-hook #'auto-compile-on-save-mode)) -(use-package cc-mode +(req-package cc-mode :init (progn (add-hook 'c-mode-common-hook #'electric-indent-mode)) :config (progn @@ -934,17 +942,17 @@ c-basic-offset 4) (c-set-offset 'case-label '+))) -(use-package quickrun) +(req-package quickrun) ;;;; Web Development -(use-package skewer-mode +(req-package skewer-mode :init (progn (add-hook 'js2-mode-hook #'skewer-mode) (add-hook 'html-mode-hook #'skewer-html-mode) (add-hook 'css-mode-hook #'skewer-css-mode))) -(use-package js2-mode +(req-package js2-mode :mode ("\\.js\\'" . js2-mode) :config (progn (defun ap/javascript-setup () @@ -954,15 +962,15 @@ (setq js2-basic-offset 4 js2-global-externs '("$")))) -(use-package mustache-mode +(req-package mustache-mode :mode (("\\.mustache" . mustache-mode) ("\\.mt\\'" . mustache-mode) ("\\.template\\'" . mustache-mode))) -(use-package jinja2-mode +(req-package jinja2-mode :mode (("\\.j2\\'" . jinja2-mode))) -(use-package php-mode +(req-package php-mode :mode ("\\.php\\'" . php-mode) :config (progn (bind-key "C-h C-f" #'php-search-documentation php-mode-map) @@ -991,15 +999,15 @@ (add-hook 'php-mode-hook #'ap/php-style) (add-hook 'php-mode-hook #'turn-on-eldoc-mode))) -(use-package sgml-mode +(req-package sgml-mode :config (setq sgml-basic-offset 4)) -(use-package emmet-mode +(req-package emmet-mode :config (progn (if (functionp 'web-mode) (add-hook 'web-mode-hook #'emmet-mode)))) -(use-package web-mode +(req-package web-mode :mode (("/views/.*\\.php\\'" . web-mode) ("/templates/.*\\.php\\'" . web-mode)) :config (setq web-mode-code-indent-offset 4 @@ -1031,12 +1039,12 @@ (tooltip-mode -1) (tool-bar-mode -1)) -(use-package winner +(req-package winner :init (progn (winner-mode 1) (setq winner-boring-buffers '("*Completions*" "*Help*" "*Apropos*" "*Buffer List*" "*info*" "*Compile-Log*")))) -(use-package windmove +(req-package windmove :bind (("S-" . windmove-left) ("S-" . windmove-right) ("S-" . windmove-up) @@ -1044,3 +1052,5 @@ (if (eq system-type 'darwin) (setq ns-pop-up-frames nil)) + +(req-package-finish) -- cgit 1.4.1