Author: Nix
Updated:
Expiry and expire-proof entries for the BBDB
This file implements expiry of BBDB databases, to stop them getting too fantastically bloated. Only specific entries are retained across expiry. Each entry is passed through each function in the `bbdb-expire-expiry-functions' in turn; if any return t it is a candicate for expiry; but if any of the functions in the `bbdb-expire-preservation-functions' return t, it is not expired after all. (This scheme allows functions to say `I don't care' as well as `expire me now' and `do not expire me'.) One function is on `bbdb-expire-expiry-functions' by default; `bbdb-expire-record-old-p'. Two functions are on `bbdb-expire-preservation-functions' by default; `bbdb-expire-field-permanent-p' and `bbdb-expire-field-notes-p'. Together, these ensure that old records without a `notes' or a `permanent' field are expired; the field-checking functions are generated by a macro, `bbdb-expire-field-foo-p'. This will probably only work with version 2.00 of the BBDB, and may well only work with version 2.00.06. It requires the `bbdb-hidden-update.el' library, available from wherever you got `bbdb-expire.el' from. To use: First of all, after you load this package but before you do anything else with the BBDB, do a `bbdb-expire-add-last-access-time'. This attaches the last access time field to all the BBDB entries, and assumes they were last accessed *right now*. You never need to do this again, except if you stop using this package and want to restart later on. WARNING: If you forget to do this, only entries that you have accessed, and then left for more than `bbdb-expire-this-old' days, will be expired; entries that have been left since before you used this package will be left alone, which is suboptimal. (You do not need to do this if you remove `bbdb-expire-record-old-p' from the `bbdb-expire-expiry-functions', but that leaves this package mostly devoid of function...) To expire the BBDB at any time, run `bbdb-expire-bbdb'. Everything else happens automagically. To do: Currently, `bbdb-expire-bbdb' is not automatically called. The ideal would be to call it once per session, as BBDB initializes, but the only obvious place to do that is the `bbdb-after-read-db-hook', but as you cannot call `bbdb-records' from that hook, this is impossible. If you have any idea where I can hang it, please say! This is dependent on the bbdb-hidden-update library, which is very brittle and BBDB version dependent. It would be nice to remove this dependency (but that requires changes to BBDB itself). Add customize support. This probably does not work with GNU Emacs; I don't currently have a copy so it is hard to test it there, and there are probably unintentional dependencies on XEmacs. If you want to use this on GNU Emacs, and it doesn't work, please tell me what is missing or broken for GNU Emacs support so I can fix it, as I would like it to work there as well.