From: Jay Kamat <jaygkamat@gmail.com>
To: Org Mode <emacs-orgmode@gnu.org>
Subject: [patch] fix error when using org-notify with no agenda files
Date: Mon, 09 Apr 2018 22:02:47 -0400 [thread overview]
Message-ID: <87muyb2577.fsf@gmail.com> (raw)
[-- Attachment #1.1: Type: text/plain, Size: 555 bytes --]
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
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1.2: 0001-org-notify.el-Fix-an-error-in-org-notify-process-whe.patch --]
[-- Type: text/x-diff, Size: 1799 bytes --]
From d0dc9035b2d7c77dc65102ab27ecacf3664599fa Mon Sep 17 00:00:00 2001
From: Jay Kamat <jaygkamat@gmail.com>
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
---
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
--- 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))))
- (setq org-notify-parse-file
- (if (or (not org-notify-parse-file) (>= 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)))))
+ (when files
+ (setq org-notify-parse-file
+ (if (or (not org-notify-parse-file) (>= 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))))))
(defun org-notify-maybe-too-late (diff period heading)
"Print warning message, when notified significantly later than defined by
--
2.14.2
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 832 bytes --]
next reply other threads:[~2018-04-10 2:02 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-04-10 2:02 Jay Kamat [this message]
2018-04-10 18:11 ` [patch] fix error when using org-notify with no agenda files Nicolas Goaziou
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=87muyb2577.fsf@gmail.com \
--to=jaygkamat@gmail.com \
--cc=emacs-orgmode@gnu.org \
/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).