emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] externals/gnorb 36303d9 213/449: Do a better job of dealing with


From: Stefan Monnier
Subject: [elpa] externals/gnorb 36303d9 213/449: Do a better job of dealing with reference headers
Date: Fri, 27 Nov 2020 23:15:41 -0500 (EST)

branch: externals/gnorb
commit 36303d92cd20c1ae32e3ad51f01f2759c9c65238
Author: Eric Abrahamsen <eric@ericabrahamsen.net>
Commit: Eric Abrahamsen <eric@ericabrahamsen.net>

    Do a better job of dealing with reference headers
    
    In all cases, examine both References and In-Reply-To, and also use
    existing Gnus utilities for handling the values.
    
    * lisp/gnorb-gnus.el (gnorb-gnus-check-outgoing-headers,
      gnorb-gnus-outgoing-do-todo): Check In-Reply-To header in addition to
      References. If possible, split the value with gnus-extract-references.
    
    * lisp/gnorb-registry.el (gnorb-find-visit-candidates): Check here for
      string values, and use gnus-extract-references if necessary.
---
 lisp/gnorb-gnus.el     | 10 ++++++++--
 lisp/gnorb-registry.el |  6 +++---
 2 files changed, 11 insertions(+), 5 deletions(-)

diff --git a/lisp/gnorb-gnus.el b/lisp/gnorb-gnus.el
index a48eacf..812ea43 100644
--- a/lisp/gnorb-gnus.el
+++ b/lisp/gnorb-gnus.el
@@ -262,6 +262,7 @@ information about the outgoing message into
     (let* ((org-ids (mail-fetch-field gnorb-mail-header nil nil t))
           (msg-id (mail-fetch-field "Message-ID"))
           (refs (mail-fetch-field "References"))
+          (in-reply-to (mail-fetch-field "In-Reply-To"))
           (to (if (message-news-p)
                   (mail-fetch-field "Newsgroups")
                 (mail-fetch-field "To")))
@@ -276,8 +277,10 @@ information about the outgoing message into
           (group (ignore-errors (car (split-string link "#")))))
       ;; If we can't make a real link, then save some information so
       ;; we can fake it.
+      (when in-reply-to
+       (setq refs (concat refs " " in-reply-to)))
       (when refs
-       (setq refs (split-string refs "[ ,]+")))
+       (setq refs (gnus-extract-references refs)))
       (setq gnorb-gnus-message-info
            `(:subject ,subject :msg-id ,msg-id
                       :to ,to :from ,from
@@ -322,7 +325,7 @@ work."
   (interactive "P")
   (let ((org-refile-targets gnorb-gnus-trigger-refile-targets)
        header-ids ref-ids rel-headings gnorb-window-conf
-       reply-id reply-group)
+       reply-id reply-group in-reply-to)
     (when arg
       (setq rel-headings
            (org-refile-get-location "Trigger action on" nil t))
@@ -369,6 +372,9 @@ work."
        ;; what org id headers are present, though, so we don't add
        ;; duplicates.
        (setq ref-ids (unless arg (mail-fetch-field "References" t)))
+       (setq in-reply-to (unless arg (mail-fetch-field "In-Reply-to" t)))
+       (when in-reply-to
+         (setq ref-ids (concat ref-ids " " in-reply-to)))
        (setq reply-group (when (mail-fetch-field "X-Draft-From" t)
                            (car-safe (read (mail-fetch-field "X-Draft-From" 
t)))))
        ;; when it's a reply, store a link to the reply just in case.
diff --git a/lisp/gnorb-registry.el b/lisp/gnorb-registry.el
index 0e8f15b..21e5410 100644
--- a/lisp/gnorb-registry.el
+++ b/lisp/gnorb-registry.el
@@ -112,11 +112,11 @@ 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, 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."
+Message-IDs), 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 "[ ,]+")))
+      (setq ids (gnus-extract-references ids)))
     (when gnorb-tracking-enabled
       (progn
        (dolist (id ids)



reply via email to

[Prev in Thread] Current Thread [Next in Thread]