summaryrefslogtreecommitdiffhomepage
path: root/attic
diff options
context:
space:
mode:
Diffstat (limited to 'attic')
-rw-r--r--attic/counsel.org38
1 files changed, 31 insertions, 7 deletions
diff --git a/attic/counsel.org b/attic/counsel.org
index 5732fb7..6fbd591 100644
--- a/attic/counsel.org
+++ b/attic/counsel.org
@@ -64,13 +64,6 @@
:diminish)
#+end_src
* counsel add-ons
-*** recoll
- #+BEGIN_SRC emacs-lisp
- (use-package jao-recoll)
- (use-package jao-counsel-recoll
- :after counsel
- :bind (("C-c R" . jao-counsel-recoll)))
- #+END_SRC
*** notmuch
#+begin_src emacs-lisp
(use-package counsel-notmuch
@@ -78,6 +71,37 @@
:config (with-eval-after-load "gnus-group"
(define-key gnus-group-mode-map "Gg" 'counsel-notmuch)))
#+end_src
+*** recoll
+ #+begin_src emacs-lisp
+ (require 'jao-recoll)
+ (defvar jao-counsel-recoll--history nil)
+ (defun jao-counsel-recoll--function (str)
+ (let ((xs (counsel-recoll-function str)))
+ (cl-remove-if-not (lambda (x) (string-prefix-p "file://" x)) xs)))
+
+ (defun jao-counsel-recoll (&optional initial-input)
+ (interactive)
+ (counsel-require-program "recoll")
+ (ivy-read "recoll: " 'jao-counsel-recoll--function
+ :initial-input initial-input
+ :dynamic-collection t
+ :history 'jao-counsel-recoll--history
+ :action (lambda (x)
+ (when (string-match "file://\\(.*\\)\\'" x)
+ (let ((file-name (match-string 1 x)))
+ (if (string-match "pdf$" x)
+ (jao-open-doc file-name)
+ (find-file file-name)))))
+ :unwind #'counsel-delete-process
+ :caller 'jao-counsel-recoll))
+
+ (defun jao-counsel-recoll--recoll (_s) (jao-recoll ivy-text))
+
+ (ivy-set-actions 'jao-counsel-recoll
+ '(("x" jao-counsel-recoll--recoll "List in buffer")))
+
+ (global-set-key (kbd "C-c R") #'jao-counsel-recoll)
+ #+end_src
* ivy rich
#+begin_src emacs-lisp
(use-package ivy-rich