From 12b640f53c6fe5230de902981818460eec791d56 Mon Sep 17 00:00:00 2001 From: 10sr <8.slashes@gmail.com> Date: Fri, 10 Jan 2020 15:28:13 +0900 Subject: [PATCH] Add my-counsel-describe-symbol --- emacs.el | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/emacs.el b/emacs.el index 3da68e0..7304771 100644 --- a/emacs.el +++ b/emacs.el @@ -2496,6 +2496,34 @@ Any output will be written to current buffer." ;; (counsel-fzf))))) ) +(when (eval-and-compile (require 'counsel nil t)) + + (defvar counsel-describe-map) + + (defun my-counsel-describe-symbol () + "Forwaord to `describe-symbol'." + (interactive) + (ivy-read "Describe symbol: " obarray + :predicate (lambda (sym) + (or (fboundp sym) + (boundp sym) + (facep sym) + (symbol-plist sym))) + :require-match t + :history 'counsel-describe-symbol-history + :keymap counsel-describe-map + :preselect (ivy-thing-at-point) + :action (lambda (x) + (describe-symbol (intern x))) + :caller 'my-counsel-describe-symbol)) + + (ivy-configure 'my-counsel-describe-symbol + :sort-fn #'ivy-string<) + + (define-key help-map "o" 'my-counsel-describe-symbol) + ) + + (when (fboundp 'counsel-imenu) (define-key ctl-x-map "l" 'counsel-imenu))