[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/ivy-hydra 92e5a95 252/395: Add command counsel-describe
From: |
Basil L. Contovounesios |
Subject: |
[elpa] externals/ivy-hydra 92e5a95 252/395: Add command counsel-describe-symbol |
Date: |
Thu, 25 Feb 2021 08:32:14 -0500 (EST) |
branch: externals/ivy-hydra
commit 92e5a953408447f013f9f976052c772aa2581389
Author: Basil L. Contovounesios <contovob@tcd.ie>
Commit: Oleh Krehel <ohwoeowho@gmail.com>
Add command counsel-describe-symbol
* counsel.el (counsel-describe-symbol-function): New user option.
(counsel-describe-symbol): New command.
(counsel-describe-symbol-history, counsel-mode-map):
* ivy.el (ivy--occur-press-update-window):
* README.md: List it alongside counsel-describe-variable and
counsel-describe-function.
Fixes #2509
Fixes #2542
---
README.md | 1 +
counsel.el | 39 +++++++++++++++++++++++++++++++++++++--
ivy.el | 4 +++-
3 files changed, 41 insertions(+), 3 deletions(-)
diff --git a/README.md b/README.md
index 658504f..f1ce587 100644
--- a/README.md
+++ b/README.md
@@ -61,6 +61,7 @@ Ivy and Swiper wiki is here: [the
wiki](https://github.com/abo-abo/swiper/wiki).
(global-set-key (kbd "C-x C-f") 'counsel-find-file)
(global-set-key (kbd "<f1> f") 'counsel-describe-function)
(global-set-key (kbd "<f1> v") 'counsel-describe-variable)
+(global-set-key (kbd "<f1> o") 'counsel-describe-symbol)
(global-set-key (kbd "<f1> l") 'counsel-find-library)
(global-set-key (kbd "<f2> i") 'counsel-info-lookup-symbol)
(global-set-key (kbd "<f2> u") 'counsel-unicode-char)
diff --git a/counsel.el b/counsel.el
index 20a470f..2d1cb82 100644
--- a/counsel.el
+++ b/counsel.el
@@ -480,8 +480,8 @@ Update the minibuffer with the amount of lines collected
every
(defvar counsel-describe-symbol-history ()
"History list for variable and function names.
-Used by commands `counsel-describe-variable' and
-`counsel-describe-function'.")
+Used by commands `counsel-describe-symbol',
+`counsel-describe-variable', and `counsel-describe-function'.")
(defun counsel-find-symbol ()
"Jump to the definition of the current symbol."
@@ -621,6 +621,40 @@ to `ivy-highlight-face'."
:display-transformer-fn #'counsel-describe-function-transformer
:sort-fn #'ivy-string<)
+;;** `counsel-describe-symbol'
+(defcustom counsel-describe-symbol-function #'describe-symbol
+ "Function to call to describe a symbol passed as parameter."
+ :type 'function)
+
+(defun counsel-describe-symbol ()
+ "Forward to `describe-symbol'."
+ (interactive)
+ (unless (functionp 'describe-symbol)
+ (user-error "This command requires Emacs 25.1 or later"))
+ (require 'help-mode)
+ (let ((enable-recursive-minibuffers t))
+ (ivy-read "Describe symbol: " obarray
+ :predicate (lambda (sym)
+ (cl-some (lambda (backend)
+ (funcall (cadr backend) sym))
+ describe-symbol-backends))
+ :require-match t
+ :history 'counsel-describe-symbol-history
+ :keymap counsel-describe-map
+ :preselect (ivy-thing-at-point)
+ :action (lambda (x)
+ (funcall counsel-describe-symbol-function (intern x)))
+ :caller 'counsel-describe-symbol)))
+
+(ivy-configure #'counsel-describe-symbol
+ :initial-input "^"
+ :sort-fn #'ivy-string<)
+
+(ivy-set-actions
+ #'counsel-describe-symbol
+ `(("I" ,#'counsel-info-lookup-symbol "info")
+ ("d" ,#'counsel--find-symbol "definition")))
+
;;** `counsel-set-variable'
(defvar counsel-set-variable-history nil
"Store history for `counsel-set-variable'.")
@@ -6760,6 +6794,7 @@ We update it in the callback with
`ivy-update-candidates'."
(describe-bindings . counsel-descbinds)
(describe-function . counsel-describe-function)
(describe-variable . counsel-describe-variable)
+ (describe-symbol . counsel-describe-symbol)
(apropos-command . counsel-apropos)
(describe-face . counsel-describe-face)
(list-faces-display . counsel-faces)
diff --git a/ivy.el b/ivy.el
index 3eb6b9a..d8ae33d 100644
--- a/ivy.el
+++ b/ivy.el
@@ -5181,7 +5181,9 @@ EVENT gives the mouse position."
(switch-to-buffer buffer)))))))
((memq (ivy-state-caller ivy-occur-last)
- '(counsel-describe-function counsel-describe-variable))
+ '(counsel-describe-function
+ counsel-describe-variable
+ counsel-describe-symbol))
(setf (ivy-state-window ivy-occur-last)
(selected-window))
(selected-window))))
- [elpa] externals/ivy-hydra dc60eac 201/395: ivy.el (ivy-read-action-by-key): Fix keys to quit action selection, (continued)
- [elpa] externals/ivy-hydra dc60eac 201/395: ivy.el (ivy-read-action-by-key): Fix keys to quit action selection, Basil L. Contovounesios, 2021/02/25
- [elpa] externals/ivy-hydra 251c219 193/395: Enable setting the display function with ivy-configure, Basil L. Contovounesios, 2021/02/25
- [elpa] externals/ivy-hydra ee2a537 204/395: * counsel.el (counsel-mark--get-evil-candidates): Fix typo, Basil L. Contovounesios, 2021/02/25
- [elpa] externals/ivy-hydra eeb14b1 213/395: ivy-test.el (ivy-read-history): Add a test, Basil L. Contovounesios, 2021/02/25
- [elpa] externals/ivy-hydra 1bf5b98 234/395: ivy.el: Fix next-error randomly jumping to previous match, Basil L. Contovounesios, 2021/02/25
- [elpa] externals/ivy-hydra bd9945b 243/395: Fix recent regression in ivy--preselect-index, Basil L. Contovounesios, 2021/02/25
- [elpa] externals/ivy-hydra 0ecc41c 240/395: * ivy.el (ivy-occur-next-error): Use dolist., Basil L. Contovounesios, 2021/02/25
- [elpa] externals/ivy-hydra ec16352 253/395: ivy.el (ivy-resume): Check that :action is not identity, Basil L. Contovounesios, 2021/02/25
- [elpa] externals/ivy-hydra f3f4c8c 246/395: Fix ivy-auto-shrink-minibuffer regression, Basil L. Contovounesios, 2021/02/25
- [elpa] externals/ivy-hydra 57c7d7c 259/395: Call actions with default-directory bound to last state dir, Basil L. Contovounesios, 2021/02/25
- [elpa] externals/ivy-hydra 92e5a95 252/395: Add command counsel-describe-symbol,
Basil L. Contovounesios <=
- [elpa] externals/ivy-hydra 16d391d 263/395: ivy.el (ivy--done): Handle ivy-text being a full path when on remote, Basil L. Contovounesios, 2021/02/25
- [elpa] externals/ivy-hydra ce5b20a 283/395: counsel.el (counsel-grep-like-occur): Fix for a list arg, Basil L. Contovounesios, 2021/02/25
- [elpa] externals/ivy-hydra db5a894 327/395: ivy-test.el (ivy-with): Don't use counsel-locate-git-root, Basil L. Contovounesios, 2021/02/25
- [elpa] externals/ivy-hydra 0b5c08a 308/395: counsel.el (counsel-grep-like-occur): Fix copy-sequence for cl-mapcan, Basil L. Contovounesios, 2021/02/25
- [elpa] externals/ivy-hydra aef1d4d 302/395: ivy.el (ivy-configure): Add :parent keyword, Basil L. Contovounesios, 2021/02/25
- [elpa] externals/ivy-hydra cbcb7ad 034/395: swiper.el (swiper-isearch-format-function): Refactor, Basil L. Contovounesios, 2021/02/25
- [elpa] externals/ivy-hydra 388e0d4 043/395: ivy.el (ivy--magic-tilde-directory): Fix for non-standard home path, Basil L. Contovounesios, 2021/02/25
- [elpa] externals/ivy-hydra 5e393b0 047/395: .travis.yml (env): Bump to emacs-26.3-travis, Basil L. Contovounesios, 2021/02/25
- [elpa] externals/ivy-hydra 2d4d6d6 076/395: Use text, not "current", in -dispatching-done when no matches, Basil L. Contovounesios, 2021/02/25
- [elpa] externals/ivy-hydra 8c23823 073/395: ivy-test.el (ivy-swiper-wgrep): Re-enable on 24.5, Basil L. Contovounesios, 2021/02/25