From 5639716fd17b37569ac203297f52b063df54a270 Mon Sep 17 00:00:00 2001 From: jao Date: Thu, 24 Mar 2022 04:46:45 +0000 Subject: recoll improvements (transient) --- completion.org | 29 ++++++++++++++++++++++++++--- exwm.org | 3 ++- init.org | 2 +- lib/doc/jao-recoll.el | 8 ++++---- org.org | 2 +- 5 files changed, 34 insertions(+), 10 deletions(-) diff --git a/completion.org b/completion.org index 49c718a..2d2ea91 100644 --- a/completion.org +++ b/completion.org @@ -268,19 +268,42 @@ (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))) + (u (replace-regexp-in-string + "\\(doc\\|org/doc\\|.emacs.d/gnus/Mail\\)/" "" u))) (format "%s (%s, %s)" title (propertize u 'face 'jao-themes-f00) (propertize mtype 'face 'jao-themes-f01)))) + (defun jao-recoll-open-html (file) + (jao-afio--goto-www) + (eww-open-file file)) + + (defun jao-recoll-consult-messages () + (interactive) + (consult-recoll "mime:messages ")) + + (defun jao-recoll-consult-docs () + (interactive) + (consult-recoll (format "dir:%s/doc " jao-org-dir))) + (use-package consult-recoll :init (setq consult-recoll-open-fns '(("application/pdf" . jao-open-doc) - ("message/rfc822" . jao-org-links-open-mail)) + ("message/rfc822" . jao-org-links-open-mail) + ("text/html" . jao-recoll-open-html)) consult-recoll-search-flags nil consult-recoll-format-candidate #'jao-recoll-format) - :bind (("C-c R" . #'consult-recoll))) + :config + (transient-define-prefix jao-recoll-transient () + ["Recoll queries" + ("o" "recoll query" jao-recoll) + ("r" "consult recoll query" consult-recoll) + ("n" "consult recoll on notes" jao-org-notes-recoll) + ("d" "consult recoll on docs" jao-recoll-consult-docs) + ("m" "consult recoll on messages" jao-recoll-consult-messages)]) + + :bind (("s-r" . #'jao-recoll-transient))) #+end_src *** dh-diff hunks diff --git a/exwm.org b/exwm.org index 1c77d6d..d5efefe 100644 --- a/exwm.org +++ b/exwm.org @@ -538,7 +538,8 @@ ([?\s-o] . jao-other-window) ([?\s-P] . jao-transpose-windows-prev) ([?\s-p] . jao-prev-window) - ([?\s-r] . app-launcher-run-app) + ([?\s-R] . app-launcher-run-app) + ([?\s-r] . jao-recoll-transient) ([?\s-s] . jao-transient-streaming) ([?\s-t] . vterm) ([?\s-w] . jao-transient-utils) diff --git a/init.org b/init.org index f2a99b4..2c3b050 100644 --- a/init.org +++ b/init.org @@ -145,7 +145,7 @@ #+begin_src emacs-lisp (jao-load-path "app-launcher") (use-package app-launcher - :bind (("s-r" . app-launcher-run-app))) + :bind (("s-R" . app-launcher-run-app))) #+end_src *** Brightness control #+begin_src emacs-lisp diff --git a/lib/doc/jao-recoll.el b/lib/doc/jao-recoll.el index 7c64c7d..0c781d9 100644 --- a/lib/doc/jao-recoll.el +++ b/lib/doc/jao-recoll.el @@ -1,6 +1,6 @@ ;; jao-recoll.el -- Displaying recoll queries -;; Copyright (c) 2017, 2020, 2021 Jose Antonio Ortega Ruiz +;; Copyright (c) 2017, 2020, 2021, 2022 Jose Antonio Ortega Ruiz ;; This file is free software; you can redistribute it and/or modify ;; it under the terms of the GNU General Public License as published by @@ -37,12 +37,12 @@ (defvar jao-recoll--file-regexp "\\(\\w+/\\w+\\)\t+\\[\\([^]]+\\)\\]\t+\\[\\([^]]+\\)\\].+") -(defvar jao-recoll-flags "-A -p 5 -n 20") +(defvar jao-recoll-flags "-A -p 5 -n 50") ;;;###autoload (defun jao-recoll (keywords) - "Performs a query using recoll and shows the results in a -buffer using org mode." + "Performs a query using recoll and shows the results in a buffer +using org mode." (interactive "sRecoll query string: ") (with-current-buffer (get-buffer-create (format "* Recoll: '%s' *" keywords)) (read-only-mode -1) diff --git a/org.org b/org.org index 156f353..a7c97b5 100644 --- a/org.org +++ b/org.org @@ -217,7 +217,7 @@ (defun jao-org-notes-recoll () "Use consult-recoll to search notes." (interactive) - (consult-recoll (format "dir:%s" jao-org-notes-dir))) + (consult-recoll (format "dir:%s " jao-org-notes-dir))) (jao-transient-major-mode org ["Notes" -- cgit v1.2.3