From mboxrd@z Thu Jan 1 00:00:00 1970 From: Daimrod Subject: Re: [PATCH] org-contacts.el: Catch 'nextfile in org-contacts-db Date: Sun, 21 Jun 2015 18:14:09 +0200 Message-ID: <87zj3tqbse.fsf@gmail.com> References: <7za8w7j4o5.wl-phcrama.ebiz@gmx.com> 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]:47235) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Z6hsx-0005uv-9o for emacs-orgmode@gnu.org; Sun, 21 Jun 2015 12:14:20 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Z6hsw-0003Tk-5l for emacs-orgmode@gnu.org; Sun, 21 Jun 2015 12:14:19 -0400 Received: from smtptls1-cha.cpub.univ-nantes.fr ([2001:660:7220:385:193:52:103:113]:35449 helo=smtp-tls.univ-nantes.fr) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Z6hsv-0003TG-RI for emacs-orgmode@gnu.org; Sun, 21 Jun 2015 12:14:18 -0400 In-Reply-To: <7za8w7j4o5.wl-phcrama.ebiz@gmx.com> (Philippe Crama's message of "Wed, 10 Jun 2015 11:25:46 +0200") 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: Philippe Crama Cc: emacs-orgmode@gnu.org --==-=-= Content-Type: multipart/mixed; boundary="=-=-=" --=-=-= Content-Type: text/plain Philippe Crama writes: > Hi, Hello Philippe, > This is a small patch to catch the 'nextfile thrown by > `org-check-agenda-file' in `org-contacts-db'. > > I don't know how to fix the TODO in the comment myself, sorry. At > least, with the patch, the execution doesn't abort anymore. Thanks for the report and the patch. I've attached a patch inspired by yours. WDYT? --=-=-= Content-Type: text/x-diff Content-Disposition: inline; filename=0001-org-contacts.el-Handle-missing-files-in-org-contacts.patch Content-Transfer-Encoding: quoted-printable From=20b3bb252c6e2138fa65b7c960060d68ea8c260873 Mon Sep 17 00:00:00 2001 From: =3D?UTF-8?q?Gr=3DC3=3DA9goire=3D20Jadi?=3D Date: Mon, 15 Jun 2015 09:36:36 +0200 Subject: [PATCH] org-contacts.el: Handle missing files in `org-contacts-fil= es' gracefully * contrib/lisp/org-contacts.el (org-contacts-files): Catch 'nextfile From=20`org-check-agenda-file' and update `org-contacts-files' if modified. (org-contacts-db): Don't call `org-check-agenda-file' now called in `org-contacts-files'. When `org-agenda-files' contains non-existent files, remove them if the user asks for it instead of failing. Modified from a patch proposal by Philippe Crama =2D-- contrib/lisp/org-contacts.el | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/contrib/lisp/org-contacts.el b/contrib/lisp/org-contacts.el index bc07fc1..3e14c7e 100644 =2D-- a/contrib/lisp/org-contacts.el +++ b/contrib/lisp/org-contacts.el @@ -227,7 +227,12 @@ A regexp matching strings of whitespace, `,' and `;'.") =20 (defun org-contacts-files () "Return list of Org files to use for contact management." =2D (or org-contacts-files (org-agenda-files t 'ifmode))) + (org-remove-if (lambda (file) + (when (catch 'nextfile + (org-check-agenda-file file)) + (customize-save-variable 'org-contacts-files + (delete file org-contacts-files)))) + (or org-contacts-files (org-agenda-files t 'ifmode)))) =20 (defun org-contacts-db-need-update-p () "Determine whether `org-contacts-db' needs to be refreshed." @@ -261,7 +266,6 @@ to dead or no buffer." (make-progress-reporter "Updating Org Contacts Database..." 0 (lengt= h org-contacts-files))) (i 0)) (dolist (file (org-contacts-files)) =2D (org-check-agenda-file file) (with-current-buffer (org-get-agenda-file-buffer file) (unless (eq major-mode 'org-mode) (error "File %s is not in `org-mode'" file)) =2D-=20 1.9.1 --=-=-= Content-Type: text/plain Content-Transfer-Encoding: quoted-printable > Regards, =2D-=20 Daimrod/Greg --=-=-=-- --==-=-= Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQIcBAEBAgAGBQJVhuLRAAoJEBNzVHcrZRiU/eMP/2mbFN+gSqUuYGtZLvJmDS+s QeQIM/q6S+x9FfD0EGUrRYMNiHk/Db7P85jV6LDnmjPDI5B252oTYz+hKHC9kdYa DG0h7Dpj5HaFCT1mIe3CeuX/OQ8nUuZclTDkXQAwU7YEPnMEIAyH9PhAxA4YZADW QEzJwjXRQuyR8rx1PIar5BbYHlt7EnxV2bkRBooLdQMMoAZ9RgmyNK2MR3HlmAB1 mmJB3JwabLJ4+FSVFTEpFshELZM1q/SLrjr8/nWwKVcg6R1nOd7JFcLCLk9Gx5ag 4iaF3y4RnvwDQGB8EvIz/d5UOOQF0ND/pfSqNmXZWWs3Khi/EZDAlFf6LLcU1GON 9GXo4qCFDkE+rAmGeGtVy0hQ4kgFwV5R9J0BON47h6Oxx0xXQLZfJUhEOFo5iqnb 0/MysAsoBRfQb5bCNbU5LfQzRyPaHE/bJc9dsABZMIZbXJDcBspdHl+fVtgObbzk hG5i10B+WBiOvrZkSAz9XRfvQ3g8ZNtRF0iWWbh3kxih2lRaHoh6AtkAbVMWfKiU zqMlU2YSwXOIwDlqQK59aWQ04iOt7TsBv3jqZ5KamLm3lE53DBISZ3LBn+ns7De9 Of2aZUhNZ3pgVmMvOpsISqNnCJ00ltwnRRHcQEY6NSrw19MZT2wliAgz+kAVSnbt tJbxwgX5M6X1UfknI9TP =EbxI -----END PGP SIGNATURE----- --==-=-=--