gnus-art.el (gnus-mime-buttonize-attachments-in-header): Improve criterion that finds...
[gnus] / lisp / gnus-registry.el
index 5a7dfd8..f3b81f7 100644 (file)
@@ -1,6 +1,6 @@
 ;;; gnus-registry.el --- article registry for Gnus
 
-;; Copyright (C) 2002-2013 Free Software Foundation, Inc.
+;; Copyright (C) 2002-2014 Free Software Foundation, Inc.
 
 ;; Author: Ted Zlatanov <tzz@lifelogs.com>
 ;; Keywords: news registry
@@ -1125,9 +1125,9 @@ only the last one's marks are returned."
 (add-hook 'gnus-registry-unload-hook 'gnus-registry-unload-hook)
 
 (defun gnus-registry-install-p ()
-  "If the registry is not already enabled, and `gnus-registry-install' is t,
-the registry is enabled.  If `gnus-registry-install' is `ask',
-the user is asked first.  Returns non-nil iff the registry is enabled."
+  "Return non-nil if the registry is enabled (and maybe enable it first).
+If the registry is not already enabled, then if `gnus-registry-install'
+is `ask', ask the user; or if `gnus-registry-install' is non-nil, enable it."
   (interactive)
   (unless gnus-registry-enabled
     (when (if (eq gnus-registry-install 'ask)
@@ -1186,6 +1186,29 @@ data stored in the registry."
                   (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))))
+
 ;; TODO: a few things
 
 (provide 'gnus-registry)