emacs-orgmode
[Top][All Lists]
Advanced

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

Re: [O] [PATCH] org-contacts: Update contacts cache if it contains marke


From: Daimrod
Subject: Re: [O] [PATCH] org-contacts: Update contacts cache if it contains markers with no buffer
Date: Tue, 16 Jul 2013 19:23:50 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux)

Øyvind Stegard <address@hidden> writes:

> Hi list,

Hello,

> In contrib/lisp/org-contacts.el:
>
> The function `org-contacts-db-need-update-p' does two checks to
> determine if the contacts cache should be updated:
> 1. If the variable `org-contacts-last-update' is nil.
> 2. If modification time of any file containing contacts is more recent than
>    timestamp recorded in `org-contacts-last-update'.
>
> There is another case where an update is required: when marker objects
> contained in the contact cache `org-contacts-db' suddenly point to no
> buffer. If a buffer containing contacts is killed, but underlying file
> is not modified, org-contacts will not detect this, and cached markers
> that pointed to the now killed buffer will become dead (have no buffer
> associated with them). This seems to cause problems at least in
> `org-contacts-anniversaries', which if used as diary sexp in an agenda
> file, will cause "Bad sexp" errors.
>
> I have not done any thorough analysis of `org-contacts-anniversaries'
> itself, but it seems to work OK whenever the markers in
> `org-contacts-db' are OK. And it looks like the markers are used in that
> code.
>
> To reproduce:
> 1. Load up org-contacts and do a query with "M-x org-contacts".
> 2. Kill at least one org-buffer containing a contact with BIRTHDAY
>    property set (but do not save underlying file).
> 3. Make sure to use %%(org-contacts-anniversaries) in some agenda file.
> 4. Opening agenda should produce a "Bad sexp" error.
>
>
> I've attached a patch (against git master) which I am currently using.
> It will cause org-contacts to re-load if a marker is found in cache that
> points to no buffer. This looked to me like the quickest approach for
> fixing it without getting to know org-contacts.el better.
>

Thanks for the bug report!

Don't you think that checking if one of the buffer would be enough and
faster?
With something like (every #'get-file-buffer org-contacts-files)

>
> Regards,
>
> Øyvind

-- 
Daimrod/Greg

Attachment: signature.asc
Description: PGP signature


reply via email to

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