[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Some Gnus Registry questions

From: Tassilo Horn
Subject: Re: Some Gnus Registry questions
Date: Wed, 03 Jul 2013 10:07:09 +0200
User-agent: Gnus/5.130008 (Ma Gnus v0.8) Emacs/24.3.50 (gnu/linux)

Ted Zlatanov <> writes:

> On Thu, 13 Jun 2013 08:08:40 +0200 Tassilo Horn <> wrote: 
> TH> Ok, so now I've set gnus-registry-track-extra to nil in order to make
> TH> the registry only track message ids.  That works fine for new articles,
> TH> but is there a way to remove the sender, recipients, and subjects from
> TH> old articles that are already contained in the registry?
> TH> `gnus-registry-remake-db' looks like it will erase all information, so
> TH> I've not tried that so far.
> I have definitely not needed this so far :)
> You can probably write it starting with `gnus-registry-remove-ignored'
> for the iteration across all articles and for each article, do something
> like this (untested):
> (defun gnus-registry-remove-id-key (id key)
>   (let ((db gnus-registry-db)
>         (entry (gnus-registry-get-or-make-entry id)))
>     (registry-delete db (list id) nil)
>     (setq entry (assq-delete-all key entry))
>     (gnus-registry-insert db id entry)
>     entry))
> where `key' is 'subject for example.  If that works for you, I can add
> both a more generic iteration and the remove function above.

Thanks.  I've come up with this, and it seems to work:

--8<---------------cut here---------------start------------->8---
(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
if you stop tracking some extra data and now want to purge it
from your existing entries."
  (interactive (list (mapcar 'intern
                              "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 (cl-remove-if #'(lambda (entry)
                                             (member (car entry) extra))
                 (registry-delete db (list k) nil)
                 (gnus-registry-insert db k newv)))
      (registry-reindex db))))
--8<---------------cut here---------------end--------------->8---

However, it didn't shrink the size of the registry that much (reduced
the size by about one fourth).

Anyway, I think it's useful.  Should I add it to gnus-registry.el?  (I
guess I'll have to remove the `cl-remove-if' to stay compatible with
older emacsen...)


reply via email to

[Prev in Thread] Current Thread [Next in Thread]