emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] master 1d32ceb 332/348: counsel.el (counsel-irony): New command


From: Oleh Krehel
Subject: [elpa] master 1d32ceb 332/348: counsel.el (counsel-irony): New command
Date: Sat, 8 Apr 2017 11:04:25 -0400 (EDT)

branch: master
commit 1d32ceb704af74b113fd6ffadd2394f760d64ba9
Author: Oleh Krehel <address@hidden>
Commit: Oleh Krehel <address@hidden>

    counsel.el (counsel-irony): New command
---
 counsel.el | 35 ++++++++++++++++++++++++++++++++++-
 swiper.el  |  1 +
 2 files changed, 35 insertions(+), 1 deletion(-)

diff --git a/counsel.el b/counsel.el
index 7ec3a7b..9db9049 100644
--- a/counsel.el
+++ b/counsel.el
@@ -3240,7 +3240,40 @@ candidate."
               :history 'counsel-org-agenda-headlines-history
               :caller 'counsel-org-agenda-headlines)))
 
-;** `counsel-mode'
+;;** `counsel-irony'
+;;;###autoload
+(defun counsel-irony ()
+  "Inline C/C++ completion using Irony."
+  (interactive)
+  (irony-completion-candidates-async 'counsel-irony-callback))
+
+(defun counsel-irony-callback ()
+  (interactive)
+  (let ((coll (irony-completion-at-point)))
+    (when coll
+      (setq ivy-completion-beg (nth 0 coll))
+      (setq ivy-completion-end (nth 1 coll))
+      (ivy-read "code: " (mapcar #'counsel-irony-annotate
+                                 (nth 2 coll))
+                :caller 'counsel-irony
+                :action 'ivy-completion-in-region-action))))
+
+(defun counsel-irony-annotate (x)
+  (cons
+   (condition-case nil
+       (concat
+        x " "
+        (irony-completion--at-point-annotate x))
+     (error x))
+   x))
+
+(add-to-list 'ivy-display-functions-alist '(counsel-irony . 
ivy-display-function-overlay))
+
+(declare-function irony-completion-candidates-async "ext:irony-completion")
+(declare-function irony-completion-at-point "ext:irony-completion")
+(declare-function irony-completion--at-point-annotate "ext:irony-completion")
+
+;;** `counsel-mode'
 (defvar counsel-mode-map
   (let ((map (make-sparse-keymap)))
     (dolist (binding
diff --git a/swiper.el b/swiper.el
index ce7c07c..7aa2875 100644
--- a/swiper.el
+++ b/swiper.el
@@ -139,6 +139,7 @@
 (declare-function avy--process "ext:avy")
 (declare-function avy--overlay-post "ext:avy")
 (declare-function avy-action-goto "ext:avy")
+(declare-function avy-candidate-beg "ext:avy")
 (declare-function avy--done "ext:avy")
 (declare-function avy--make-backgrounds "ext:avy")
 (declare-function avy-window-list "ext:avy")



reply via email to

[Prev in Thread] Current Thread [Next in Thread]