[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/gnorb 4b19c83 288/449: New function for pruning dead as
From: |
Stefan Monnier |
Subject: |
[elpa] externals/gnorb 4b19c83 288/449: New function for pruning dead associations |
Date: |
Fri, 27 Nov 2020 23:15:57 -0500 (EST) |
branch: externals/gnorb
commit 4b19c836c97eb98ba75ab7eb727bb92044572459
Author: Eric Abrahamsen <eric@ericabrahamsen.net>
Commit: Eric Abrahamsen <eric@ericabrahamsen.net>
New function for pruning dead associations
* gnorb-registry.el (gnorb-flush-dead-associations): New function.
Removes gnorb-id values from registry entries when those values no
longer point at existing Org headings.
Useful for when the registry is full of entries with the gnorb-id key
set, and pruning can't remove them.
---
gnorb-registry.el | 31 +++++++++++++++++++++++++++++++
1 file changed, 31 insertions(+)
diff --git a/gnorb-registry.el b/gnorb-registry.el
index bd2e07a..9ff4ab3 100644
--- a/gnorb-registry.el
+++ b/gnorb-registry.el
@@ -163,6 +163,37 @@ after an Org heading is deleted, for instance."
msg-id 'gnorb-ids (remove org-id org-ids))))
assoc-msgs)))
+(defun gnorb-flush-dead-associations (&optional clean-archived)
+ "Clean the registry of associations with nonexistent headings.
+
+Gnus will not prune registry entries that appear to be associated
+with an Org heading. If your registry is limited to a very small
+size, you may end up with a full registry. Use this function to
+remove dead associations, and free up more entries for possible
+pruning.
+
+By default, associations are considered \"live\" if the Org
+heading exists in an Org file or in an Org archive file. When
+optional CLEAN_ARCHIVED is non-nil, delete associations from
+archived headings as well."
+ (interactive "P")
+ (let ((gnorb-id-tracker
+ (registry-lookup-secondary gnus-registry-db 'gnorb-ids))
+ (deleted-count 0))
+ (require 'org-id)
+ (maphash
+ (lambda (k _)
+ (let ((file (org-id-find-id-file k)))
+ (unless
+ (and file
+ (and clean-archived
+ (string-match-p "org_archive$" file)))
+ (gnorb-delete-all-associations k)
+ (incf deleted-count))))
+ gnorb-id-tracker)
+ (message "Disassociated %d nonexistent Org headings"
+ deleted-count)))
+
(defun gnorb-registry-org-id-search (id)
"Find all messages that have the org ID in their 'gnorb-ids
key."
- [elpa] externals/gnorb 2c0f43d 249/449: Refinements to link extraction, (continued)
- [elpa] externals/gnorb 2c0f43d 249/449: Refinements to link extraction, Stefan Monnier, 2020/11/27
- [elpa] externals/gnorb e1fb666 257/449: Function for deleting all assocations of an Org heading, Stefan Monnier, 2020/11/27
- [elpa] externals/gnorb 5688114 258/449: Bugfix: Adding mailtos to newly-setup messages, Stefan Monnier, 2020/11/27
- [elpa] externals/gnorb 04ec3ab 264/449: Fix logic of choosing heading to trigger, Stefan Monnier, 2020/11/27
- [elpa] externals/gnorb de0dff5 274/449: Protection for message disassociation, Stefan Monnier, 2020/11/27
- [elpa] externals/gnorb 321b23b 276/449: Remove gnus-interactive, Stefan Monnier, 2020/11/27
- [elpa] externals/gnorb 8a9c167 277/449: Fix the cl-lib loading stuff, Stefan Monnier, 2020/11/27
- [elpa] externals/gnorb fd91084 278/449: Remove incorrect "fix" for Gnus 5.13, Stefan Monnier, 2020/11/27
- [elpa] externals/gnorb c8b80c5 282/449: Bugfix for gnorb-gnus-view, Stefan Monnier, 2020/11/27
- [elpa] externals/gnorb 9220a10 283/449: Docstring fix, Stefan Monnier, 2020/11/27
- [elpa] externals/gnorb 4b19c83 288/449: New function for pruning dead associations,
Stefan Monnier <=
- [elpa] externals/gnorb 819b1e5 293/449: Suggest binding gnorb-org-view in Org Agenda, Stefan Monnier, 2020/11/27
- [elpa] externals/gnorb c13f4df 301/449: Better check for capture cleanup, Stefan Monnier, 2020/11/27
- [elpa] externals/gnorb 13bb840 302/449: Hint which heading will be triggered, Stefan Monnier, 2020/11/27
- [elpa] externals/gnorb 4f99dd7 304/449: Handle conditions where `registry-search' returns nil, Stefan Monnier, 2020/11/27
- [elpa] externals/gnorb 5897188 305/449: Capture to child/sibling is done, Stefan Monnier, 2020/11/27
- [elpa] externals/gnorb b951675 303/449: Merge capture-to-child branch, Stefan Monnier, 2020/11/27
- [elpa] externals/gnorb b0fe9ae 306/449: New command `gnorb-gnus-quick-reply', Stefan Monnier, 2020/11/27
- [elpa] externals/gnorb ce764a5 307/449: fixup with new quick reply command, Stefan Monnier, 2020/11/27
- [elpa] externals/gnorb acb91c5 315/449: Fix doc error, Stefan Monnier, 2020/11/27
- [elpa] externals/gnorb 4d3de61 316/449: Various documentation improvements, Stefan Monnier, 2020/11/27