branch: externals/gnorb
commit 471883d1ca4d3ec463efe2ca8e155ad073d901f6
Author: Eric Abrahamsen <[email protected]>
Commit: Stefan Monnier <[email protected]>
Gnorb: Only add one registry-related hook to the Org capture process
* packages/gnorb/gnorb-utils.el (gnorb-tracking-initialize): Delete
`gnorb-registry-capture-abort-cleanup'. Instead of creating the
association when the capture process begins, and then deleting the
association if the capture is aborted, simply don't create the
association unless we know that the capture process isn't aborted.
---
gnorb-registry.el | 16 ----------------
gnorb-utils.el | 3 +--
2 files changed, 1 insertion(+), 18 deletions(-)
diff --git a/gnorb-registry.el b/gnorb-registry.el
index 91910aa..375a5b5 100644
--- a/gnorb-registry.el
+++ b/gnorb-registry.el
@@ -92,22 +92,6 @@ to the message's registry entry, under the 'gnorb-ids key."
(plist-put org-capture-plist :gnorb-id org-id)
(gnorb-registry-make-entry msg-id nil nil org-id nil))))
-
-(defun gnorb-registry-capture-abort-cleanup ()
- (when (and (org-capture-get :gnorb-id)
- org-note-abort)
- (with-no-warnings ; For `abort-note'
- (condition-case nil
- (let* ((msg-id (format "<%s>" (plist-get org-store-link-plist
:message-id)))
- (existing-org-ids (gnus-registry-get-id-key msg-id 'gnorb-ids))
- (org-id (org-capture-get :gnorb-id)))
- (when (member org-id existing-org-ids)
- (gnus-registry-set-id-key msg-id 'gnorb-ids
- (remove org-id existing-org-ids)))
- (setq abort-note 'clean))
- (error
- (setq abort-note 'dirty))))))
-
(defun gnorb-find-visit-candidates (ids &optional include-zombies)
"For all message-ids in IDS (which should be a list of
Message-ID strings, with angle brackets, or a single string of
diff --git a/gnorb-utils.el b/gnorb-utils.el
index 8810a18..050c3e3 100644
--- a/gnorb-utils.el
+++ b/gnorb-utils.el
@@ -617,8 +617,7 @@ registry be in use, and should be called after the call to
(require 'gnorb-gnus)
(unless (gnus-registry-install-p)
(user-error "Gnorb tracking requires that the Gnus registry be
installed."))
- (add-hook 'org-capture-mode-hook 'gnorb-registry-capture)
- (add-hook 'org-capture-prepare-finalize-hook
'gnorb-registry-capture-abort-cleanup)
+ (add-hook 'org-capture-prepare-finalize-hook #''gnorb-registry-capture)
(setq gnorb-tracking-enabled t))))
;;;###autoload