branch: master
commit 47f53b605abadccf19e3c6b55aef5360ae197249
Author: Oleh Krehel <[email protected]>
Commit: Oleh Krehel <[email protected]>
counsel.el (counsel--find-symbol): Resolve name clash better
* counsel.el (counsel--find-symbol): When the symbol is both bound and
fbound, prefer the fbound one, unless the :caller is
`counsel-describe-variable'.
(counsel-describe-variable): Declare :caller.
(counsel-describe-function): Declare :caller.
One example is going to the definition of `isearch-forward' (also with
`counsel-M-x').
---
counsel.el | 12 +++++++++---
1 files changed, 9 insertions(+), 3 deletions(-)
diff --git a/counsel.el b/counsel.el
index ef67be9..eab1a3c 100644
--- a/counsel.el
+++ b/counsel.el
@@ -175,10 +175,14 @@
(if full-name
(find-library full-name)
(let ((sym (read x)))
- (cond ((boundp sym)
+ (cond ((and (eq (ivy-state-caller ivy-last)
+ 'counsel-describe-variable)
+ (boundp sym))
(find-variable sym))
((fboundp sym)
(find-function sym))
+ ((boundp sym)
+ (find-variable sym))
((or (featurep sym)
(locate-library
(prin1-to-string sym)))
@@ -224,7 +228,8 @@
:sort t
:action (lambda (x)
(describe-variable
- (intern x))))))
+ (intern x)))
+ :caller 'counsel-describe-variable)))
(ivy-set-actions
'counsel-describe-variable
@@ -255,7 +260,8 @@
:sort t
:action (lambda (x)
(describe-function
- (intern x))))))
+ (intern x)))
+ :caller 'counsel-describe-function)))
(defvar info-lookup-mode)
(declare-function info-lookup->completions "info-look")