branch: master
commit 08bd5b45ee5d22b5f018b4319b97f8979f8c07f7
Author: Oleh Krehel <[email protected]>
Commit: Oleh Krehel <[email protected]>
counsel.el (counsel-variable-list): Add
* counsel.el (counsel-describe-variable): Use `counsel-variable-list'.
---
counsel.el | 18 +++++++++++-------
1 files changed, 11 insertions(+), 7 deletions(-)
diff --git a/counsel.el b/counsel.el
index 5d14416..bbb8230 100644
--- a/counsel.el
+++ b/counsel.el
@@ -142,6 +142,16 @@
(match-string 1 s)
s))))
+(defun counsel-variable-list ()
+ "Return the list of all currently bound variables."
+ (let (cands)
+ (mapatoms
+ (lambda (vv)
+ (when (or (get vv 'variable-documentation)
+ (and (boundp vv) (not (keywordp vv))))
+ (push (symbol-name vv) cands))))
+ cands))
+
;;;###autoload
(defun counsel-describe-variable ()
"Forward to `describe-variable'."
@@ -149,13 +159,7 @@
(let ((enable-recursive-minibuffers t))
(ivy-read
"Describe variable: "
- (let (cands)
- (mapatoms
- (lambda (vv)
- (when (or (get vv 'variable-documentation)
- (and (boundp vv) (not (keywordp vv))))
- (push (symbol-name vv) cands))))
- cands)
+ (counsel-variable-list)
:keymap counsel-describe-map
:preselect (counsel-symbol-at-point)
:history 'counsel-describe-symbol-history