diff options
author | jao <jao@gnu.org> | 2022-09-07 05:10:40 +0100 |
---|---|---|
committer | jao <jao@gnu.org> | 2022-09-07 05:15:55 +0100 |
commit | f45fdccd49992cf9232a0b66959d38e172de7fe7 (patch) | |
tree | bbee0023fafaa9e96791b63798de2a2a37e43bf7 /attic | |
parent | 8f104b92fa9ef1b2c4ed800ad1d7c06913c0b0d4 (diff) | |
download | elibs-f45fdccd49992cf9232a0b66959d38e172de7fe7.tar.gz elibs-f45fdccd49992cf9232a0b66959d38e172de7fe7.tar.bz2 |
attic reorganisation
Diffstat (limited to 'attic')
-rw-r--r-- | attic/elisp/jao-custom-modus.el (renamed from attic/jao-custom-modus.el) | 0 | ||||
-rw-r--r-- | attic/elisp/jao-emms-info-track.el (renamed from attic/media/jao-emms-info-track.el) | 0 | ||||
-rw-r--r-- | attic/elisp/jao-emms-lyrics.el (renamed from attic/media/jao-emms-lyrics.el) | 0 | ||||
-rw-r--r-- | attic/elisp/jao-emms-random-album.el (renamed from attic/media/jao-emms-random-album.el) | 0 | ||||
-rw-r--r-- | attic/elisp/jao-emms.el (renamed from attic/media/jao-emms.el) | 0 | ||||
-rw-r--r-- | attic/elisp/jao-frm.el (renamed from attic/net/jao-frm.el) | 0 | ||||
-rw-r--r-- | attic/elisp/jao-maildir.el (renamed from attic/net/jao-maildir.el) | 0 | ||||
-rw-r--r-- | attic/elisp/jao-mpdn.el (renamed from attic/media/jao-mpdn.el) | 0 | ||||
-rw-r--r-- | attic/elisp/jao-notmuch-gnus.el (renamed from attic/net/jao-notmuch-gnus.el) | 0 | ||||
-rw-r--r-- | attic/elisp/jao-notmuch-move.el (renamed from attic/net/jao-notmuch-move.el) | 0 | ||||
-rw-r--r-- | attic/elisp/jao-notmuch-tree-fold.el (renamed from attic/net/jao-notmuch-tree-fold.el) | 0 | ||||
-rw-r--r-- | attic/elisp/jao-proton-utils.el (renamed from attic/net/jao-proton-utils.el) | 0 | ||||
-rw-r--r-- | attic/elisp/jao-recoll.el | 131 | ||||
-rw-r--r-- | attic/elisp/misc.el (renamed from attic/misc.el) | 0 | ||||
-rw-r--r-- | attic/elisp/nnnm.el (renamed from attic/net/nnnm.el) | 0 | ||||
-rw-r--r-- | attic/org/blog.org (renamed from attic/orgs/blog.org) | 0 | ||||
-rw-r--r-- | attic/org/completion.org (renamed from attic/orgs/completion.org) | 0 | ||||
-rw-r--r-- | attic/org/counsel.org (renamed from attic/orgs/counsel.org) | 0 | ||||
-rw-r--r-- | attic/org/email.org (renamed from attic/orgs/email.org) | 0 | ||||
-rw-r--r-- | attic/org/eww.org (renamed from attic/orgs/eww.org) | 0 | ||||
-rw-r--r-- | attic/org/exwm.org (renamed from attic/orgs/exwm.org) | 0 | ||||
-rw-r--r-- | attic/org/gnus.org (renamed from attic/orgs/gnus.org) | 0 | ||||
-rw-r--r-- | attic/org/init.org (renamed from attic/orgs/init.org) | 0 | ||||
-rw-r--r-- | attic/org/misc.org (renamed from attic/orgs/misc.org) | 0 | ||||
-rw-r--r-- | attic/org/notmuch.org (renamed from attic/orgs/notmuch.org) | 0 | ||||
-rw-r--r-- | attic/org/org.org (renamed from attic/orgs/org.org) | 0 | ||||
-rw-r--r-- | attic/org/w3m.org (renamed from attic/net/w3m.org) | 0 |
27 files changed, 131 insertions, 0 deletions
diff --git a/attic/jao-custom-modus.el b/attic/elisp/jao-custom-modus.el index 9b2cd8e..9b2cd8e 100644 --- a/attic/jao-custom-modus.el +++ b/attic/elisp/jao-custom-modus.el diff --git a/attic/media/jao-emms-info-track.el b/attic/elisp/jao-emms-info-track.el index cf93625..cf93625 100644 --- a/attic/media/jao-emms-info-track.el +++ b/attic/elisp/jao-emms-info-track.el diff --git a/attic/media/jao-emms-lyrics.el b/attic/elisp/jao-emms-lyrics.el index 0ea52e0..0ea52e0 100644 --- a/attic/media/jao-emms-lyrics.el +++ b/attic/elisp/jao-emms-lyrics.el diff --git a/attic/media/jao-emms-random-album.el b/attic/elisp/jao-emms-random-album.el index 72e056b..72e056b 100644 --- a/attic/media/jao-emms-random-album.el +++ b/attic/elisp/jao-emms-random-album.el diff --git a/attic/media/jao-emms.el b/attic/elisp/jao-emms.el index 53b3513..53b3513 100644 --- a/attic/media/jao-emms.el +++ b/attic/elisp/jao-emms.el diff --git a/attic/net/jao-frm.el b/attic/elisp/jao-frm.el index 2658687..2658687 100644 --- a/attic/net/jao-frm.el +++ b/attic/elisp/jao-frm.el diff --git a/attic/net/jao-maildir.el b/attic/elisp/jao-maildir.el index 18a1725..18a1725 100644 --- a/attic/net/jao-maildir.el +++ b/attic/elisp/jao-maildir.el diff --git a/attic/media/jao-mpdn.el b/attic/elisp/jao-mpdn.el index d707767..d707767 100644 --- a/attic/media/jao-mpdn.el +++ b/attic/elisp/jao-mpdn.el diff --git a/attic/net/jao-notmuch-gnus.el b/attic/elisp/jao-notmuch-gnus.el index 1576964..1576964 100644 --- a/attic/net/jao-notmuch-gnus.el +++ b/attic/elisp/jao-notmuch-gnus.el diff --git a/attic/net/jao-notmuch-move.el b/attic/elisp/jao-notmuch-move.el index eb7ea4c..eb7ea4c 100644 --- a/attic/net/jao-notmuch-move.el +++ b/attic/elisp/jao-notmuch-move.el diff --git a/attic/net/jao-notmuch-tree-fold.el b/attic/elisp/jao-notmuch-tree-fold.el index ef528df..ef528df 100644 --- a/attic/net/jao-notmuch-tree-fold.el +++ b/attic/elisp/jao-notmuch-tree-fold.el diff --git a/attic/net/jao-proton-utils.el b/attic/elisp/jao-proton-utils.el index 012a2ff..012a2ff 100644 --- a/attic/net/jao-proton-utils.el +++ b/attic/elisp/jao-proton-utils.el diff --git a/attic/elisp/jao-recoll.el b/attic/elisp/jao-recoll.el new file mode 100644 index 0000000..b23106f --- /dev/null +++ b/attic/elisp/jao-recoll.el @@ -0,0 +1,131 @@ +;;; jao-recoll.el -- Displaying recoll queries -*- lexical-binding: t; -*- + +;; 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 +;; the Free Software Foundation; either version 3 of the License, or +;; (at your option) any later version. + +;; This file is distributed in the hope that it will be useful, +;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;; GNU General Public License for more details. + +;; You should have received a copy of the GNU General Public License +;; along with this program. If not, see <http://www.gnu.org/licenses/>. + +;; Author: Jose Antonio Ortega Ruiz <jao@gnu.org> +;; Start date: Wed Nov 01, 2017 18:14 + + +;;; Comentary: + +;; A simple interactive command to perform recoll queries and display +;; its results using org markup. + +;;; Code: + +(require 'org) + +(define-derived-mode recoll-mode org-mode "Recoll" + "Simple mode for showing recoll query results" + (read-only-mode 1)) + +(defvar jao-recoll--file-regexp + "\\(\\w+/.+\\)\t+\\[\\([^]]+\\)\\]\t+\\[\\([^\t]+\\)\\].+") + +(defvar jao-recoll-flags "-A -p 5 -n 100") + +(defvar jao-recoll-single-buffer t) +(defvar-local jao-recoll--last-query nil) +(defvar-local jao-recoll--last-full-query nil) + +(defun jao-recoll-show-query () + (interactive) + (message (concat jao-recoll--last-query "\n" + jao-recoll--last-full-query))) + +(defun jao-recoll-requery () + (interactive) + (jao-recoll jao-recoll--last-query)) + +(defun jao-recoll--buffer (q) + (get-buffer-create (if jao-recoll-single-buffer + "*Recoll*" + (format "*Recoll: '%s'*" q)))) + +(defun jao-recoll--format-snippets (lnk) + (when (looking-at-p "SNIPPETS") + (let ((kill-whole-line t)) + (kill-line) + (while (and (not (eobp)) (not (looking-at-p "/SNIPPETS"))) + (cond ((looking-at "^\\([1-9][0-9]*\\) : ") + (replace-match (format " - [[%s::\\1][\\1]] : " lnk))) + ((looking-at "^0 : \\(.[^\n]+\\)") + (let ((desc (match-string 1))) + (replace-match " - ") + (insert (org-make-link-string lnk desc)))) + (t (insert " - "))) + (forward-line 1)) + (unless (eobp) (kill-line))))) + +(defun jao-recoll--org-link (uri desc mime) + (cond ((string= mime "application/pdf") + (concat "doc:" (file-name-nondirectory uri))) + ((string= mime "message/rfc822") (concat "message:" (substring uri 7))) + ((string= mime "text/x-orgmode-sub") (concat uri "::*" desc)) + (t uri))) + +;;;###autoload +(defun jao-recoll (&optional prefix-query) + "Performs a query using recoll and shows the results using org markup." + (interactive) + (let* ((query (read-string "Recoll query: " prefix-query)) + (cmd (format "recoll %s -t %s" + jao-recoll-flags (shell-quote-argument query))) + (inhibit-read-only t)) + (with-current-buffer (jao-recoll--buffer query) + (recoll-mode) + (delete-region (point-min) (point-max)) + (shell-command cmd t) + (setq jao-recoll--last-query query) + (goto-char (point-min)) + (when (looking-at-p "Recoll query:") + (setq jao-recoll--last-full-query + (string-trim (thing-at-point 'line))) + (let ((kill-whole-line nil)) (kill-line)) + (insert query) + (forward-line 2)) + (open-line 1) + (while (search-forward-regexp jao-recoll--file-regexp nil t) + (let* ((mime (match-string 1)) + (ref (match-string 2)) + (desc (match-string 3)) + (start (match-beginning 0)) + (end (match-end 0)) + (lnk (jao-recoll--org-link ref desc mime)) + (desc (if (string= mime "text/x-orgmode-sub") + (org-link-display-format + (concat (file-name-nondirectory ref) " :: " desc)) + desc))) + (delete-region start end) + (insert "* " (org-make-link-string lnk desc) " (" mime ")") + (forward-line) + (jao-recoll--format-snippets lnk))) + (pop-to-buffer (current-buffer)) + (goto-char (point-min)) + (org-next-visible-heading 1) + (org-overview) + (jao-recoll-show-query)))) + +(define-key recoll-mode-map [?n] 'org-next-link) +(define-key recoll-mode-map [?p] 'org-previous-link) +(define-key recoll-mode-map [?q] 'bury-buffer) +(define-key recoll-mode-map [?r] 'jao-recoll-requery) +(define-key recoll-mode-map [?g] 'jao-recoll-requery) +(define-key recoll-mode-map [?w] 'jao-recoll-show-query) + +;;; . +(provide 'jao-recoll) +;;; jao-recoll.el ends here diff --git a/attic/misc.el b/attic/elisp/misc.el index d448ae7..d448ae7 100644 --- a/attic/misc.el +++ b/attic/elisp/misc.el diff --git a/attic/net/nnnm.el b/attic/elisp/nnnm.el index 552e95c..552e95c 100644 --- a/attic/net/nnnm.el +++ b/attic/elisp/nnnm.el diff --git a/attic/orgs/blog.org b/attic/org/blog.org index 29b35f0..29b35f0 100644 --- a/attic/orgs/blog.org +++ b/attic/org/blog.org diff --git a/attic/orgs/completion.org b/attic/org/completion.org index 3a4049a..3a4049a 100644 --- a/attic/orgs/completion.org +++ b/attic/org/completion.org diff --git a/attic/orgs/counsel.org b/attic/org/counsel.org index f6814ae..f6814ae 100644 --- a/attic/orgs/counsel.org +++ b/attic/org/counsel.org diff --git a/attic/orgs/email.org b/attic/org/email.org index e8a8a71..e8a8a71 100644 --- a/attic/orgs/email.org +++ b/attic/org/email.org diff --git a/attic/orgs/eww.org b/attic/org/eww.org index 4a9dd71..4a9dd71 100644 --- a/attic/orgs/eww.org +++ b/attic/org/eww.org diff --git a/attic/orgs/exwm.org b/attic/org/exwm.org index 65db454..65db454 100644 --- a/attic/orgs/exwm.org +++ b/attic/org/exwm.org diff --git a/attic/orgs/gnus.org b/attic/org/gnus.org index c0c0346..c0c0346 100644 --- a/attic/orgs/gnus.org +++ b/attic/org/gnus.org diff --git a/attic/orgs/init.org b/attic/org/init.org index fcd69fb..fcd69fb 100644 --- a/attic/orgs/init.org +++ b/attic/org/init.org diff --git a/attic/orgs/misc.org b/attic/org/misc.org index 6d8d82d..6d8d82d 100644 --- a/attic/orgs/misc.org +++ b/attic/org/misc.org diff --git a/attic/orgs/notmuch.org b/attic/org/notmuch.org index 0368ac1..0368ac1 100644 --- a/attic/orgs/notmuch.org +++ b/attic/org/notmuch.org diff --git a/attic/orgs/org.org b/attic/org/org.org index bcce3e1..bcce3e1 100644 --- a/attic/orgs/org.org +++ b/attic/org/org.org diff --git a/attic/net/w3m.org b/attic/org/w3m.org index 3689c8e..3689c8e 100644 --- a/attic/net/w3m.org +++ b/attic/org/w3m.org |