[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] master 048f479 13/19: Add four more commands
From: |
Oleh Krehel |
Subject: |
[elpa] master 048f479 13/19: Add four more commands |
Date: |
Thu, 16 Apr 2015 12:18:13 +0000 |
branch: master
commit 048f4794bf1798ec5391bef6c89457303dbc6692
Author: Oleh Krehel <address@hidden>
Commit: Oleh Krehel <address@hidden>
Add four more commands
* counsel.el (counsel-describe-variable): New defun.
(counsel-describe-function): New defun.
(counsel-info-lookup-symbol): New defun.
(counsel-unicode-char): New defun.
* Makefile: Compile counsel.el as well.
---
Makefile | 2 +-
counsel.el | 81 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 82 insertions(+), 1 deletions(-)
diff --git a/Makefile b/Makefile
index 453f709..7c9910e 100644
--- a/Makefile
+++ b/Makefile
@@ -10,7 +10,7 @@ test:
$(emacs) -batch $(LOAD) -l ivy-test.el -f ert-run-tests-batch-and-exit
compile:
- $(emacs) -batch $(LOAD) --eval "(mapc #'byte-compile-file '(\"ivy.el\"
\"swiper.el\"))"
+ $(emacs) -batch $(LOAD) --eval "(mapc #'byte-compile-file '(\"ivy.el\"
\"swiper.el\" \"counsel.el\"))"
clean:
rm -f *.elc
diff --git a/counsel.el b/counsel.el
index 22884ea..24e9d6d 100644
--- a/counsel.el
+++ b/counsel.el
@@ -40,6 +40,87 @@
(counsel--generic
(lambda (str) (all-completions str obarray))))
+(defun counsel-describe-variable (variable &optional buffer frame)
+ "Forward to (`describe-variable' VARIABLE BUFFER FRAME)."
+ (interactive
+ (let ((v (variable-at-point))
+ (enable-recursive-minibuffers t)
+ val)
+ (setq val (ivy-read
+ (if (symbolp v)
+ (format
+ "Describe variable (default %s): " v)
+ "Describe variable: ")
+ (let (cands)
+ (mapatoms
+ (lambda (vv)
+ (when (or (get vv 'variable-documentation)
+ (and (boundp vv) (not (keywordp vv))))
+ (push (symbol-name vv) cands))))
+ cands)))
+ (list (if (equal val "")
+ v
+ (intern val)))))
+ (describe-variable variable buffer frame))
+
+(defun counsel-describe-function (function)
+ "Forward to (`describe-function' FUNCTION) with ivy completion."
+ (interactive
+ (let ((fn (function-called-at-point))
+ (enable-recursive-minibuffers t)
+ val)
+ (setq val (ivy-read (if fn
+ (format "Describe function (default %s): " fn)
+ "Describe function: ")
+ (let (cands)
+ (mapatoms
+ (lambda (x)
+ (when (fboundp x)
+ (push (symbol-name x) cands))))
+ cands)))
+ (list (if (equal val "")
+ fn (intern val)))))
+ (describe-function function))
+
+(defvar info-lookup-mode)
+(declare-function info-lookup->completions "info-look")
+(declare-function info-lookup->mode-value "info-look")
+(declare-function info-lookup-select-mode "info-look")
+(declare-function info-lookup-change-mode "info-look")
+(declare-function info-lookup "info-look")
+
+(defun counsel-info-lookup-symbol (symbol &optional mode)
+ "Forward to (`info-describe-symbol' SYMBOL MODE) with ivy completion."
+ (interactive
+ (progn
+ (require 'info-look)
+ (let* ((topic 'symbol)
+ (mode (cond (current-prefix-arg
+ (info-lookup-change-mode topic))
+ ((info-lookup->mode-value
+ topic (info-lookup-select-mode))
+ info-lookup-mode)
+ ((info-lookup-change-mode topic))))
+ (completions (info-lookup->completions topic mode))
+ (enable-recursive-minibuffers t)
+ (value (ivy-read
+ "Describe symbol: "
+ (mapcar #'car completions))))
+ (list value info-lookup-mode))))
+ (info-lookup 'symbol symbol mode))
+
+(defun counsel-unicode-char ()
+ "Insert a Unicode character at point."
+ (interactive)
+ (let* ((minibuffer-allow-text-properties t)
+ (char (ivy-read "Unicode name: "
+ (mapcar (lambda (x)
+ (propertize
+ (format "% -60s%c" (car x) (cdr x))
+ 'result (cdr x)))
+ (ucs-names)))))
+ (insert-char (get-text-property 0 'result char))))
+
(defun counsel-clj ()
"Clojure completion at point."
(interactive)
- [elpa] master e816884 03/19: Default ARG to 1 for arrows, (continued)
- [elpa] master e816884 03/19: Default ARG to 1 for arrows, Oleh Krehel, 2015/04/16
- [elpa] master a8a1f65 02/19: Add numeric arguments to arrows, Oleh Krehel, 2015/04/16
- [elpa] master 0477214 08/19: Fix `ivy-backward-delete-char-function', Oleh Krehel, 2015/04/16
- [elpa] master 6dd1068 04/19: swiper.el (swiper-query-replace): Enable recursive minibuffers, Oleh Krehel, 2015/04/16
- [elpa] master 3b78e0e 18/19: swiper.el: Bump version, Oleh Krehel, 2015/04/16
- [elpa] master 22139ae 19/19: Merge commit '3b78e0e503f4763f8a2d77eeacfc91213ec5532e' from swiper, Oleh Krehel, 2015/04/16
- [elpa] master c59752b 16/19: Update sorting order, make sure that perfect match is selected, Oleh Krehel, 2015/04/16
- [elpa] master 75aa14d 17/19: Fix thing-at-point in describe-function and -variable, Oleh Krehel, 2015/04/16
- [elpa] master 6a098c6 15/19: Add ivy-mode, Oleh Krehel, 2015/04/16
- [elpa] master 592b692 07/19: Add defcustom for ivy-backward-delete-char, Oleh Krehel, 2015/04/16
- [elpa] master 048f479 13/19: Add four more commands,
Oleh Krehel <=
- [elpa] master be452cc 14/19: swiper.el (swiper-font-lock-ensure): Exclude org-agenda-mode, Oleh Krehel, 2015/04/16
- [elpa] master ba0590f 09/19: counsel.el: Update comments, Oleh Krehel, 2015/04/16