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: Wed, 01 Jul 2015 17:39:53 +0200 Message-ID: <87ioa3opiu.fsf@gmail.com> References: <395DF5E7-3C6F-4CDD-8A88-8D1525BBE5AC@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]:41632) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZAK7F-0006Gy-En for emacs-orgmode@gnu.org; Wed, 01 Jul 2015 11:40:02 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZAK7B-0004Uy-Ui for emacs-orgmode@gnu.org; Wed, 01 Jul 2015 11:40:01 -0400 Received: from smtptls1-cha.cpub.univ-nantes.fr ([2001:660:7220:385:193:52:103:113]:45798 helo=smtp-tls.univ-nantes.fr) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZAK7B-0004TP-KV for emacs-orgmode@gnu.org; Wed, 01 Jul 2015 11:39:57 -0400 In-Reply-To: <395DF5E7-3C6F-4CDD-8A88-8D1525BBE5AC@gmx.com> (phcrama ebiz's message of "Thu, 25 Jun 2015 13:01:56 +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: phcrama.ebiz@gmx.com Cc: emacs-orgmode@gnu.org --=-=-= Content-Type: text/plain Content-Transfer-Encoding: quoted-printable phcrama.ebiz@gmx.com writes: > Hi Nicolas and Greg, Hi Philippe, sorry for the late reply :( > Thank you for applying my initial patch. > > Inspired by Greg's improvements to my patch, I'd like to propose the atta= ched (presumptuously named) better-patch that I believe fixes the TODO of m= y initial patch. > > Sorry it isn't quite in the format of the previous one/recommended by the= project but I'm not on my main machine now. > --- org.el Fri Jun 19 12:07:26 2015 > +++ org-modif.el Wed Jun 24 09:13:10 2015 > @@ -18097,17 +18097,28 @@ > (defun org-file-menu-entry (file) > (vector file (list 'find-file file) t)) >=20=20 > -(defun org-check-agenda-file (file) > - "Make sure FILE exists. If not, ask user what to do." > +(defun org-check-agenda-file-1 (file) > + "Make sure FILE exists. If not, ask user what to do. > + > +Possible outcomes: > +1. File exists -> return NIL. > +2. File doesn't exist and user requests to remove it -> throws 'nextfile. > +3. File doesn't exist and user requests to remove it -> raise error \"Ab= ort\". > + > +You probably want `org-check-agenda-file'." > (when (not (file-exists-p file)) > (message "Non-existent agenda file %s. [R]emove from list or [A]bor= t?" > (abbreviate-file-name file)) > (let ((r (downcase (read-char-exclusive)))) > (cond > ((equal r ?r) > - (org-remove-file file) > (throw 'nextfile t)) > (t (error "Abort")))))) The 3. item looks wrong to me. I think it should be: 3. File doesn't exist and user requests to abort -> raise error \"Abort\". > +(defun org-check-agenda-file (file) > + "Make sure FILE exists, else if user agrees, remove FILE from `org-age= nda-files'." > + (when (catch 'nextfile (org-check-agenda-file-1 file)) > + (org-remove-file file))) >=20=20 > (defun org-get-agenda-file-buffer (file) > "Get a buffer visiting FILE. If the buffer needs to be created, add >=20 >=20 > --- org-contacts.el Fri Jun 19 12:07:20 2015 Moreover, I'm not sure about changing the behaviour of an existing function. Though the change looks good to me, it is very likely users (or maybe even other parts of org-mode, I'haven't check) rely on it, and expect to catch exceptions. > +++ org-contacts-modif.el Wed Jun 24 09:13:56 2015 > [snip] I agree with the modifications of org-contacts.el. Maybe org-contacts.el should have its own version of `org-check-agenda-file' (e.g. named `org-contacts-check-contacts-file') until we find a better solution... WDYT? Best, =2D-=20 Daimrod/Greg --=-=-= Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQIcBAEBAgAGBQJVlAnJAAoJEBNzVHcrZRiU15MP/2poDNc6Cpfz3evQFdvghc7w RiG9cyJ/W5/JfuALXT2quQZjK1DlbfyaVO2R3Y3aDC2ztU6di7r9wjlLpsvoWH+l tCtCXeNC4aZ8HHOvqrYnACyuujEgbVmQD5ZNX33NjzmGsPQZfILYJAkSyjEB4h6A qKI5E+0ALlxegbitclv8Cr1hWN+abB2DCmx8743ic1Qned/9mB68/+x4+c2Jymo1 AaHWG6yb3tik9yKH2dlCYyc5I5/0ymGn6GYs0RsbNRjRlovWrI3jxEpQebwXTz05 h4i4lJMfbsax3MV13uWzViKvmHqTTVzh/YSZmy80as+WS1w6wzo2jgb6Cm53OC15 sXYTq+r1Ztgkx4D7Otss07zlJae18eRpW/ZHAomrsP/hc+2cvfYqQVqf/IzcGJpT B04JOSyyWM7fmBKnM5LH43NAEuI+P/4Y4kYrfn6/DXDFRwsgv3WLH02XaZ5Y6KTf u2maR/qj2A3y3iBj3BJFWBTzZssnRSmmhRzeuv8NwnJYQt0U/I5yLgZ0XtVX17D2 y2iHWTuOSTs1c+2Jf1kHVPLXvlUG/FM31t2NXogwZ1KlKCUhp7OBOr/tAgAkP+zy sQAheKmV9Lo8c/gEt0p5xoUJdmmBq1TQJ+kVCPXFlJf8L8xXlvMqydcTs/tcmJ1J XlFLdWcKJmH42Sk0edDA =gHat -----END PGP SIGNATURE----- --=-=-=--