From mboxrd@z Thu Jan 1 00:00:00 1970 From: Daimrod Subject: Re: [PATCH] org-contacts: Update contacts cache if it contains markers with no buffer Date: Tue, 16 Jul 2013 19:23:50 +0200 Message-ID: <87fvvexvtl.fsf@tanger.home> References: <878v1cdoke.fsf.rednorrock@ifi.uio.no> Mime-Version: 1.0 Content-Type: multipart/signed; boundary="=-=-="; micalg=pgp-sha1; protocol="application/pgp-signature" Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:36770) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Uz8uG-0006pB-Uq for emacs-orgmode@gnu.org; Tue, 16 Jul 2013 13:19:23 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Uz8uF-0003IC-Qw for emacs-orgmode@gnu.org; Tue, 16 Jul 2013 13:19:20 -0400 Received: from mail-we0-x231.google.com ([2a00:1450:400c:c03::231]:36591) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Uz8uF-0003Hs-LG for emacs-orgmode@gnu.org; Tue, 16 Jul 2013 13:19:19 -0400 Received: by mail-we0-f177.google.com with SMTP id m19so872613wev.36 for ; Tue, 16 Jul 2013 10:19:18 -0700 (PDT) List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: =?utf-8?Q?=C3=98yvind?= Stegard Cc: emacs-orgmode@gnu.org --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable =C3=98yvind Stegard 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 th= an > 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, > > =C3=98yvind =2D-=20 Daimrod/Greg --=-=-= Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.20 (GNU/Linux) iQIcBAEBAgAGBQJR5YGyAAoJEBNzVHcrZRiUaOkP/26NzZD/o0ktned82Hb7tGoL 3yClGouX0tSQlNde0FGc+xllWLDiVhD9zgWph1CuSaFlG1JtP8K1diHUJF0YbH6K ryMpS6IaMuwZWn/KokRmqblx5ij2vt9iu7FLn2S83t/MXzbXtK0y2PT1ialsL2qZ N0UVBhBacksnv98HJWkjHV0X/NH6op+fcPwVucry1uL51ViEbMFZvQsdlDB8vkKZ MeMSNIDD0mfEi1LZhvDLD/6NkQPaKmNe0LvnlTxM3ukJQ+WHVO291yQfX/viR2jZ IV6IFgQ3XUh8/EObIi1vorXqifAi4h3qS40m9tFmvLU9FKWmpbI5qlX9Va8Q0PK2 Q/B47AYKtGmgYpfy9nF5ITD+dEQ1x9831KOzRFqGnEfOTnBnDoCiK2pw6WfZBkJe NYfpybrOOgqgDadmowssBD5UNiuBzlX7c95gTPFYiXPYSrVi67/p5kzJ/+qeXI7o YpiI0htA5U8af11FD7KF3bU4S7UU81mQ+kxs6z2tLg1sZ53UUnrdAN9ERKBtaxYS chVylww3davgq7/6ZaNs96oVUnOK1fmP5f8cm35Z+gOqhrmu8zBCRzXQiWufC9bQ L0ZI5oSu+0hmlnU8UypV3TCafJfxTSWJEr4IFv59XUXX2lppeh2REY52/nrMbHP6 VvH+lETckDdl5WBXuk2d =e0tU -----END PGP SIGNATURE----- --=-=-=--