From 9525d382a9e339b395c8070432de8d9379d7c1ac Mon Sep 17 00:00:00 2001 From: jao Date: Sun, 14 Mar 2021 03:39:39 +0000 Subject: configuration for consult-recoll --- consult.org | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/consult.org b/consult.org index 433b95d..21e111c 100644 --- a/consult.org +++ b/consult.org @@ -98,6 +98,36 @@ (jao-load-path "consult-notmuch") (use-package consult-notmuch) #+end_src +*** recoll + #+begin_src emacs-lisp + (jao-load-path "consult-recoll") + + (defun jao-recoll-open-mail (fname) + (let ((group (jao-notmuch-file-to-group fname)) + (id (with-temp-buffer + (insert-file fname) + (goto-char (point-min)) + (message-mode) + (not-modified) + (message-fetch-field "Message-ID")))) + (when (and group id) (org-gnus-follow-link group id)))) + + (defun jao-recoll-format (title url mtype) + (let* ((u (replace-regexp-in-string "/home/jao/" "" url)) + (u (replace-regexp-in-string "\\(doc\\|org/doc\\|var/mail\\)/" "" u))) + (format "%s (%s, %s)" + title + (propertize u 'face 'jao-themes-f00) + (propertize mtype 'face 'jao-themes-f01)))) + + (use-package consult-recoll + :init (setq consult-recoll-open-fns + '(("application/pdf" . jao-open-doc) + ("message/rfc822" . jao-recoll-open-mail)) + consult-recoll-format-candidate #'jao-recoll-format) + :bind (("C-c R" . #'consult-recoll))) + + #+end_src *** dh-diff hunks #+begin_src emacs-lisp (defun jao-consult--diff-lines (&optional backward) -- cgit v1.2.3