Fuco  committed 3df3fa9

Added use-package/bind-key, updated all keybindigns to use bind-key and removed useless bindings

  • Participants
  • Parent commits 875b9b0
  • Branches default

Comments (0)

Files changed (11)

File files/expand-region.el

-(global-set-key (kbd "s-'") 'er/expand-region)
+(bind-key "s-'" 'er/expand-region)

File files/isearch.el

   (isearch-yank-internal (lambda () (sp-forward-symbol) (point))))
 ;; keybindings
-(global-set-key [(f6)] 'replace-regexp)
-(global-set-key [(f7)] 'isearch-forward-regexp)
-(define-key isearch-mode-map (kbd "C-v") 'my-isearch-forward-to-beginning)
-(define-key isearch-mode-map (kbd "C-2") 'my-isearch-kill-match)
-(define-key isearch-mode-map (kbd "C-3") 'my-isearch-exit-other-end)
-(define-key isearch-mode-map (kbd "C-M-w") 'my-isearch-yank-symbol)
-(define-key isearch-mode-map (kbd "M-z") 'my-isearch-zap-to-match)
+(bind-key "<f6>" 'replace-regexp)
+(bind-key "C-v" 'my-isearch-forward-to-beginning isearch-mode-map)
+(bind-key "C-2" 'my-isearch-kill-match           isearch-mode-map)
+(bind-key "C-3" 'my-isearch-exit-other-end       isearch-mode-map)
+(bind-key "C-M-w" 'my-isearch-yank-symbol        isearch-mode-map)
+(bind-key "M-z" 'my-isearch-zap-to-match         isearch-mode-map)
+(bind-key "<f2>" 'isearch-occur                  isearch-mode-map)

File files/ispell.el

 ;;; ispell - Interactive spellchecker
-;;(require 'ispell)
 (autoload 'ispell-word "ispell" nil t)
-(global-set-key (kbd "<f10>") 'ispell-word)
-(global-set-key (kbd "C-<f10>") 'flyspell-mode)
+(bind-key "<f10>" 'ispell-word)
+(bind-key "C-<f10>" 'flyspell-mode)

File files/keys.el

 ;;; Global key bindigns
-;; How to Define Keyboard Shortcuts in Emacs
 ;; setting the PC keyboard's various keys to
 ;; Super or Hyper, for emacs running on Windows.
 (define-key function-key-map [?\e] nil)
 ;; Url & Browsing
-(global-set-key (kbd "C-c C-w") 'browse-url-at-point)
-(global-set-key (kbd "C-c w") 'browse-url)
-;; Window manipulation
-(global-set-key [(control kp-6)] 'enlarge-window-horizontally)
-(global-set-key [(control kp-4)] 'shrink-window-horizontally)
-(global-set-key [(control kp-8)] 'enlarge-window)
-(global-set-key [(control kp-2)] 'shrink-window)
+(bind-key "C-c C-w" 'browse-url-at-point)
+(bind-key "C-c w" 'browse-url)
 ;; Find stuff
-(global-set-key [(f2)]              'ack-default-directory)
-(global-set-key [(control f2)]      'ack-same)
-(global-set-key [(control meta f2)] 'ack)
-(global-set-key [(meta f2)]         'find-name-dired)
-(global-set-key [(shift f2)]        'occur)
+(bind-key "M-<f2>" 'find-name-dired)
+(bind-key "<f2>" 'occur)
 ;; refresh-like
-(global-set-key [(control f5)] 'revbufs)
-(global-set-key [(f5)] '(lambda () (interactive) (load-file (buffer-file-name))))
+(bind-key "C-<f5>" 'revbufs)
+(bind-key "<f5>" '(lambda () (interactive) (load-file (buffer-file-name))))
 ;; Indenting and alignment
-(global-set-key [(f8)]         'indent-region)
-(global-set-key [(control f8)] 'indent-buffer)
-(global-set-key [(shift f8)]   'align-current)
-(global-set-key [(meta f8)]    'align-regexp)
+(bind-key "<f8>" 'align-regexp)
+(bind-key "C-<f8>" 'indent-buffer)
 ;; shell pop
-(global-set-key [(f9)] 'shell-pop)
+(bind-key "<f9>" 'shell-pop)
-;; map the window manipulation keys to meta 0, 1, 2, o
-(global-set-key (kbd "M-3") 'split-window-horizontally) ; was digit-argument
-(global-set-key (kbd "M-2") 'split-window-vertically)   ; was digit-argument
-(global-set-key (kbd "M-1") 'delete-other-windows)      ; was digit-argument
-(global-set-key (kbd "M-0") 'delete-window)             ; was digit-argument
-(global-set-key (kbd "M-o") 'other-window)              ; was facemenu-keymap
+(bind-key "M-0" 'delete-window)
+(bind-key "M-o" 'other-window)
+(bind-key "M-O" 'rotate-windows)
-(global-set-key (kbd "M-O") 'rotate-windows)
-;; Move windows, even in org-mode (doesn't work on windows :( )
-(global-set-key (kbd "<s-right>") 'windmove-right)
-(global-set-key (kbd "<s-left>") 'windmove-left)
-(global-set-key (kbd "<s-up>") 'windmove-up)
-(global-set-key (kbd "<s-down>") 'windmove-down)
-;; Replace dired's M-o
-(add-hook 'dired-mode-hook (lambda () (define-key dired-mode-map (kbd "M-o") 'other-window))) ; was dired-omit-mode
-;; Replace ibuffer's M-o
-(add-hook 'ibuffer-mode-hook (lambda () (define-key ibuffer-mode-map (kbd "M-o") 'other-window))) ; was ibuffer-visit-buffer-1-window
+(add-hook 'dired-mode-hook (lambda () (bind-key "M-o" 'other-window dired-mode-map)))
+(add-hook 'ibuffer-mode-hook (lambda () (bind-key "M-o" 'other-window ibuffer-mode-map)))
 ;; ibuffer > list-buffers
-(global-set-key (kbd "C-x C-b") 'ibuffer)
+(bind-key "C-x C-b" 'ibuffer)
 ;; buffer cleanup
-(global-set-key (kbd "C-c u") 'cleanup-buffer)
+(bind-key "C-c u" 'cleanup-buffer)
 ;; buffer switching using cycbuf
-(global-set-key (kbd "C-x C-a") 'cycbuf-switch-to-next-buffer)
+;;(bind-key "C-x C-a" 'cycbuf-switch-to-next-buffer)
 ;; Window navigation
 (windmove-default-keybindings 'meta)
 ;; Easier buffer killing
-(global-unset-key (kbd "M-k"))
-(global-set-key (kbd "M-k") 'kill-this-buffer)
-(global-set-key (kbd "M-K") (lambda () (interactive) (kill-buffer (window-buffer (next-window)))))
+(bind-key "M-k" 'kill-this-buffer)
+(bind-key "M-K" (lambda () (interactive) (kill-buffer (window-buffer (next-window)))))
 ;; imenu
-(global-unset-key (kbd "M-.")) ;; was Find tag
-(global-set-key (kbd "M-.") 'ido-goto-symbol)
-(global-set-key (kbd "M-,") 'find-function)
+(bind-key "M-." 'ido-goto-symbol) ;; was Find tag
+(bind-key "M-," 'find-function)
 ;; sexp settings
-(global-set-key (kbd "C-x e") 'eval-and-replace)
-(global-set-key (kbd "C-;") 'eval-expression)
+(bind-key "C-x e" 'eval-and-replace)
+(bind-key "C-;" 'eval-expression)
 ;; minibuffer history
-(define-key minibuffer-local-map (kbd "C-p") 'previous-history-element)
-(define-key minibuffer-local-map (kbd "C-n") 'next-history-element)
+(bind-key "C-p" 'previous-history-element minibuffer-local-map)
+(bind-key "C-n" 'next-history-element minibuffer-local-map)
-(global-set-key (kbd "M-y") 'helm-show-kill-ring)
+(bind-key "M-y" 'helm-show-kill-ring)
 ;; navigation
 ;; # move by (forw/back)
 ;; character
-(global-set-key (kbd "C-f") 'forward-char)
-(global-set-key (kbd "C-b") 'backward-char)
+(bind-key "C-f" 'forward-char)
+(bind-key "C-b" 'backward-char)
 ;; word
-(global-set-key (kbd "M-f") 'forward-word)
-(global-set-key (kbd "M-b") 'backward-word)
+(bind-key "M-f" 'forward-word)
+(bind-key "M-b" 'backward-word)
 ;; line
-(global-set-key (kbd "C-n") 'next-line)
-(global-set-key (kbd "C-p") 'previous-line)
+(bind-key "C-n" 'next-line)
+(bind-key "C-p" 'previous-line)
 ;; sentence
-(global-set-key (kbd "M-e") 'forward-sentence)
-(global-set-key (kbd "M-a") 'backward-sentence)
+(bind-key "M-e" 'forward-sentence)
+(bind-key "M-a" 'backward-sentence)
 ;; paragraph
-(global-unset-key (kbd "M-{")) ;; was backward-paragraph
-(global-unset-key (kbd "M-}")) ;; was forward-paragraph
-(global-set-key (kbd "M-[") 'backward-paragraph)
-(global-set-key (kbd "M-]") 'forward-paragraph)
-(global-set-key (kbd "M-{") 'backward-paragraph-select)
-(global-set-key (kbd "M-}") 'forward-paragraph-select)
+(bind-key "M-[" 'backward-paragraph)
+(bind-key "M-]" 'forward-paragraph)
+(bind-key "M-{" 'backward-paragraph-select)
+(bind-key "M-}" 'forward-paragraph-select)
 ;; screen
-(global-set-key (kbd "C-v") 'scroll-up-command)
-(global-set-key (kbd "M-v") 'scroll-down-command)
+(bind-key "C-v" 'scroll-up-command)
+(bind-key "M-v" 'scroll-down-command)
 ;; sexp
-(global-set-key (kbd "C-M-f") 'forward-sexp)
-(global-set-key (kbd "C-M-b") 'backward-sexp)
+(bind-key "C-M-f" 'forward-sexp)
+(bind-key "C-M-b" 'backward-sexp)
 ;; list
-(global-set-key (kbd "C-M-n") 'forward-list)
-(global-set-key (kbd "C-M-p") 'backward-list)
+(bind-key "C-M-n" 'forward-list)
+(bind-key "C-M-p" 'backward-list)
 ;; semantic unit
-(global-set-key (kbd "M-\\") 'smart-forward)
-(global-set-key (kbd "M-'") 'smart-backward)
+(bind-key "M-\\" 'smart-forward)
+(bind-key "M-'" 'smart-backward)
 ;; # move to (beg/end)
 ;; line
 ;; swap C-a and M-m, back-to-indentation is much more common
-(global-unset-key (kbd "M-m"))
-(global-unset-key (kbd "C-a"))
-(global-set-key (kbd "M-m") 'move-beginning-of-line)
-(global-set-key (kbd "C-a") 'my-back-to-indentation-or-beginning)
-(global-set-key (kbd "C-e") 'my-end-of-code-or-line)
+(bind-key "M-m" 'move-beginning-of-line)
+(bind-key "C-a" 'my-back-to-indentation-or-beginning)
+(bind-key "C-e" 'my-end-of-code-or-line)
 ;; buffer
-(global-unset-key [(home)]) ;; was C-a
-(global-unset-key [(end)]) ;; was C-e
-(global-set-key (kbd "M-<") 'beginning-of-buffer)
-(global-set-key (kbd "C-M-,") 'beginning-of-buffer)
-(global-set-key (kbd "M->") 'end-of-buffer)
-(global-set-key (kbd "C-M-.") 'end-of-buffer)
+(unbind-key "<home>")
+(unbind-key "<end>")
+(bind-key "M-<" 'beginning-of-buffer)
+(bind-key "C-M-," 'beginning-of-buffer)
+(bind-key "M->" 'end-of-buffer)
+(bind-key "C-M-." 'end-of-buffer)
 ;; defun
-(global-set-key (kbd "M-p") 'beginning-of-defun)
-(global-set-key (kbd "M-n") 'end-of-defun)
+(bind-key "M-p" 'beginning-of-defun)
+(bind-key "M-n" 'end-of-defun)
 ;; active region
-(global-set-key (kbd "C-c a") 'beginning-of-region)
-(global-set-key (kbd "C-c e") 'end-of-region)
+(bind-key "C-c a" 'beginning-of-region)
+(bind-key "C-c e" 'end-of-region)
 ;; # move into
-(global-set-key (kbd "C-M-d") 'down-list)
+(bind-key "C-M-d" 'down-list)
-(global-set-key (kbd "C-c <up>") 'copy-previous-line)
-(global-set-key (kbd "C-c <down>") 'copy-next-line)
-(global-set-key (kbd "M-<up>") 'move-line-up)
-(global-set-key (kbd "M-<down>") 'move-line-down)
+(bind-key "C-c <up>" 'copy-previous-line)
+(bind-key "C-c <down>" 'copy-next-line)
+(bind-key "M-<up>" 'move-line-up)
+(bind-key "M-<down>" 'move-line-down)
 ;; opening new lines. C-o can be called from any point on the line
 ;; ret from the end only
-(global-set-key (kbd "RET") 'open-next-line)
-(global-set-key (kbd "C-o") 'vi-open-next-line)
-(global-set-key (kbd "C-S-o") 'forward-line-and-indent)
-(global-set-key (kbd "M-j")
-                (lambda ()
-                  (interactive)
-                  (join-line -1)))
+(bind-key "RET" 'open-next-line)
+(bind-key "C-o" 'vi-open-next-line)
+(bind-key "C-S-o" 'forward-line-and-indent)
+(bind-key "M-j"
+          (lambda ()
+            (interactive)
+            (join-line -1)))
 ;; go to char, also mapped to a keychord df
-(global-set-key (kbd "C-c f") 'iy-go-to-char)
-(global-set-key (kbd "C-c F") 'iy-go-to-char-backward)
-(global-set-key (kbd "C-c ;") 'iy-go-to-char-continue)
-(global-set-key (kbd "C-c ,") 'iy-go-to-char-continue-backward)
+(bind-key "C-c f" 'iy-go-to-char)
+(bind-key "C-c F" 'iy-go-to-char-backward)
+(bind-key "C-c ;" 'iy-go-to-char-continue)
+(bind-key "C-c ," 'iy-go-to-char-continue-backward)
 ;;; scrollers
-(global-set-key (kbd "C-c n") 'my-scroll-up)
-(global-set-key (kbd "C-c p") 'my-scroll-down)
+(bind-key "C-c n" 'my-scroll-up)
+(bind-key "C-c p" 'my-scroll-down)
 ;; deleting stuff
-(global-set-key (kbd "C-<i-key>") 'backward-kill-word)
-(global-set-key (kbd "C-<backspace>") 'my-kill-whitespace)
+(bind-key "C-<i-key>" 'backward-kill-word)
+(bind-key "C-<backspace>" 'my-kill-whitespace)
 ;;;;; multiple cursors
-(global-set-key (kbd "C-c C-S-c") 'mc/edit-lines)
-(global-set-key (kbd "s-.") 'mc/mark-next-like-this)
-(global-set-key (kbd "s-,") 'mc/mark-previous-like-this)
-(global-set-key (kbd "s-\\") 'mc/mark-more-like-this-extended)
-(global-set-key (kbd "s-/") 'mc/mark-all-like-this-dwim)
-(global-set-key (kbd "H-SPC") 'set-rectangular-region-anchor)
+(bind-key "C-c C-S-c" 'mc/edit-lines)
+(bind-key "s-." 'mc/mark-next-like-this)
+(bind-key "s-," 'mc/mark-previous-like-this)
+(bind-key "s-\\" 'mc/mark-more-like-this-extended)
+(bind-key "s-/" 'mc/mark-all-like-this-dwim)
+(bind-key "H-SPC" 'set-rectangular-region-anchor)
-;; keys for specific modes
-(defun add-html-binding ()
-  (define-key (current-local-map) (kbd "C-c <deletechar>") 'sgml-delete-tag))
-(dolist (hook '(sgml-mode-hook
-                html-mode-hook))
-  (add-hook hook 'add-html-binding))
+(add-hook 'html-mode-hook (lambda () (bind-key "C-c <deletechar>" 'sgml-delete-tag html-mode-map)))
 ;; sunrise
-(global-set-key [(f1)] 'sunrise)
-(global-set-key [(meta f1)] 'sunrise-cd)
+(bind-key "<f1>" 'sunrise)
+(bind-key "M-<f1>" 'sunrise-cd)
 ;; mark commands
-(global-set-key (kbd "C-`") 'push-mark-no-activate)
-(global-set-key (kbd "M-`") 'jump-to-mark)
-(define-key global-map [remap exchange-point-and-mark] 'exchange-point-and-mark-no-activate)
+(bind-key "C-`" 'push-mark-no-activate)
+(bind-key "M-`" 'jump-to-mark)
+(global-set-key [remap exchange-point-and-mark] 'exchange-point-and-mark-no-activate)
 ;; calc settings
-(global-set-key (kbd "<pause>") 'calc-dispatch)
-(global-set-key (kbd "<home>") 'calc-same-interface)
-(global-set-key (kbd "C-c c") 'my-mini-calc)
+(bind-key "<pause>" 'calc-dispatch)
+(bind-key "<home>" 'calc-same-interface)
+;; customize
+(defvar customize-map)
+(define-prefix-command 'customize-map)
+(bind-key "C-c c" 'customize-map)
+(bind-key "C-c c v" 'customize-variable)
+(bind-key "C-c c f" 'customize-face)
+(bind-key "C-c c g" 'customize-group)
+(bind-key "C-c c c" 'my-mini-calc)
+(defvar lisp-find-map)
+(define-prefix-command 'lisp-find-map)
+(bind-key "C-h e" 'lisp-find-map)
+(bind-key "C-h e F" 'find-face-definition)
+(bind-key "C-h e k" 'find-function-on-key)
+(bind-key "C-h e l" 'find-library)
+(bind-key "C-h e v" 'find-variable)
 ;; you can select the key you prefer to (hyperfind!)
-(define-key global-map (kbd "H-f") 'ace-jump-mode)
+(bind-key "H-f" 'ace-jump-mode)
 ;; zapping
-(global-set-key (kbd "M-z") 'zap-up-to-char)
-(global-set-key (kbd "M-Z") 'zap-to-char)
+(bind-key "M-z" 'zap-up-to-char)
+(bind-key "M-Z" 'zap-to-char)
 ;; input methods
-;;(global-set-key (kbd "C-\\") 'toggle-input-method)
-(global-set-key (kbd "C-\\") 'my-cycle-language)
+;;(bind-key "C-\\" 'toggle-input-method)
+(bind-key "C-\\" 'my-cycle-language)
 (defvar my-input-method :english)
 (defun my-cycle-language ()
   (case my-input-method
-   (:slovak  (setq my-input-method :german)
-             (my-toggle-input-method "german"))
-   (:german  (setq my-input-method :english)
-             (my-toggle-input-method nil))
-   (:english (setq my-input-method :slovak)
-             (my-toggle-input-method "slovak"))))
+    (:slovak  (setq my-input-method :german)
+              (my-toggle-input-method "german"))
+    (:german  (setq my-input-method :english)
+              (my-toggle-input-method nil))
+    (:english (setq my-input-method :slovak)
+              (my-toggle-input-method "slovak"))))
 (defun my-toggle-input-method (new-input-method)
         (when new-input-method
           (customize-mark-as-set 'default-input-method))))))
 ;; Jump to "logical" top/bottom of buffer in listing buffers

File files/macros.el

 ;; swap between two last used buffers
 (fset 'swap-buffer-to-last-used
    (lambda (&optional arg) "Keyboard macro." (interactive "p") (kmacro-exec-ring-item (quote ([24 98 return] 0 "%d")) arg)))
-(global-set-key (kbd "C-x C-a") 'swap-buffer-to-last-used)
+(bind-key "C-x C-a" 'swap-buffer-to-last-used)

File files/org-mode.el

 (add-to-list 'auto-mode-alist '("\\.org\\'" . org-mode))
 (add-hook 'org-mode-hook 'turn-on-font-lock) ; not needed when global-font-lock-mode is on
-(global-set-key "\C-cl" 'org-store-link)
-(global-set-key (kbd "<f12>") 'org-agenda)
-(global-set-key "\C-cb" 'org-iswitchb)
+(bind-key "C-c l" 'org-store-link)
+(bind-key "<f12>" 'org-agenda)
+(bind-key "C-c b" 'org-iswitchb)
-(global-set-key (kbd "<f11>") 'org-clock-goto)
+(bind-key "<f11>" 'org-clock-goto)
 (setq org-modules (quote (org-habit)))
 (setq org-default-notes-file "~/org/")
 ;; I use C-M-r to start capture mode
-(global-set-key (kbd "C-M-r") 'org-capture)
+(bind-key "C-M-r" 'org-capture)
 ;; Capture templates for: TODO tasks, Notes, appointments, phone calls, and org-protocol
 (setq org-capture-templates

File files/smex.el

     (setq ido-decorations (quote ("\n-> " "" "\n   " "\n   ..." "[" "]" " [No match]" " [Matched]" " [Not readable]" " [Too big]" " [Confirm]")))))
-(global-set-key (kbd "M-x") 'beautify-smex)
-(global-set-key (kbd "M-X") 'smex-major-mode-commands)
+(bind-key "M-x" 'beautify-smex)
+(bind-key "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)
+(bind-key "C-c C-c M-x" 'execute-extended-command)

File files/tabs.el

-(global-set-key (kbd "TAB") 'smart-tab)
+(bind-key "TAB" 'smart-tab)
 (require 'autoinstall)
 (require 'parenface)
+(vendor 'use-package)
 ;; autoloads
 (autoload 'calc-same-interface "calc" nil t)

File vendor/use-package/bind-key.el

+;;; bind-key --- A simple way to manage personal keybindings
+;; Copyright (C) 2012 John Wiegley
+;; Author: John Wiegley <>
+;; Created: 16 Jun 2012
+;; Version: 1.0
+;; Keywords: keys keybinding config dotemacs
+;; X-URL:
+;; This program is free software; you can redistribute it and/or
+;; modify it under the terms of the GNU General Public License as
+;; published by the Free Software Foundation; either version 2, or (at
+;; your option) any later version.
+;; This program is distributed in the hope that it will be useful, but
+;; WITHOUT ANY WARRANTY; without even the implied warranty of
+;; General Public License for more details.
+;; You should have received a copy of the GNU General Public License
+;; along with GNU Emacs; see the file COPYING.  If not, write to the
+;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+;; Boston, MA 02111-1307, USA.
+;;; Commentary:
+;; If you have lots of keybindings set in your .emacs file, it can be hard to
+;; know which ones you haven't set yet, and which may now be overriding some
+;; new default in a new Emacs version.  This module aims to solve that
+;; problem.
+;; Bind keys as follows in your .emacs:
+;;   (require 'bind-key)
+;;   (bind-key "C-c x" 'my-ctrl-c-x-command)
+;; If you want the keybinding to override all minor modes that may also bind
+;; the same key, use the `bind-key*' form:
+;;   (bind-key* "<C-return>" 'other-window)
+;; If you want to rebind a key only in a particular key, use:
+;;   (bind-key "C-c x" 'my-ctrl-c-x-command some-other-mode-map)
+;; To unbind a key within a keymap (for example, to stop your favorite major
+;; mode from changing a binding that you don't want to override everywhere),
+;; use `unbind-key':
+;;   (unbind-key "C-c x" some-other-mode-map)
+;; After Emacs loads, you can see a summary of all your personal keybindings
+;; currently in effect with this command:
+;;   M-x describe-personal-keybindings
+;; This display will tell you if you've overriden a default keybinding, and
+;; what the default was.  Also, it will tell you if the key was rebound after
+;; your binding it with `bind-key', and what it was rebound it to.
+(require 'easy-mmode)
+(defgroup bind-key nil
+  "A simple way to manage personal keybindings"
+  :group 'emacs)
+(defcustom bind-key-segregation-regexp
+  "\\`\\(\\(C-[chx] \\|M-[gso] \\)\\([CM]-\\)?\\|.+-\\)"
+  "Regular expression used to divide key sets in the output from
+  :type 'regexp
+  :group 'bind-key)
+;; Create override-global-mode to force key remappings
+(defvar override-global-map (make-keymap)
+  "override-global-mode keymap")
+(define-minor-mode override-global-mode
+  "A minor mode so that keymap settings override other modes."
+  t "" override-global-map)
+(add-hook 'after-init-hook
+          (function
+           (lambda ()
+             (override-global-mode 1))))
+(defvar personal-keybindings nil)
+(defmacro bind-key (key-name command &optional keymap)
+  (let ((namevar (make-symbol "name"))
+        (keyvar (make-symbol "key"))
+        (bindingvar (make-symbol "binding"))
+        (entryvar (make-symbol "entry")))
+    `(let* ((,namevar ,(eval key-name))
+            (,keyvar (read-kbd-macro ,namevar))
+            (,bindingvar (lookup-key (or ,keymap global-map)
+                                     ,keyvar)))
+       (let ((,entryvar (assoc (cons ,namevar (quote ,keymap))
+                               personal-keybindings)))
+         (if ,entryvar
+             (setq personal-keybindings
+                   (delq ,entryvar personal-keybindings))))
+       (setq personal-keybindings
+             (cons (list (cons ,namevar (quote ,keymap))
+                         ,command
+                         (unless (numberp ,bindingvar) ,bindingvar))
+                   personal-keybindings))
+       (define-key (or ,keymap global-map) ,keyvar ,command))))
+(defmacro unbind-key (key-name &optional keymap)
+  `(bind-key ,key-name nil ,keymap))
+(defmacro bind-key* (key-name command)
+  `(progn
+     (bind-key ,key-name ,command)
+     (define-key override-global-map ,(read-kbd-macro key-name) ,command)))
+(defun get-binding-description (elem)
+  (cond
+   ((listp elem)
+    (cond
+     ((eq 'lambda (car elem))
+      "#<lambda>")
+     ((eq 'closure (car elem))
+      "#<closure>")
+     ((eq 'keymap (car elem))
+      "#<keymap>")
+     (t
+      elem)))
+   ((keymapp elem)
+    "#<keymap>")
+   ((symbolp elem)
+    elem)
+   (t
+    "#<byte-compiled lambda>")))
+(defun compare-keybindings (l r)
+  (let* ((regex bind-key-segregation-regexp)
+         (lgroup (and (string-match regex (caar l))
+                      (match-string 0 (caar l))))
+         (rgroup (and (string-match regex (caar r))
+                      (match-string 0 (caar r))))
+         (lkeymap (cdar l))
+         (rkeymap (cdar r)))
+    (cond
+     ((and (null lkeymap) rkeymap)
+      (cons t t))
+     ((and lkeymap (null rkeymap))
+      (cons nil t))
+     ((and lkeymap rkeymap
+           (not (string= (symbol-name lkeymap) (symbol-name rkeymap))))
+      (cons (string< (symbol-name lkeymap) (symbol-name rkeymap)) t))
+     ((and (null lgroup) rgroup)
+      (cons t t))
+     ((and lgroup (null rgroup))
+      (cons nil t))
+     ((and lgroup rgroup)
+      (if (string= lgroup rgroup)
+          (cons (string< (caar l) (caar r)) nil)
+        (cons (string< lgroup rgroup) t)))
+     (t
+      (cons (string< (caar l) (caar r)) nil)))))
+(defun describe-personal-keybindings ()
+  (interactive)
+  (with-current-buffer (get-buffer-create "*Personal Keybindings*")
+    (delete-region (point-min) (point-max))
+    (insert "Key name          Command                                 Comments
+----------------- --------------------------------------- ---------------------
+    (let (last-binding)
+      (dolist (binding
+               (setq personal-keybindings
+                     (sort personal-keybindings
+                           #'(lambda (l r)
+                               (car (compare-keybindings l r))))))
+        (if (not (eq (cdar last-binding) (cdar binding)))
+            (insert ?\n (format "\n%s\n%s\n\n"
+                                (cdar binding)
+                                (make-string 79 ?-)))
+          (if (and last-binding
+                   (cdr (compare-keybindings last-binding binding)))
+              (insert ?\n)))
+        (let* ((key-name (caar binding))
+               (at-present (lookup-key (or (symbol-value (cdar binding))
+                                           (current-global-map))
+                                       (read-kbd-macro key-name)))
+               (command (nth 1 binding))
+               (was-command (nth 2 binding))
+               (command-desc (get-binding-description command))
+               (was-command-desc (and was-command
+                                      (get-binding-description was-command)))
+               (at-present-desc (get-binding-description at-present))
+               )
+          (insert
+           (format
+            "%-18s%-40s%s\n"
+            key-name command-desc
+            (if (string= command-desc at-present-desc)
+                (if (or (null was-command)
+                        (string= command-desc was-command-desc))
+                    ""
+                  (format "(%s)" was-command-desc))
+              (format "[now: %s]" at-present)))))
+        (setq last-binding binding)))
+    (goto-char (point-min))
+    (display-buffer (current-buffer))))
+(provide 'bind-key)
+;;; bind-key.el ends here

File vendor/use-package/use-package.el

+;;; use-package --- A use-package declaration for simplifying your .emacs
+;; Copyright (C) 2012 John Wiegley
+;; Author: John Wiegley <>
+;; Created: 17 Jun 2012
+;; Version: 1.0
+;; Keywords: dotemacs startup speed config package
+;; X-URL:
+;; This program is free software; you can redistribute it and/or
+;; modify it under the terms of the GNU General Public License as
+;; published by the Free Software Foundation; either version 2, or (at
+;; your option) any later version.
+;; This program is distributed in the hope that it will be useful, but
+;; WITHOUT ANY WARRANTY; without even the implied warranty of
+;; General Public License for more details.
+;; You should have received a copy of the GNU General Public License
+;; along with GNU Emacs; see the file COPYING.  If not, write to the
+;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+;; Boston, MA 02111-1307, USA.
+;;; Commentary:
+;; The `use-package' declaration macro allows you to isolate package
+;; configuration in your ".emacs" in a way that is performance-oriented and,
+;; well, just tidy.  I created it because I have over 80 packages that I use
+;; in Emacs, and things were getting difficult to manage.  Yet with this
+;; utility my total load time is just under 1 second, with no loss of
+;; functionality!
+;; Here is the simplest `use-package' declaration:
+;;   (use-package foo)
+;; This loads in the package foo, but only if foo is available on your system.
+;; If not, a warning is logged to your `*Messages*' buffer.  If it succeeds a
+;; message about "Loading foo" is logged, along with the time it took to load,
+;; if that time is over 0.01s.
+;; Use the :init keywoard to do some stuff to initialize foo, but only if foo
+;; actually gets loaded:
+;;   (use-package foo
+;;     :init
+;;     (progn
+;;       (setq foo-variable t)
+;;       (foo-mode 1)))
+;; A very common thing to do when loading a module is to bind a key to primary
+;; commands within that module:
+;;   (use-package ace-jump-mode
+;;     :bind ("C-." . ace-jump-mode))
+;; This does two things: first, it creates autoload for the `ace-jump-mode'
+;; command, and defers loading of `ace-jump-mode' until you actually use it.
+;; Second, it binds the key `C-.' to that command.  After loading, you can use
+;; `M-x describe-personal-keybindings' to see all such bindings you've set
+;; throughout your Emacs.
+;; A more literal way to do the exact same thing is:
+;;   (use-package ace-jump-mode
+;;     :commands ace-jump-mode
+;;     :init
+;;     (bind-key "C-." 'ace-jump-mode))
+;; When you use the `:commands' keyword, it creates autoloads for those
+;; commands and defers loading of the module until they are used.  In this
+;; case, the `:init' form is always run -- even if ace-jump-mode might not be
+;; on your system.  So remember to keep `:init' activities to only those that
+;; would succeed either way.
+;; Similar to `:bind', you can use `:mode' and `:interpreter' to establish a
+;; deferred binding within `auto-mode-alist' and `auto-interpreter-alist'.
+;; The specifier to either keyword can be a single cons or a list:
+;;   (use-package python-mode
+;;     :mode ("\\.py$" . python-mode)
+;;     :interpreter ("python" . python-mode))
+;; If you aren't using `:commands', `:bind', `:mode', or `:interpreter' (all
+;; of which imply `:commands'), you can still defer loading with the `:defer'
+;; keyword:
+;;   (use-package ace-jump-mode
+;;     :defer t
+;;     :init
+;;     (progn
+;;       (autoload 'ace-jump-mode "ace-jump-mode" nil t)
+;;       (bind-key "C-." 'ace-jump-mode)))
+;; This does exactly the same thing as the other two commands above.
+;; A companion to the `:init' keyword is `:config'.  Although `:init' always
+;; happens in the case of deferred modules (which are likely to be the most
+;; common kind), `:config' form only run after the module has been loaded by
+;; Emacs:
+;;   (use-package ace-jump-mode
+;;     :bind ("C-." . ace-jump-mode)
+;;     :config
+;;     (message "Yay, ace-jump-mode was actually loaded!"))
+;; You will see a "Configured..." message in your `*Messages*' log when a
+;; package is configured, and a timing if the configuration time was longer
+;; than 0.01s.  You should keep `:init' forms as simple as possible, and put
+;; as much as you can get away with on the `:config' side.
+;; You can have both `:init' and `:config':
+;;   (use-package haskell-mode
+;;     :commands haskell-mode
+;;     :init
+;;     (add-to-list 'auto-mode-alist '("\\.l?hs$" . haskell-mode))
+;;     :config
+;;     (progn
+;;       (use-package inf-haskell)
+;;       (use-package hs-lint)))
+;; In this case, I want to autoload the command `haskell-mode' from
+;; "haskell-mode.el", add it to `auto-mode-alist' at the time ".emacs" is
+;; loaded, but wait until after I've opened a Haskell file before loading
+;; "inf-haskell.el" and "hs-lint.el".
+;; The `:bind' keyword takes either a cons or a list of conses:
+;;   (use-package hi-lock
+;;     :bind (("M-o l" . highlight-lines-matching-regexp)
+;;            ("M-o r" . highlight-regexp)
+;;            ("M-o w" . highlight-phrase)))
+;; The `:commands' keyword likewise takes either a symbol or a list of
+;; symbols.
+;; You can use the `:if' keyword to predicate the loading and initialization
+;; of a module.  For example, I only want an `edit-server' running for my
+;; main, graphical Emacs, not for Emacsen I may start at the command line:
+;;   (use-package edit-server
+;;     :if window-system
+;;     :init
+;;     (progn
+;;       (add-hook 'after-init-hook 'server-start t)
+;;       (add-hook 'after-init-hook 'edit-server-start t)))
+;; The `:disabled' keyword can be used to turn off a module that you're having
+;; difficulties with, or to stop loading something you're not really using at
+;; the present time:
+;;   (use-package ess-site
+;;     :disabled t
+;;     :commands R)
+;; Another feature of `use-package' is that it always loads every file that it
+;; can when your ".emacs" is being byte-compiled (if you do that, which I
+;; recommend).  This helps to silence spurious warnings about unknown
+;; variables and functions.
+;; However, there are times when this is just not enough.  For those times,
+;; use the `:defines' keyword to introduce empty variable definitions solely
+;; for the sake of the byte-compiler:
+;;   (use-package texinfo
+;;     :defines texinfo-section-list
+;;     :commands texinfo-mode
+;;     :init
+;;     (add-to-list 'auto-mode-alist '("\\.texi$" . texinfo-mode)))
+;; If you need to silence a missing function warning, do it with an autoload
+;; stub in your `:init' block:
+;;   (use-package w3m
+;;     :commands (w3m-browse-url w3m-session-crash-recovery-remove)
+;;     :init
+;;     (eval-when-compile
+;;       (autoload 'w3m-search-escape-query-string "w3m-search")))
+;; If your package needs a directory added to the `load-path' in order load,
+;; use `:load-path'.  It takes a string or a list of strings.  If the path is
+;; relative, it will be expanded within `user-emacs-directory':
+;;   (use-package ess-site
+;;     :disabled t
+;;     :load-path "site-lisp/ess/lisp/"
+;;     :commands R)
+;; Lastly, `use-package' provides built-in support for the diminish utility,
+;; if you have that installed.  It's purpose is to remove strings from your
+;; mode-line that would otherwise always be there and provide no useful
+;; information.  It is invoked with the `:diminish' keyword, which is passed
+;; either the minor mode symbol, or a cons of the symbol and a replacement string:
+;;   (use-package abbrev
+;;     :diminish abbrev-mode
+;;     :init
+;;     (if (file-exists-p abbrev-file-name)
+;;         (quietly-read-abbrev-file))
+;;     :config
+;;     (add-hook 'expand-load-hook
+;;               (lambda ()
+;;                 (add-hook 'expand-expand-hook 'indent-according-to-mode)
+;;                 (add-hook 'expand-jump-hook 'indent-according-to-mode))))
+;; If you noticed that this declaration has neither a `:bind', `:commands' or
+;; `:defer' keyword: congratulations, you're an A student!  What it means is
+;; that both the `:init' and `:config' forms will be executed when ".emacs" is
+;; loaded, with no delays until later.  Is this useful?  Not really.  I just
+;; happen to like separating my configuration into things that must happen at
+;; startup time, and things that could potentioally wait until after the
+;; actual load.  In this case, everything could be put inside `:init' and
+;; there would be no difference.
+;; * For el-get users
+;; You can use `use-package' as a way to create source definitions for el-get.
+;; All that's needed is to add a `:type' keyword to your declaration.  When
+;; this is present, certain keywords get translated to what el-get expects in
+;; the `el-get-sources' list:
+;;   :config   -> :after
+;;   :requires -> :depends
+;; A `:name' will be added also, if one is not provided explicitly, which will
+;; be the same as the name of the package.
+;; But why would you want to use `use-package' when you have el-get?  My
+;; answer is that I'd like to use el-get to install and update some packages,
+;; but I don't want it managing configuration.  Just loading el-get -- without
+;; call (el-get 'sync) -- takes a quarter second on my machine.  That's 25% of
+;; my load time!  `use-package' is designed for performance, so I only want to
+;; load el-get when it's time to install or update on of my used packages.
+;; Here is the `use-package' declaration I use for setting up el-get, but only
+;; when I want to install or update:
+;;   (defvar el-get-sources nil)
+;;   (use-package el-get
+;;     :commands (el-get
+;;                el-get-install
+;;                el-get-update
+;;                el-get-list-packages)
+;;     :config
+;;     (defun el-get-read-status-file ()
+;;       (mapcar #'(lambda (entry)
+;;                   (cons (plist-get entry :symbol)
+;;                         `(status "installed" recipe ,entry)))
+;;               el-get-sources)))
+;;; Code:
+(require 'bind-key)
+(require 'bytecomp)
+(require 'diminish nil t)
+  (require 'cl))
+(defgroup use-package nil
+  "A use-package declaration for simplifying your .emacs"
+  :group 'startup)
+(defcustom use-package-verbose t
+  "Whether to report about loading and configuration details."
+  :type 'boolean
+  :group 'use-package)
+(defcustom use-package-debug nil
+  "Whether to report more information, mostly regarding el-get"
+  :type 'boolean
+  :group 'use-package)
+(defcustom use-package-minimum-reported-time 0.01
+  "Minimal load time that will be reported"
+  :type 'number
+  :group 'use-package
+  )
+(defmacro with-elapsed-timer (text &rest forms)
+  `(let ((now ,(if use-package-verbose
+                   '(current-time))))
+     ,(if use-package-verbose
+          `(message "%s..." ,text))
+     (prog1
+         ,@forms
+       ,(when use-package-verbose
+          `(let ((elapsed
+                  (float-time (time-subtract (current-time) now))))
+             (if (> elapsed use-package-minimum-reported-time)
+                 (message "%s...done (%.3fs)" ,text elapsed)
+               (message "%s...done" ,text)))))))
+(put 'with-elapsed-timer 'lisp-indent-function 1)
+(defun use-package-discover-el-get-type (args)
+  (let* ((pkg-name (plist-get args :name))
+         (git-config  (expand-file-name
+                       (concat pkg-name "/.git/config")
+                       (if (boundp 'user-site-lisp-directory)
+                           user-site-lisp-directory
+                         user-emacs-directory))))
+    (catch 'found
+      ;; Look for a readable .git/config with at least one defined remote.
+      (if (file-readable-p git-config)
+          (with-temp-buffer
+            (insert-file-contents-literally git-config)
+            (while (re-search-forward "\\[remote" nil t)
+              (if (re-search-forward "url = \\(.+\\)"
+                                     (save-excursion
+                                       (re-search-forward "\\[remote" nil t)
+                                       (point)) t)
+                  (nconc args (list :type 'git
+                                    :url (match-string 1))))))))
+    args))
+(defun use-package-ensure-elpa (package)
+  (when (not (package-installed-p package))
+    (package-install package)))
+(defmacro use-package (name &rest args)
+"Use a package with configuration options.
+For full documentation. please see commentary.
+  (use-package package-name
+     :keyword option)
+:init Code to run when `use-package' form evals.
+:bind Perform key bindings, and define autoload for bound
+      commands.
+:commands Define autoloads for given commands.
+:mode Form to be added to `auto-mode-alist'.
+:interpreter Form to be added to `auto-interpreter-alist'.
+:defer Defer loading of package -- automatic
+       if :commands, :bind, :mode or :interpreter are used.
+:config Runs if and when package loads.
+:if Conditional loading.
+:disabled Ignore everything.
+:defines Define vars to silence byte-compiler.
+:load-path Add to `load-path' before loading.
+:diminish Support for diminish package (if it's installed).
+  (let* ((commands (plist-get args :commands))
+         (pre-init-body (plist-get args :pre-init))
+         (init-body (plist-get args :init))
+         (config-body (plist-get args :config))
+         (diminish-var (plist-get args :diminish))
+         (defines (plist-get args :defines))
+         (keybindings )
+         (mode-alist )
+         (interpreter-alist )
+         (predicate (plist-get args :if))
+         (pkg-load-path (plist-get args :load-path))
+         (defines-eval (if (null defines)
+                           nil
+                         (if (listp defines)
+                             (mapcar (lambda (var) `(defvar ,var)) defines)
+                           `((defvar ,defines)))))
+         (requires (plist-get args :requires))
+         (requires-test (if (null requires)
+                            t
+                          (if (listp requires)
+                              `(not (member nil (mapcar #'featurep
+                                                        (quote ,requires))))
+                            `(featurep (quote ,requires)))))
+         (name-string (if (stringp name) name (symbol-name name)))
+         (name-symbol (if (stringp name) (intern name) name)))
+    ;; force this immediately -- one off cost
+    (unless (plist-get args :disabled)
+      (let* ((ensure (plist-get args :ensure))
+             (package-name
+              (or (and (eq ensure t)
+                       name)
+                  ensure)))
+      (when package-name
+        (use-package-ensure-elpa package-name)))
+      (if diminish-var
+          (setq config-body
+                `(progn
+                   ,config-body
+                   (ignore-errors
+                     ,@(if (listp diminish-var)
+                           (if (listp (cdr diminish-var))
+                               (mapcar (lambda (var)
+                                           (if (listp var)
+                                               `(diminish (quote ,(car var)) ,(cdr var))
+                                               `(diminish (quote ,var))))
+                                diminish-var)
+                               `((diminish (quote ,(car diminish-var)) ,(cdr diminish-var)))
+                           )
+                         `((diminish (quote ,diminish-var))))))))
+      (if (and commands (symbolp commands))
+          (setq commands (list commands)))
+      (flet ((init-for-commands
+              (func sym-or-list)
+              (let ((cons-list (if (and (consp sym-or-list)
+                                        (stringp (car sym-or-list)))
+                                   (list sym-or-list)
+                                 sym-or-list)))
+                (if cons-list
+                    (setq init-body
+                          `(progn
+                             ,init-body
+                             ,@(mapcar #'(lambda (elem)
+                                           (push (cdr elem) commands)
+                                           (funcall func elem))
+                                       cons-list)))))))
+        (init-for-commands #'(lambda (binding)
+                               `(bind-key ,(car binding)
+                                          (quote ,(cdr binding))))
+                           (plist-get args :bind))
+        (init-for-commands #'(lambda (mode)
+                               `(add-to-list 'auto-mode-alist
+                                             (quote ,mode)))
+                           (plist-get args :mode))
+        (init-for-commands #'(lambda (interpreter)
+                               `(add-to-list 'interpreter-mode-alist
+                                             (quote ,interpreter)))
+                           (plist-get args :interpreter)))
+      `(progn
+         ,@(mapcar
+            #'(lambda (path)
+                `(add-to-list 'load-path
+                              ,(if (file-name-absolute-p path)
+                                   path
+                                 (expand-file-name path user-emacs-directory))))
+            (cond ((stringp pkg-load-path)
+                   (list pkg-load-path))
+                  ((functionp pkg-load-path)
+                   (funcall pkg-load-path))
+                  (t
+                   pkg-load-path)))
+         (when byte-compile-current-file
+           ,@defines-eval
+           ,(if (stringp name)
+                `(load ,name t)
+              `(require ',name nil t)))
+         ,(when (boundp 'el-get-sources)
+            (require 'el-get)
+            (let ((recipe (ignore-errors
+                            (el-get-read-recipe name-symbol))))
+              (if (null recipe)
+                  (if use-package-debug
+                      (message "No el-get recipe found for package `%s'"
+                               name-symbol))
+                (setq args
+                      (mapcar #'(lambda (arg)
+                                  (cond
+                                   ((eq arg :config)
+                                    :after)
+                                   ((eq arg :requires)
+                                    :depends)
+                                   (t
+                                    arg)))
+                              args))
+                (nconc args (list :symbol (intern name-string)))
+                (let ((elem args))
+                  (while elem
+                    (unless (plist-get recipe (car elem))
+                      (plist-put recipe (car elem) (cadr elem)))
+                    (setq elem (cddr elem))))
+                (unless (plist-get recipe :name)
+                  (nconc recipe (list :name name-string)))
+                (unless (plist-get recipe :type)
+                  (setq recipe (use-package-discover-el-get-type recipe)))
+                (ignore
+                 (setq el-get-sources (cons recipe el-get-sources))))))
+         ,(if (or commands (plist-get args :defer))
+              (let (form)
+                (mapc #'(lambda (command)
+                          (push `(autoload (function ,command)
+                                   ,name-string nil t) form))
+                      commands)
+                `(when ,(or predicate t)
+                   ,pre-init-body
+                   ,@form
+                   ,init-body
+                   ,(unless (null config-body)
+                      `(eval-after-load ,name-string
+                         (quote
+                           (if ,requires-test
+                               ,(macroexpand-all
+                                  `(with-elapsed-timer
+                                       ,(format "Configuring package %s" name-string)
+                                     ,config-body))))))
+                   t))
+            `(if (and ,(or predicate t)
+                      ,requires-test)
+                 (with-elapsed-timer
+                     ,(format "Loading package %s" name-string)
+                   (if (not ,(if (stringp name)
+                                 `(load ,name t)
+                               `(require ',name nil t)))
+                       (message "Could not load package %s" ,name-string)
+                     ,pre-init-body
+                     ,init-body
+                     ,config-body
+                     t))))))))
+(put 'use-package 'lisp-indent-function 1)
+(provide 'use-package)
+;;; use-package.el ends here