summaryrefslogtreecommitdiffhomepage
path: root/lib/doc
diff options
context:
space:
mode:
authorjao <jao@gnu.org>2021-02-23 03:52:06 +0000
committerjao <jao@gnu.org>2021-02-23 03:52:06 +0000
commit8e274e0f1cc681ad3f5c63196c3b42371ecba892 (patch)
treea41044942f14bbb989b51b457ccaec8dbd39fbf5 /lib/doc
parent2c79c18bf8e040fab316a18e145fbbb769a6b865 (diff)
downloadelibs-8e274e0f1cc681ad3f5c63196c3b42371ecba892.tar.gz
elibs-8e274e0f1cc681ad3f5c63196c3b42371ecba892.tar.bz2
jao-recoll: linked snippets
Diffstat (limited to 'lib/doc')
-rw-r--r--lib/doc/jao-recoll.el25
1 files changed, 13 insertions, 12 deletions
diff --git a/lib/doc/jao-recoll.el b/lib/doc/jao-recoll.el
index 28a1c1a..be77100 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 Jose Antonio Ortega Ruiz
+;; Copyright (c) 2017, 2020, 2021 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
@@ -31,12 +31,13 @@
(define-derived-mode recoll-mode org-mode "Recoll"
"Simple mode for showing recoll query results"
+ (setq org-startup-folded nil)
(read-only-mode 1))
(defvar jao-recoll--file-regexp
"\\(\\w+/\\w+\\)\t+\\[\\([^]]+\\)\\]\t+\\[\\([^]]+\\)\\].+")
-(defvar jao-recoll-flags "-A")
+(defvar jao-recoll-flags "-A -p 5 -n 20")
;;;###autoload
(defun jao-recoll (keywords)
@@ -47,7 +48,8 @@ buffer using org mode."
(read-only-mode -1)
(delete-region (point-min) (point-max))
(let ((c (format "recoll %s -t %s"
- jao-recoll-flags (shell-quote-argument keywords))))
+ jao-recoll-flags (shell-quote-argument keywords)))
+ (lnk))
(shell-command c t))
(goto-char (point-min))
(when (looking-at-p "Recoll query:")
@@ -55,20 +57,19 @@ buffer using org mode."
(forward-line 1))
(open-line 1)
(while (search-forward-regexp jao-recoll--file-regexp nil t)
+ (setq lnk (concat "doc:" (file-name-nondirectory (match-string 2))))
(replace-match "* [[\\2][\\3]] (\\1)")
(forward-line)
- (beginning-of-line)
- (let ((kill-whole-line nil)) (kill-line))
- (forward-line)
- (let ((p (point)))
- (re-search-forward "/ABSTRACT")
- (beginning-of-line)
- (fill-region p (point))
- (let ((kill-whole-line nil)) (kill-line))))
+ (let ((kill-whole-line t)) (kill-line))
+ (while (and (not (eobp)) (not (looking-at-p "/SNIPPETS")))
+ (if (looking-at "^\\([1-9][0-9]*\\) : ")
+ (replace-match (format " - [[%s::\\1][\\1]] : " lnk))
+ (insert " - "))
+ (forward-line 1))
+ (unless (eobp) (let ((kill-whole-line t)) (kill-line))))
(recoll-mode)
(pop-to-buffer (current-buffer))
(goto-char (point-min))
- (org-cycle '(4))
(org-next-visible-heading 1)))
(define-key recoll-mode-map [?n] 'org-next-link)