emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Daimrod <daimrod@gmail.com>
To: "Øyvind Stegard" <oyvinst@ifi.uio.no>
Cc: emacs-orgmode@gnu.org
Subject: Re: [PATCH] org-contacts: Update contacts cache if it contains markers with no buffer
Date: Tue, 16 Jul 2013 19:23:50 +0200	[thread overview]
Message-ID: <87fvvexvtl.fsf@tanger.home> (raw)
In-Reply-To: 878v1cdoke.fsf.rednorrock@ifi.uio.no

[-- Attachment #1: Type: text/plain, Size: 2062 bytes --]

Øyvind Stegard <oyvinst@ifi.uio.no> 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 #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 835 bytes --]

  reply	other threads:[~2013-07-16 17:19 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-07-12 11:07 [PATCH] org-contacts: Update contacts cache if it contains markers with no buffer Øyvind Stegard
2013-07-16 17:23 ` Daimrod [this message]
2013-07-17  7:36   ` Øyvind Stegard
2013-07-20 15:22     ` Daimrod
2013-07-20 15:33       ` Øyvind Stegard

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87fvvexvtl.fsf@tanger.home \
    --to=daimrod@gmail.com \
    --cc=emacs-orgmode@gnu.org \
    --cc=oyvinst@ifi.uio.no \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).