[Top][All Lists]

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

[elpa] externals/gnorb 04ec3ab 264/449: Fix logic of choosing heading to

From: Stefan Monnier
Subject: [elpa] externals/gnorb 04ec3ab 264/449: Fix logic of choosing heading to trigger
Date: Fri, 27 Nov 2020 23:15:52 -0500 (EST)

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

    Fix logic of choosing heading to trigger
    * gnorb-gnus.el (gnorb-gnus-incoming-do-todo): Need to do several things
      at once: check for dead associations and delete them if necessary,
      then go through all the possible relevant headings and find the one
      the user wants to trigger.
 gnorb-gnus.el | 29 ++++++++++++++++++-----------
 1 file changed, 18 insertions(+), 11 deletions(-)

diff --git a/gnorb-gnus.el b/gnorb-gnus.el
index a793c0d..88714d7 100644
--- a/gnorb-gnus.el
+++ b/gnorb-gnus.el
@@ -509,6 +509,8 @@ to t (it is, by default)."
          (when (and (null id) ref-msg-ids)
+           ;; Specifically ask for zombies, so the user has chance to
+           ;; flush them out.
            (gnorb-find-tracked-headings headers t)))
     (setq gnorb-gnus-message-info
@@ -522,19 +524,25 @@ to t (it is, by default)."
     (if id
        (gnorb-trigger-todo-action arg id)
-      (if (and related-headings
-              (while (and
-                      (null (org-id-find-id-file
-                             (setq targ (pop related-headings))))
-                      targ)
+      ;; Flush out zombies (dead associations).
+      (setq related-headings
+           (cl-remove-if
+            (lambda (h)
+              (when (null (org-id-find-id-file h))
                 (when (y-or-n-p
                         "ID %s no longer exists, disassociate message?"
-                  (gnorb-delete-association msg-id targ)))
-              (y-or-n-p (format "Trigger action on %s"
-                                (gnorb-pretty-outline
-                                 targ))))
+                  (gnorb-delete-association msg-id targ))))
+            related-headings))
+      (if (catch 'target
+           (mapcar
+            (lambda (h)
+              (when (yes-or-no-p
+                     (format "Trigger action on %s"
+                             (gnorb-pretty-outline h)))
+                (throw 'target (setq targ h))))
+            related-headings))
          (gnorb-trigger-todo-action arg targ)
        (setq targ (org-refile-get-location
                    "Trigger heading" nil t))
@@ -577,8 +585,7 @@ work."
         (list 'nnir nnir-address)
        (list 'nnir "nnir"))
-     ret ;; it's possible you can't just put an arbitrary form in
-        ;; here, which sucks.
+     ret
      nil nil
      ;; the following seems to simply be ignored under gnus 5.13
      (list (cons 'nnir-specs (list (cons 'nnir-query-spec `((query . ,str)))

reply via email to

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