branch: master commit 743112674b4eb36fce5ee4b05cab348d49a3cf56 Author: Eric Abrahamsen <e...@ericabrahamsen.net> Commit: Eric Abrahamsen <e...@ericabrahamsen.net>
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. --- packages/gnorb/gnorb-registry.el | 16 ---------------- packages/gnorb/gnorb-utils.el | 3 +-- 2 files changed, 1 insertion(+), 18 deletions(-) diff --git a/packages/gnorb/gnorb-registry.el b/packages/gnorb/gnorb-registry.el index 51bce39..749c370 100644 --- a/packages/gnorb/gnorb-registry.el +++ b/packages/gnorb/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/packages/gnorb/gnorb-utils.el b/packages/gnorb/gnorb-utils.el index 8810a18..050c3e3 100644 --- a/packages/gnorb/gnorb-utils.el +++ b/packages/gnorb/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