Benjamin Rutt <[EMAIL PROTECTED]> writes:

> I have been using the bbdb for about two months now and I feel like I
> am using it wrong.  I spend all my time tweaking the
> bbdb-ignore-some-messages-alist for email addresses I don't want
> noticed, to protect them from being automatically added (I have that
> turned on for gnus mail groups).  I also spend a lot of time manually
> deleting ??? entries (ones without a name) from the bbdb.  I feel that
> this is wrong because I'll be doing this manual cleaning and updating
> for the rest of my life using this plan.

This is one of the things I wrote expire-bbdb for; you can ignore the
crap if it only appears once, because it'll just get expired away. (You
end up with a *lot* of crap after a few years; expiry's just kicked in
here for the first time, and it's thrown away 3/4 of my bbdb records at
once :) )

> So rather than having to keep my bbdb "clean", I would like there to
> be a way so that my frequent contacts bubble up to the top, so

Ooo, nice idea.

> whenever I M-x bbdb RET RET I can see the frequent contacts near the
> top, and all the people I hear from infrequently are near the end
> (where "frequent" is defined as how often bbdb notices the net
> address).  That way, it will still be useful to browse the bbdb.

Hmmmm.... *thinks*

> Any suggestions here?  Is there any way to specify the sort order of
> bbdb records when you are browsing in M-x bbdb ?  I saw something
> interesting from Nix on gnu.emacs.sources (expire-bbdb.el I think)

Yep, a bad name. It should be called bbdb-expire.el, and I may well
rename it --- only that would annoy existing users slightly...

> that might touch on some of this (i.e. it added a timestamp field
> IIRC) but the warnings scared me away.

It looks quite tricky to change the sort order of records in the
database, but luckily we don't need to change that; we just need to
change the display order, and that can be done by redefining the
function `bbdb-record-sortkey' --- although we cannot advise it, we must
redefine it.

We'd also need a `noticed-frequency' field, hidden with
`bbdb-elided-display' and updated from the bbdb-notice-hook, in the same
sort of way as the `last-access' field is updated in expire-bbdb.el ---
and with similar horrible kludges, because the notice hook gets called a
lot --- e.g., when updating records, as well as when looking at them,
and because we don't want updates to the noticed-frequency field to
update the list of changed records (which governs the !! thing in the
modeline of modified records; if we didn't frob that, every single
record we saw would always be marked modified.)

It looks like it's sufficiently similar to expire-bbdb.el that they
should both be handled by the same sort of (kludgy) machinery. I may
generalize that machinery into a library that both expire-bbdb.el and
the sort-frequency thing call.

The other interesting part is what criteria to use to decide when to
update the noticed-frequency field. You don't want to do it all the time
because you probably don't want it to apply e.g. to records noticed in
newsgroups. I think a predicate list along the lines of the
`bbdb-expire-expiry-functions' in expire-bbdb.el would serve.


I think I'll do that refactoring work to expire-bbdb.el, rename it, and
write this. Thanks for the suggestion :)

-- 
`Normally, we don't do people's homework around here, but Venice 
 is a very beautiful city, so I'll make a small exception.'
        --- Robert Redelmeier compromises his principles
_______________________________________________
bbdb-info mailing list
[EMAIL PROTECTED]
http://lists.sourceforge.net/mailman/listinfo/bbdb-info

Reply via email to