[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/gnorb e86d24a 119/449: Robustification of nngnorb nnir
From: |
Stefan Monnier |
Subject: |
[elpa] externals/gnorb e86d24a 119/449: Robustification of nngnorb nnir message viewing |
Date: |
Fri, 27 Nov 2020 23:15:21 -0500 (EST) |
branch: externals/gnorb
commit e86d24a18fb557d407036c67d7bcec4f75c6e8ab
Author: Eric Abrahamsen <eric@ericabrahamsen.net>
Commit: Eric Abrahamsen <eric@ericabrahamsen.net>
Robustification of nngnorb nnir message viewing
lisp/gnorb-gnus.el (gnorb-gnus-search-messages): We should only be
touching those variables at all under gnus 5.13
lisp/nngnorb.el: (nnir-run-gnorb): Various guards: check for a running
gnus, silently pass over malformed links, try
activating the link's group and drop it if we can't
activate, make sure the article number is a positive
integer, and return nil instead of an empty vector if
no messages are found.
---
lisp/gnorb-gnus.el | 25 +++++++++++++------------
lisp/nngnorb.el | 26 +++++++++++++++-----------
2 files changed, 28 insertions(+), 23 deletions(-)
diff --git a/lisp/gnorb-gnus.el b/lisp/gnorb-gnus.el
index 696f511..e73767a 100644
--- a/lisp/gnorb-gnus.el
+++ b/lisp/gnorb-gnus.el
@@ -438,11 +438,11 @@ variable `org-id-track-globally' set to t."
(defun gnorb-gnus-search-messages (str &optional ret)
"Initiate a search for gnus message links in an org subtree.
- The arg STR can be one of two things: an Org heading id value
- \(IDs should be prefixed with \"id+\"\), in which case links
- will be collected from that heading, or a string corresponding
- to an Org tags search, in which case links will be collected
- from all matching headings.
+The arg STR can be one of two things: an Org heading id value
+\(IDs should be prefixed with \"id+\"\), in which case links will
+be collected from that heading, or a string corresponding to an
+Org tags search, in which case links will be collected from all
+matching headings.
In either case, once a collection of links have been made, they
will all be displayed in an ephemeral group on the \"nngnorb\"
@@ -452,15 +452,16 @@ work."
(let ((nnir-address
(or (gnus-method-to-server '(nngnorb))
(user-error
- "Please add a \"nngnorb\" backend to your gnus installation.")))
- (nnir-current-query nil)
- (nnir-current-server nil)
- (nnir-current-group-marked nil)
- (nnir-artlist nil))
+ "Please add a \"nngnorb\" backend to your gnus installation."))))
+ (when (version= "5.13" gnus-version-number)
+ (setq nnir-current-query nil
+ nnir-current-server nil
+ nnir-current-group-marked nil
+ nnir-artlist nil))
(gnus-group-read-ephemeral-group
;; in 24.4, the group name is mostly decorative. in 24.3, the
- ;; actual query itself is embedded there. It should look like
- ;; (concat "nnir:" (prin1-to-string '((query str))))
+ ;; query itself is read from there. It should look like (concat
+ ;; "nnir:" (prin1-to-string '((query str))))
(if (version= "5.13" gnus-version-number)
(concat "nnir:" (prin1-to-string `((query ,str))))
(concat "gnorb-" str))
diff --git a/lisp/nngnorb.el b/lisp/nngnorb.el
index 9505877..581d95f 100644
--- a/lisp/nngnorb.el
+++ b/lisp/nngnorb.el
@@ -113,19 +113,23 @@ be scanned for gnus messages, and those messages
displayed."
(goto-char (point-min))
(setq links (gnorb-scan-links (point-max) 'gnus))))
(setq links (delete-dups (plist-get links :gnus)))
- (dolist (m links (nreverse vectors))
+ (unless (gnus-alive-p)
+ (gnus))
+ (dolist (m links (when vectors
+ (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)))))))
+ (when (string-match "\\`\\([^#]+\\)\\(#\\(.*\\)\\)?" m)
+ (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?
+ (when (gnus-activate-group server-group)
+ (setq artno
+ (cdr (gnus-request-head msg-id server-group)))
+ (when (and (integerp artno) (> artno 0))
+ (push (vector server-group artno 100) vectors)))))))))
(defvar nngnorb-status-string "")
- [elpa] externals/gnorb 6f868fb 219/449: Fix logic of finding links to reply to, (continued)
- [elpa] externals/gnorb 6f868fb 219/449: Fix logic of finding links to reply to, Stefan Monnier, 2020/11/27
- [elpa] externals/gnorb 5182998 228/449: Necessary headers in main file, Stefan Monnier, 2020/11/27
- [elpa] externals/gnorb ec32255 231/449: Use org-reveal when restoring/triggering, Stefan Monnier, 2020/11/27
- [elpa] externals/gnorb 4da19b0 232/449: Get rid of gnorb-org-mail-todos, Stefan Monnier, 2020/11/27
- [elpa] externals/gnorb 01f0a31 235/449: Move all *.el files out of lisp/ to top directory, Stefan Monnier, 2020/11/27
- [elpa] externals/gnorb eab79ec 241/449: Allow attachment transfers in nngnorb summary buffers, Stefan Monnier, 2020/11/27
- [elpa] externals/gnorb 20de4ee 104/449: Caching of msg-id to org-id correlations, Stefan Monnier, 2020/11/27
- [elpa] externals/gnorb edab89d 110/449: Be more careful about cleaning up attachments, Stefan Monnier, 2020/11/27
- [elpa] externals/gnorb 6375f83 112/449: And append doesn't modify destructively..., Stefan Monnier, 2020/11/27
- [elpa] externals/gnorb f7b93f2 115/449: Whitespace/indentation cleanup, Stefan Monnier, 2020/11/27
- [elpa] externals/gnorb e86d24a 119/449: Robustification of nngnorb nnir message viewing,
Stefan Monnier <=
- [elpa] externals/gnorb e089d66 129/449: Documenting recent additions in the README, Stefan Monnier, 2020/11/27
- [elpa] externals/gnorb d254f39 140/449: Merge and simplify handle-mail and email-subtree, Stefan Monnier, 2020/11/27
- [elpa] externals/gnorb de3a512 244/449: Releasing version 1, Stefan Monnier, 2020/11/27
- [elpa] externals/gnorb 4b8a6da 255/449: New function for removing message/heading association, Stefan Monnier, 2020/11/27
- [elpa] externals/gnorb aaf8556 261/449: Be a good citizen about the cl package, Stefan Monnier, 2020/11/27
- [elpa] externals/gnorb de3182e 263/449: Shift location of org-reveal during trigger process, Stefan Monnier, 2020/11/27
- [elpa] externals/gnorb 6246244 106/449: Hinting for potentially-relevant incoming messages, Stefan Monnier, 2020/11/27
- [elpa] externals/gnorb a79cf72 126/449: Unwrap "if" from around function, Stefan Monnier, 2020/11/27
- [elpa] externals/gnorb 0255247 133/449: Only notice records on message receipt, not sending, Stefan Monnier, 2020/11/27
- [elpa] externals/gnorb b70d845 168/449: Handle nil group values in registry entries, Stefan Monnier, 2020/11/27