]> code.delx.au - gnu-emacs-elpa/commitdiff
Add counsel-mode
authorjustbur <justin@burkett.cc>
Wed, 2 Mar 2016 21:08:39 +0000 (16:08 -0500)
committerOleh Krehel <ohwoeowho@gmail.com>
Thu, 3 Mar 2016 07:56:39 +0000 (08:56 +0100)
A minor-mode that remaps built-in functions that have counsel
replacements available.

Fixes #414

counsel.el

index 46300e953368d83ad69f069cf92ea27a3536bd01..456b8637c8d0aad369da775e2957c1de3d83e4ba 100644 (file)
@@ -1688,6 +1688,34 @@ An extra action allows to switch to the process buffer."
               ("e" counsel-rhythmbox-enqueue-song "Enqueue song"))
             :caller 'counsel-rhythmbox))
 
+(defvar counsel-mode-map
+  (let ((map (make-sparse-keymap)))
+    (dolist (binding
+             '((describe-bindings . counsel-descbinds)
+               (describe-function . counsel-describe-function)
+               (describe-variable . counsel-describe-variable)
+               (find-file         . counsel-find-file)
+               (imenu             . counsel-imenu)
+               (load-library      . counsel-load-library)
+               (load-theme        . counsel-load-theme)
+               (yank-pop          . counsel-yank-pop)))
+      (define-key map (vector 'remap (car binding)) (cdr binding)))
+    map)
+  "Map for `counsel-mode'. Remaps built-in functions to counsel
+replacements.")
+
+;;;###autoload
+(define-minor-mode counsel-mode
+  "Toggle Counsel mode on or off.
+Turn Counsel mode on if ARG is positive, off otherwise. Counsel
+mode remaps built-in emacs functions that have counsel
+replacements. "
+  :group 'ivy
+  :global t
+  :keymap counsel-mode-map
+  :lighter " counsel")
+
+
 (provide 'counsel)
 
 ;;; counsel.el ends here