[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/gnorb 7f67221 098/449: Allow for more "query" types in
From: |
Stefan Monnier |
Subject: |
[elpa] externals/gnorb 7f67221 098/449: Allow for more "query" types in nnir-run-gnorb |
Date: |
Fri, 27 Nov 2020 23:15:16 -0500 (EST) |
branch: externals/gnorb
commit 7f67221848e5c9812c20e2bb531a181243cb366e
Author: Eric Abrahamsen <eric@ericabrahamsen.net>
Commit: Eric Abrahamsen <eric@ericabrahamsen.net>
Allow for more "query" types in nnir-run-gnorb
lisp/nngnorb.el: `nnir-run-gnorb' should be able to handle pre-composed
lists of links, as well as query strings to run. In
some cases we'll want to scan for links elsewhere, and
then open up a nnir summary and a BBDB buffer with the
results of the same scan.
---
lisp/nngnorb.el | 70 +++++++++++++++++++++++++++++++--------------------------
1 file changed, 38 insertions(+), 32 deletions(-)
diff --git a/lisp/nngnorb.el b/lisp/nngnorb.el
index 8d6864d..eddd248 100644
--- a/lisp/nngnorb.el
+++ b/lisp/nngnorb.el
@@ -68,24 +68,30 @@ Otherwise, the query string can be a tags match string, a
la the
Org agenda tags search. All headings matched by this string will
be scanned for gnus messages, and those messages displayed."
(save-excursion
- (let ((q-string (cdr (assq 'query query)))
+ (let ((q (cdr (assq 'query query)))
subtrees links subtree-text vectors)
- (if (string-match "id\\+\\([[:alnum:]-]+\\)$" q-string)
- (with-demoted-errors "Error: %S"
- (org-id-goto (match-string 1 q-string))
- (push (move-marker
- (make-marker)
- (org-element-property :begin (org-element-at-point)))
- subtrees))
- (org-map-entries
- (lambda ()
- (push
- (move-marker (make-marker)
- (org-element-property :begin
- (org-element-at-point)))
- subtrees))
- q-string
- 'agenda))
+ (cond ((string-match "id\\+\\([[:alnum:]-]+\\)$" q)
+ (with-demoted-errors "Error: %S"
+ (org-id-goto (match-string 1 q))
+ (push (move-marker
+ (make-marker)
+ (org-element-property :begin (org-element-at-point)))
+ subtrees)))
+ ((listp q)
+ ;; be a little careful: this could be a list of links, or
+ ;; it could be the full plist
+ (setq links (if (plist-member q :gnus)
+ (plist-get q :gnus)
+ q)))
+ (t (org-map-entries
+ (lambda ()
+ (push
+ (move-marker (make-marker)
+ (org-element-property :begin
+ (org-element-at-point)))
+ subtrees))
+ q
+ 'agenda)))
(when subtrees
(with-current-buffer (get-buffer-create nnir-tmp-buffer)
(erase-buffer)
@@ -103,21 +109,21 @@ be scanned for gnus messages, and those messages
displayed."
(insert subtree-text)
(insert "\n"))
(goto-char (point-min))
- (setq links (delete-dups (gnorb-scan-links
- (point-max) 'gnus))))
- (dolist (m (plist-get links :gnus) (nreverse vectors))
- (let (server-group msg-id artno)
- (setq m (org-link-unescape m))
- (if (not (string-match "\\`\\([^#]+\\)\\(#\\(.*\\)\\)?" m))
- (error "Error in Gnus link"))
- (setq server-group (match-string 1 m)
- msg-id (match-string 3 m))
- ;; I swear just finding the `gnus-request-head' function
- ;; was a trial in itself. But I've only tried it with
- ;; nnimap -- does it work for other backends?
- (setq artno (cdr (gnus-request-head msg-id server-group)))
- (when (> artno 0)
- (push (vector server-group artno 100) vectors))))))))
+ (setq links (gnorb-scan-links (point-max) 'gnus))))
+ (setq links (delete-dups (plist-get links :gnus)))
+ (dolist (m links (nreverse vectors))
+ (let (server-group msg-id artno)
+ (setq m (org-link-unescape m))
+ (if (not (string-match "\\`\\([^#]+\\)\\(#\\(.*\\)\\)?" m))
+ (error "Error in Gnus link"))
+ (setq server-group (match-string 1 m)
+ msg-id (match-string 3 m))
+ ;; I swear just finding the `gnus-request-head' function
+ ;; was a trial in itself. But I've only tried it with
+ ;; nnimap -- does it work for other backends?
+ (setq artno (cdr (gnus-request-head msg-id server-group)))
+ (when (> artno 0)
+ (push (vector server-group artno 100) vectors)))))))
(defvar nngnorb-status-string "")
- [elpa] externals/gnorb 582c111 080/449: Let gnorb-gnus-check-outgoing-headers handle news, (continued)
- [elpa] externals/gnorb 582c111 080/449: Let gnorb-gnus-check-outgoing-headers handle news, Stefan Monnier, 2020/11/27
- [elpa] externals/gnorb 92354d0 082/449: Allow use of some org-mime properties, Stefan Monnier, 2020/11/27
- [elpa] externals/gnorb b81f3e2 083/449: Don't assume any ID references on incoming messages, Stefan Monnier, 2020/11/27
- [elpa] externals/gnorb 1cdec4b 086/449: New option gnorb-org-find-candidates-match, Stefan Monnier, 2020/11/27
- [elpa] externals/gnorb c2a3793 087/449: Don't prompt for action if todo is not possible, Stefan Monnier, 2020/11/27
- [elpa] externals/gnorb 78e1e2b 090/449: Use custom refile targets in re-attaching files, Stefan Monnier, 2020/11/27
- [elpa] externals/gnorb 7950d3a 091/449: Comment and indentation changes only, Stefan Monnier, 2020/11/27
- [elpa] externals/gnorb f5d451e 092/449: New nngnorb mail backend, Stefan Monnier, 2020/11/27
- [elpa] externals/gnorb e62587f 095/449: Yeesh, assigning to global variable by accident, Stefan Monnier, 2020/11/27
- [elpa] externals/gnorb 8fef972 097/449: Gnorb nnir engine doesn't take extra criteria, Stefan Monnier, 2020/11/27
- [elpa] externals/gnorb 7f67221 098/449: Allow for more "query" types in nnir-run-gnorb,
Stefan Monnier <=
- [elpa] externals/gnorb d394ed3 099/449: Let nnir-run-gnorb handle gnus version 5.13, Stefan Monnier, 2020/11/27
- [elpa] externals/gnorb e3db6ae 111/449: Return visit candidates correctly., Stefan Monnier, 2020/11/27
- [elpa] externals/gnorb 4a845bd 116/449: Who knew there's actually a version= function?, Stefan Monnier, 2020/11/27
- [elpa] externals/gnorb 85797d0 120/449: Be more careful about what MIME parts we attach, Stefan Monnier, 2020/11/27
- [elpa] externals/gnorb e4ab4d5 122/449: Finer control over how attachments are saved, Stefan Monnier, 2020/11/27
- [elpa] externals/gnorb 5d20bb5 125/449: Clean up saved sent-message info, Stefan Monnier, 2020/11/27
- [elpa] externals/gnorb 908cdee 107/449: Slight improvement to point placement in new messages, Stefan Monnier, 2020/11/27
- [elpa] externals/gnorb a083a99 114/449: First draft: BBDB field for saving links to messages, Stefan Monnier, 2020/11/27
- [elpa] externals/gnorb e33a758 127/449: Clearer docstring, Stefan Monnier, 2020/11/27
- [elpa] externals/gnorb f3f3bf2 128/449: Fix Agenda BBDB popup for searches with no tags, Stefan Monnier, 2020/11/27