From mboxrd@z Thu Jan 1 00:00:00 1970 From: Jay Kamat Subject: [patch] fix error when using org-notify with no agenda files Date: Mon, 09 Apr 2018 22:02:47 -0400 Message-ID: <87muyb2577.fsf@gmail.com> Mime-Version: 1.0 Content-Type: multipart/signed; boundary="==-=-="; micalg=pgp-sha256; protocol="application/pgp-signature" Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:36736) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1f5icY-0006pC-3W for emacs-orgmode@gnu.org; Mon, 09 Apr 2018 22:02:55 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1f5icV-0002e1-0J for emacs-orgmode@gnu.org; Mon, 09 Apr 2018 22:02:54 -0400 Received: from mail-yw0-x230.google.com ([2607:f8b0:4002:c05::230]:46203) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1f5icU-0002dr-Qx for emacs-orgmode@gnu.org; Mon, 09 Apr 2018 22:02:50 -0400 Received: by mail-yw0-x230.google.com with SMTP id v68so3502898ywg.13 for ; Mon, 09 Apr 2018 19:02:50 -0700 (PDT) Received: from laythe (res404s-128-61-105-124.res.gatech.edu. [128.61.105.124]) by smtp.gmail.com with ESMTPSA id n26sm766900ywh.16.2018.04.09.19.02.47 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 09 Apr 2018 19:02:48 -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" To: Org Mode --==-=-= Content-Type: multipart/mixed; boundary="=-=-=" --=-=-= Content-Type: text/plain Hi, Previously, when `org-agenda-files' was nil, and `org-notify-start' had been called (org-notify running), I got the following error every time `org-notify-process' would run. Wrong type argument: stringp, nil This patch fixes this so `org-notify' won't throw errors if no agenda files are present. Please let me know if you spot any issues. I thought about adding a one-time message warning the user, would this be a good idea (or should we just stay out of their way)? I would be happy to implement it if that would be preferable. Thanks, -Jay --=-=-= Content-Type: text/x-diff Content-Disposition: inline; filename=0001-org-notify.el-Fix-an-error-in-org-notify-process-whe.patch Content-Transfer-Encoding: quoted-printable From=20d0dc9035b2d7c77dc65102ab27ecacf3664599fa Mon Sep 17 00:00:00 2001 From: Jay Kamat Date: Mon, 9 Apr 2018 21:47:58 -0400 Subject: [PATCH] org-notify.el: Fix an error in `org-notify-process' when unconfigured * contrib/lisp/org-notify.el (org-notify-todo-list): Return nil if `org-agenda-files' is nil =2D-- contrib/lisp/org-notify.el | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/contrib/lisp/org-notify.el b/contrib/lisp/org-notify.el index 8e800eec7..56cf85d9d 100644 =2D-- a/contrib/lisp/org-notify.el +++ b/contrib/lisp/org-notify.el @@ -137,15 +137,16 @@ simple timestamp string." "Create the todo-list for one org-agenda file." (let* ((files (org-agenda-files 'unrestricted)) (max (1- (length files)))) =2D (setq org-notify-parse-file =2D (if (or (not org-notify-parse-file) (>=3D org-notify-parse-fil= e max)) =2D 0 =2D (1+ org-notify-parse-file))) =2D (save-excursion =2D (with-current-buffer (find-file-noselect =2D (nth org-notify-parse-file files)) =2D (org-element-map (org-element-parse-buffer 'headline) =2D 'headline 'org-notify-make-todo))))) + (when files + (setq org-notify-parse-file + (if (or (not org-notify-parse-file) (>=3D org-notify-parse-file max)) + 0 + (1+ org-notify-parse-file))) + (save-excursion + (with-current-buffer (find-file-noselect + (nth org-notify-parse-file files)) + (org-element-map (org-element-parse-buffer 'headline) + 'headline 'org-notify-make-todo)))))) =20 (defun org-notify-maybe-too-late (diff period heading) "Print warning message, when notified significantly later than defined by =2D-=20 2.14.2 --=-=-=-- --==-=-= Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAEBCAAdFiEEZ6pXmKqofkVuZqB+XS45lgD097UFAlrMG0cACgkQXS45lgD0 97WYKg/9GNIkTRltPIlhLo/Fi8W4SV5VFvQ6YnUY9d6VQusj96tWPe0MCZT3bZCf 3ilkQZi/rzqCBATFOf30e5L81Ze8FuCCayjJVQV7EDGIYrO7yToQrIszKeaLEPmc wYy4cE7x4NScrSRmAAa4+VKX58BWFkX5rsuTd53jcfcDSu5ciKxX9tmDKyU4rNEt YoyrqcHIbn+yX9vHNTz7ALmOb4KpGdFOwcHm7rR09bK+2dhyyldsLJOkfyfeKsTH 9TSPKz5j4JaiUo6ruyMgMxJVbpwf+InG/XsDglUfBIIli9GHsE1lUKYGrcVj+vZX /pKyHARPcfItn2jSXFsKd1aC10RUQ8ILLOhYJK4Sc+SUTLjvZqGhvkHOgdx5TiRW xIsWaQGt4qWPAzzGQnX7A1s4aFhCoR9+vJfJ4O0MYPKYlp8ky9EWJTUYS/0rgfax b8i3qEOsl7XY3sqhMTXPiPoof5GzcKUdGDNYhQDgXaCt3ZJmOJSdY+Wrn5ugQPGk v584bwHEINSPkAKeCAimD+hdwzqNSZsfRKNu5eW7PdeQ6xlQDE0RTzYScKK+cJJ7 JpfhtIx/7rn2LbWtrGObAsnQfV9D0Ub63J5csjbAFY9DQRIG8Ib+U0rxUIOU3QBX 3hWAkzIt9ZX2ElOpqIGhvlQpU/ZxpgIZ8sAoAchUcHZuKrc9kqo= =NChh -----END PGP SIGNATURE----- --==-=-=--