]> code.delx.au - gnu-emacs-elpa/commitdiff
Fix describe-function / -variable "C-." interaction
authorOleh Krehel <ohwoeowho@gmail.com>
Tue, 21 Apr 2015 11:46:07 +0000 (13:46 +0200)
committerOleh Krehel <ohwoeowho@gmail.com>
Tue, 21 Apr 2015 11:46:07 +0000 (13:46 +0200)
* 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

index 62159b90ce1fc0d10e06bf713ed727d23ebfaa74..7ad7787ff92f6df90543efe81703b83ea40a6e1d 100644 (file)
@@ -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."
          (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: ")
                          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")