[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/gnorb e07c4cf 194/449: Refactor splitting of message re
From: |
Stefan Monnier |
Subject: |
[elpa] externals/gnorb e07c4cf 194/449: Refactor splitting of message reference headers |
Date: |
Fri, 27 Nov 2020 23:15:37 -0500 (EST) |
branch: externals/gnorb
commit e07c4cf6a0e4b5b1bd329710de119b9536c879cf
Author: Eric Abrahamsen <eric@ericabrahamsen.net>
Commit: Eric Abrahamsen <eric@ericabrahamsen.net>
Refactor splitting of message reference headers
* lisp/gnorb-registry.el (gnorb-find-visit-candidates): Split reference
headers strings here.
* lisp/gnorb-gnus.el: Instead of everywhere else.
---
lisp/gnorb-gnus.el | 29 ++++++++++-------------------
lisp/gnorb-registry.el | 5 ++++-
2 files changed, 14 insertions(+), 20 deletions(-)
diff --git a/lisp/gnorb-gnus.el b/lisp/gnorb-gnus.el
index 559015f..49863a6 100644
--- a/lisp/gnorb-gnus.el
+++ b/lisp/gnorb-gnus.el
@@ -277,7 +277,7 @@ information about the outgoing message into
;; If we can't make a real link, then save some information so
;; we can fake it.
(when refs
- (setq refs (split-string refs)))
+ (setq refs (split-string refs "[ ,]+")))
(setq gnorb-gnus-sending-message-info
`(:subject ,subject :msg-id ,msg-id
:to ,to :from ,from
@@ -344,14 +344,13 @@ work."
;; heading(s). But if there had been org-id
;; headers, they would already have been
;; handled when the message was sent.
- (progn (when (stringp ref-ids)
- (setq ref-ids (split-string ref-ids)))
- (setq rel-headings (gnorb-find-visit-candidates ref-ids))
- (if (not rel-headings)
- (gnorb-gnus-outgoing-make-todo-1)
- (dolist (h rel-headings)
- (push h gnorb-message-org-ids))
- (gnorb-org-restore-after-send)))
+ (progn
+ (setq rel-headings (gnorb-find-visit-candidates ref-ids))
+ (if (not rel-headings)
+ (gnorb-gnus-outgoing-make-todo-1)
+ (dolist (h rel-headings)
+ (push h gnorb-message-org-ids))
+ (gnorb-org-restore-after-send)))
;; not relevant, just make a new TODO
(gnorb-gnus-outgoing-make-todo-1)))
;; We are still in the message composition buffer, so let's see
@@ -381,8 +380,6 @@ work."
(org-gnus-follow-link reply-group reply-id)
(call-interactively 'org-store-link)))
(when ref-ids
- (when (stringp ref-ids)
- (setq ref-ids (split-string ref-ids)))
;; if the References header points to any message ids that are
;; tracked by TODO headings...
(setq rel-headings (gnorb-find-visit-candidates ref-ids)))
@@ -496,10 +493,7 @@ to t (it is, by default)."
(ref-msg-ids
(with-current-buffer gnus-original-article-buffer
(message-narrow-to-headers-or-head)
- (let ((all-refs
- (message-fetch-field "references")))
- (when all-refs
- (split-string all-refs)))))
+ (message-fetch-field "references")))
(offer-heading
(when (and (not id) ref-msg-ids gnorb-tracking-enabled)
(if org-id-track-globally
@@ -598,7 +592,6 @@ option `gnorb-gnus-hint-relevant-article' is non-nil."
nil t))
rel-headings)
(when ref-ids
- (setq ref-ids (split-string ref-ids))
(when (setq rel-headings
(gnorb-find-visit-candidates ref-ids))
(message "Possible relevant todo %s, trigger with %s"
@@ -614,8 +607,7 @@ option `gnorb-gnus-hint-relevant-article' is non-nil."
(lambda (header)
(let ((ref-ids (mail-header-references header)))
(if (and ref-ids
- (gnorb-find-visit-candidates
- (split-string ref-ids)))
+ (gnorb-find-visit-candidates ref-ids))
gnorb-gnus-summary-mark
" "))))
@@ -631,7 +623,6 @@ option `gnorb-gnus-hint-relevant-article' is non-nil."
(let ((refs (gnus-fetch-original-field "references"))
rel-headings)
(when refs
- (setq refs (split-string refs))
(setq rel-headings (gnorb-find-visit-candidates refs))
(delete-other-windows)
(org-id-goto (car rel-headings)))))
diff --git a/lisp/gnorb-registry.el b/lisp/gnorb-registry.el
index bf24ced..e7c3a8b 100644
--- a/lisp/gnorb-registry.el
+++ b/lisp/gnorb-registry.el
@@ -111,9 +111,12 @@ to the message's registry entry, under the 'gnorb-ids key."
(defun gnorb-find-visit-candidates (ids)
"For all message-ids in IDS (which should be a list of
-Message-ID strings, with angle brackets), produce a list of Org
+Message-ID strings, with angle brackets, or a single string of
+Message-IDs separated by spaces or commas), produce a list of Org
ids for headings that are relevant to that message."
(let (ret-val sub-val)
+ (when (stringp ids)
+ (setq ids (split-string ids "[ ,]+")))
(when gnorb-tracking-enabled
(progn
(dolist (id ids)
- [elpa] externals/gnorb 4a8fa84 369/449: Fix nnir search routine, (continued)
- [elpa] externals/gnorb 4a8fa84 369/449: Fix nnir search routine, Stefan Monnier, 2020/11/27
- [elpa] externals/gnorb dfb2acd 375/449: Bug fix in mail tracking extraction, Stefan Monnier, 2020/11/27
- [elpa] externals/gnorb de4b0e8 145/449: Associate outgoing messages with arbitrary headings, Stefan Monnier, 2020/11/27
- [elpa] externals/gnorb 0f18c45 311/449: Allow persistent nnir search groups, Stefan Monnier, 2020/11/27
- [elpa] externals/gnorb 4f62ec8 374/449: Fix inevitable screwup in previous commit, bump version, Stefan Monnier, 2020/11/27
- [elpa] externals/gnorb 3b81d8c 377/449: Don't mark the 'artno key as precious, Stefan Monnier, 2020/11/27
- [elpa] externals/gnorb 5a88948 382/449: Fix gnorb-version command, Stefan Monnier, 2020/11/27
- [elpa] externals/gnorb 2aab7c3 433/449: [gnorb] Use substitute-command-keys, Stefan Monnier, 2020/11/27
- [elpa] externals/gnorb afafa8a 424/449: * gnorb/gnorb-registry.el: Fix compilation warnings, Stefan Monnier, 2020/11/27
- [elpa] externals/gnorb 16f1ab6 183/449: Make gnorb-registry-make-entry more careful, Stefan Monnier, 2020/11/27
- [elpa] externals/gnorb e07c4cf 194/449: Refactor splitting of message reference headers,
Stefan Monnier <=
- [elpa] externals/gnorb a0b039c 199/449: Probably shouldn't use assoc as a symbol, Stefan Monnier, 2020/11/27
- [elpa] externals/gnorb 4cfd40c 207/449: Rework gnorb-org-handle-mail to use tracking, Stefan Monnier, 2020/11/27
- [elpa] externals/gnorb 357c9c6 220/449: Always append function to message-exit-actions, Stefan Monnier, 2020/11/27
- [elpa] externals/gnorb cffdd60 221/449: Warn people of impending changes in README, Stefan Monnier, 2020/11/27
- [elpa] externals/gnorb 294e1eb 224/449: Fix calls to gnorb-trigger-todo-action, Stefan Monnier, 2020/11/27
- [elpa] externals/gnorb 73b7f47 227/449: Use org-element-map's arguments properly, Stefan Monnier, 2020/11/27
- [elpa] externals/gnorb 82d1e46 230/449: New gnorb.org file, and elpaignore, Stefan Monnier, 2020/11/27
- [elpa] externals/gnorb e7b8a8b 233/449: First full draft of manual, Stefan Monnier, 2020/11/27
- [elpa] externals/gnorb 004bdce 234/449: Create and install info manual, Stefan Monnier, 2020/11/27
- [elpa] externals/gnorb dd46ce4 246/449: Refactor finding trigger candidates, Stefan Monnier, 2020/11/27