branch: master
commit 675bd5ff97f75fb7d838e6056442ce71adf85e56
Author: Oleh Krehel <[email protected]>
Commit: Oleh Krehel <[email protected]>

    Fix describe-function / -variable "C-." interaction
    
    * counsel.el (counsel-describe-variable): Don't describe variable if
      jump-to-symbol action was chosen.
    (counsel-describe-function): Don't describe variable if
      jump-to-symbol action was chosen.
    
    I should handle this more gracefully if multiple actions become a
    pattern.
---
 counsel.el |    8 ++++++--
 1 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/counsel.el b/counsel.el
index 62159b9..7ad7787 100644
--- a/counsel.el
+++ b/counsel.el
@@ -73,6 +73,7 @@
          (enable-recursive-minibuffers t)
          (preselect (thing-at-point 'symbol))
          val)
+     (setq ivy--action nil)
      (setq val (ivy-read
                 (if (symbolp v)
                     (format
@@ -90,7 +91,8 @@
      (list (if (equal val "")
                v
              (intern val)))))
-  (describe-variable variable buffer frame))
+  (unless (eq ivy--action 'counsel--find-symbol)
+    (describe-variable variable buffer frame)))
 
 (defun counsel-describe-function (function)
   "Forward to (`describe-function' FUNCTION) with ivy completion."
@@ -99,6 +101,7 @@
          (enable-recursive-minibuffers t)
          (preselect (thing-at-point 'symbol))
          val)
+     (setq ivy--action nil)
      (setq val (ivy-read (if fn
                              (format "Describe function (default %s): " fn)
                            "Describe function: ")
@@ -112,7 +115,8 @@
                          nil t))
      (list (if (equal val "")
                fn (intern val)))))
-  (describe-function function))
+  (unless (eq ivy--action 'counsel--find-symbol)
+    (describe-function function)))
 
 (defvar info-lookup-mode)
 (declare-function info-lookup->completions "info-look")

Reply via email to