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

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

[elpa] externals/gnorb 8623bd0 439/449: [gnorb] Further avoid creating r


From: Stefan Monnier
Subject: [elpa] externals/gnorb 8623bd0 439/449: [gnorb] Further avoid creating registry entries, bump to 1.6.7
Date: Fri, 27 Nov 2020 23:16:28 -0500 (EST)

branch: externals/gnorb
commit 8623bd0c910c0be91e45fac167179ee7a201f074
Author: Eric Abrahamsen <eric@ericabrahamsen.net>
Commit: Stefan Monnier <monnier@iro.umontreal.ca>

    [gnorb] Further avoid creating registry entries, bump to 1.6.7
    
    I fixed half of this problem in 3be2700, Bob Newell pointed out there
    were more similar problems.
    
    * packages/gnorb/gnorb-registry.el (gnorb-registry-get-id-key): New
    function, equivalent to gnus-registry-get-id-key, but doesn't
    unilaterally create a new entry (I don't think the gnus one should,
    either).
    (gnorb-find-visit-candidates):
    * packages/gnorb/gnorb-gnus.el (gnorb-gnus-hint-relevant-message,
    gnorb-gnus-insert-format-letter-maybe, gnorb-gnus-insert-format-tags):
    Use new function.
---
 gnorb-gnus.el     | 27 +++++++++------------------
 gnorb-registry.el | 10 +++++++++-
 gnorb.el          |  2 +-
 3 files changed, 19 insertions(+), 20 deletions(-)

diff --git a/gnorb-gnus.el b/gnorb-gnus.el
index fff23a0..5b54248 100644
--- a/gnorb-gnus.el
+++ b/gnorb-gnus.el
@@ -964,7 +964,7 @@ option `gnorb-gnus-hint-relevant-article' is non-nil."
             (gnus-data-find
              (gnus-summary-article-number))))
           (assoc-heading
-           (gnus-registry-get-id-key
+           (gnorb-registry-get-id-key
             (gnus-fetch-original-field "message-id") 'gnorb-ids))
           (tracked-headings (gnorb-find-tracked-headings headers)))
       (cond (assoc-heading
@@ -981,18 +981,12 @@ option `gnorb-gnus-hint-relevant-article' is non-nil."
   (if (eieio-object-p gnus-registry-db)
       (if (not (or (gnus-ephemeral-group-p gnus-newsgroup-name)
                   (gnus-virtual-group-p gnus-newsgroup-name)))
-         (let* ((id (mail-header-message-id header))
-                ;; Use lower-level accessor to avoid creating an entry
-                ;; where there wasn't one.  This function doesn't respect
-                ;; ignored registry groups.
-                (entry (nth 1 (assoc id (registry-lookup
-                                         gnus-registry-db
-                                         (list id))))))
-           (cond ((cdr-safe (assq 'gnorb-ids entry))
-                  gnorb-gnus-summary-tracked-mark)
-                 ((gnorb-find-tracked-headings header)
-                  gnorb-gnus-summary-mark)
-                 (t " ")))
+         (cond ((gnorb-registry-get-id-key
+                 (mail-header-message-id header) 'gnorb-ids)
+                gnorb-gnus-summary-tracked-mark)
+               ((gnorb-find-tracked-headings header)
+                gnorb-gnus-summary-mark)
+               (t " "))
        " ")
     ""))
 
@@ -1003,11 +997,8 @@ option `gnorb-gnus-hint-relevant-article' is non-nil."
 
 (defun gnorb-gnus-insert-format-tags (header)
   (if (eieio-object-p gnus-registry-db)
-      (let* ((id (mail-header-message-id header))
-            (entry (nth 1 (assoc id (registry-lookup
-                                     gnus-registry-db
-                                     (list id)))))
-            (tags (cdr-safe (assq 'org-tags entry))))
+      (let ((tags (gnorb-registry-get-id-key
+                  (mail-header-message-id header) 'org-tags)))
        (if tags
            (concat
             ":" (mapconcat #'identity tags ":") ":")
diff --git a/gnorb-registry.el b/gnorb-registry.el
index 22d303e..ea3f779 100644
--- a/gnorb-registry.el
+++ b/gnorb-registry.el
@@ -79,6 +79,14 @@ sent. Save the relevant Org ids in the 'gnorb-ids key."
       (gnus-registry-set-id-key msg-id 'group (list group)))
     (gnus-registry-get-or-make-entry msg-id)))
 
+(defun gnorb-registry-get-id-key (id key)
+  "Get value of symbol KEY for ID's entry in the registry.
+Works just like `gnus-registry-get-id-key', but doesn't create an
+entry if it doesn't exist already."
+  (cdr-safe
+   (assq key (nth 1 (assoc id (registry-lookup
+                              gnus-registry-db (list id)))))))
+
 (defun gnorb-registry-capture ()
   "When capturing from a Gnus message, add our new Org heading id
 to the message's registry entry, under the `gnorb-ids' key."
@@ -115,7 +123,7 @@ even for headings that appear to no longer exist."
        (dolist (id ids)
          (when
              (setq sub-val
-                   (gnus-registry-get-id-key id 'gnorb-ids))
+                   (gnorb-registry-get-id-key id 'gnorb-ids))
            (setq ret-val (append sub-val ret-val))))))
     ;; This lets us be reasonably confident that the
     ;; headings still exist.
diff --git a/gnorb.el b/gnorb.el
index 8a9cf45..1f3421b 100644
--- a/gnorb.el
+++ b/gnorb.el
@@ -2,7 +2,7 @@
 
 ;; Copyright (C) 2018-2020  Free Software Foundation, Inc.
 
-;; Version: 1.6.6
+;; Version: 1.6.7
 ;; Package-Requires: ((cl-lib "0.5"))
 
 ;; Maintainer: Eric Abrahamsen <eric@ericabrahamsen.net>



reply via email to

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