+;; largely based on nnir-warp-to-article
+(defun gnus-try-warping-via-registry ()
+ "Try to warp via the registry.
+This will be done via the current article's source group based on
+data stored in the registry."
+ (interactive)
+ (when (gnus-summary-article-header)
+ (let* ((message-id (mail-header-id (gnus-summary-article-header)))
+ ;; Retrieve the message's group(s) from the registry
+ (groups (gnus-registry-get-id-key message-id 'group))
+ ;; If starting from an ephemeral group, this describes
+ ;; how to restore the window configuration
+ (quit-config
+ (gnus-ephemeral-group-p gnus-newsgroup-name))
+ (seen-groups (list (gnus-group-group-name))))
+
+ (catch 'found
+ (dolist (group (mapcar 'gnus-simplify-group-name groups))
+
+ ;; skip over any groups we really don't want to warp to.
+ (unless (or (member group seen-groups)
+ (gnus-ephemeral-group-p group) ;; any ephemeral group
+ (memq (car (gnus-find-method-for-group group))
+ ;; Specific methods; this list may need to expand.
+ '(nnir)))
+
+ ;; remember that we've seen this group already
+ (push group seen-groups)
+
+ ;; first exit from any ephemeral summary buffer.
+ (when quit-config
+ (gnus-summary-exit)
+ ;; and if the ephemeral summary buffer in turn came from
+ ;; another summary buffer we have to clean that summary
+ ;; up too.
+ (when (eq (cdr quit-config) 'summary)
+ (gnus-summary-exit))
+ ;; remember that we've already done this part
+ (setq quit-config nil))
+
+ ;; Try to activate the group. If that fails, just move
+ ;; along. We may have more groups to work with
+ (when
+ (ignore-errors
+ (gnus-select-group-with-message-id group message-id) t)
+ (throw 'found t))))))))
+
+(defun gnus-registry-remove-extra-data (extra)
+ "Remove tracked EXTRA data from the gnus registry.
+EXTRA is a list of symbols. Valid symbols are those contained in
+the docs of `gnus-registry-track-extra'. This command is useful
+when you stop tracking some extra data and now want to purge it
+from your existing entries."
+ (interactive (list (mapcar 'intern
+ (completing-read-multiple
+ "Extra data: "
+ '("subject" "sender" "recipient")))))
+ (when extra
+ (let ((db gnus-registry-db))
+ (registry-reindex db)
+ (loop for k being the hash-keys of (oref db data)
+ using (hash-value v)
+ do (let ((newv (delq nil (mapcar #'(lambda (entry)
+ (unless (member (car entry) extra)
+ entry))
+ v))))
+ (registry-delete db (list k) nil)
+ (gnus-registry-insert db k newv)))
+ (registry-reindex db))))
+