branch: master
commit 9967b2dd205453b73e8fa5f7bdb3fde3fd9c1c02
Author: Oleh Krehel <[email protected]>
Commit: Oleh Krehel <[email protected]>

    counsel.el (counsel-describe-function-preselect): New defcustom
    
    Fixes #1088
    Fixes #1330
---
 counsel.el | 14 +++++++++++++-
 1 file changed, 13 insertions(+), 1 deletion(-)

diff --git a/counsel.el b/counsel.el
index f76a580..6689937 100644
--- a/counsel.el
+++ b/counsel.el
@@ -558,6 +558,18 @@ Variables declared using `defcustom' are highlighted 
according to
 (ivy-set-display-transformer
  'counsel-describe-function 'counsel-describe-function-transformer)
 
+(defun ivy-function-called-at-point ()
+  (let ((f (function-called-at-point)))
+    (and f (symbol-name f))))
+
+(defcustom counsel-describe-function-preselect 'ivy-thing-at-point
+  "Determine what `counsel-describe-function' should preselect."
+  :type
+  '(choice
+    (const ivy-thing-at-point)
+    (const ivy-function-called-at-point))
+  :group 'ivy)
+
 ;;;###autoload
 (defun counsel-describe-function ()
   "Forward to `describe-function'.
@@ -574,7 +586,7 @@ to `ivy-highlight-face'."
                      (push (symbol-name x) cands))))
                 cands)
               :keymap counsel-describe-map
-              :preselect (ivy-thing-at-point)
+              :preselect (funcall counsel-describe-function-preselect)
               :history 'counsel-describe-symbol-history
               :require-match t
               :sort t

Reply via email to