branch: master
commit d945699c7b10a73bd90ab1d8a4c008458400c24f
Author: Jérôme M. Berger <[email protected]>
Commit: Oleh Krehel <[email protected]>
counsel.el: Add a generic minibuffer history browser.
This supersedes counsel-shell-command-history and counsel-expression-history
with a generic counsel-minibuffer-history function that works for all
minibuffer situations.
---
README.md | 2 +-
counsel.el | 18 ++++++++++++++----
2 files changed, 15 insertions(+), 5 deletions(-)
diff --git a/README.md b/README.md
index 884dd8a..1359ede 100644
--- a/README.md
+++ b/README.md
@@ -61,7 +61,7 @@ Ivy and Swiper wiki is here: [the
wiki](https://github.com/abo-abo/swiper/wiki).
(global-set-key (kbd "C-c k") 'counsel-ag)
(global-set-key (kbd "C-x l") 'counsel-locate)
(global-set-key (kbd "C-S-o") 'counsel-rhythmbox)
-(define-key read-expression-map (kbd "C-r") 'counsel-expression-history)
+(define-key minibuffer-local-map (kbd "C-r") 'counsel-minibuffer-history)
```
# Counsel
diff --git a/counsel.el b/counsel.el
index 9c1c905..270cc00 100644
--- a/counsel.el
+++ b/counsel.el
@@ -3170,6 +3170,18 @@ And insert it into the minibuffer. Useful during
`eval-expression'."
:action #'insert
:caller 'counsel-shell-command-history))
+;;** `counsel-minibuffer-history'
+;;;###autoload
+(defun counsel-minibuffer-history ()
+ "Browse minibuffer history."
+ (interactive)
+ (let ((enable-recursive-minibuffers t))
+ (ivy-read "Reverse-i-search: " (symbol-value minibuffer-history-variable)
+ :action #'insert
+ :caller 'counsel-minibuffer-history)))
+(make-obsolete 'counsel-expression-history 'counsel-minibuffer-history
"20171011")
+(make-obsolete 'counsel-shell-command-history 'counsel-minibuffer-history
"20171011")
+
;;** `counsel-esh-history'
(defun counsel--browse-history (elements)
"Use Ivy to navigate through ELEMENTS."
@@ -4158,10 +4170,8 @@ replacements. "
(when (and (fboundp 'advice-add)
counsel-mode-override-describe-bindings)
(advice-add #'describe-bindings :override #'counsel-descbinds))
- (define-key minibuffer-local-shell-command-map (kbd "C-r")
- 'counsel-shell-command-history)
- (define-key read-expression-map (kbd "C-r")
- 'counsel-expression-history))
+ (define-key minibuffer-local-map (kbd "C-r")
+ 'counsel-minibuffer-history))
(when (fboundp 'advice-remove)
(advice-remove #'describe-bindings #'counsel-descbinds))))