emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: "Peter Münster" <pmlists@free.fr>
To: emacs-orgmode@gnu.org
Subject: [PATCH] Make org-notify.el work with latest org-element.el
Date: Tue, 6 Nov 2012 12:27:39 +0100	[thread overview]
Message-ID: <878vafkm22.fsf@micropit.couberia.selfip.net> (raw)

* contrib/lisp/org-notify.el (org-notify-convert-deadline): New function.
(org-notify-make-todo): Use that function.
 contrib/lisp/org-notify.el |   11 ++++++++++-
 1 files changed, 10 insertions(+), 1 deletions(-)

diff --git a/contrib/lisp/org-notify.el b/contrib/lisp/org-notify.el
index c4ff8ae..a4002c4 100644
--- a/contrib/lisp/org-notify.el
+++ b/contrib/lisp/org-notify.el
@@ -106,12 +106,21 @@
          (cdr (assoc (match-string 3 str) conv))
          (if (= (length (match-string 1 str)) 1) -1 1)))))
+(defun org-notify-convert-deadline (orig)
+  "Convert original deadline from `org-element-parse-buffer' to
+simple timestamp string."
+  (if orig
+      (replace-regexp-in-string "^<\\|>$" ""
+				(plist-get (plist-get orig 'timestamp)
+					   :raw-value))))
 (defun org-notify-make-todo (heading &rest ignored)
   "Create one todo item."
   (macrolet ((get (k) `(plist-get list ,k))
              (pr (k v) `(setq result (plist-put result ,k ,v))))
     (let* ((list (nth 1 heading))      (notify (or (get :notify) "default"))
-           (deadline (get :deadline))  (heading (get :raw-value))
+           (deadline (org-notify-convert-deadline (get :deadline)))
+	   (heading (get :raw-value))
       (when (and (eq (get :todo-type) 'todo) heading deadline)
         (pr :heading heading)     (pr :notify (intern notify))


             reply	other threads:[~2012-11-06 11:28 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-11-06 11:27 Peter Münster [this message]
2012-11-14 18:32 ` [PATCH] Make org-notify.el work with latest org-element.el 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:

  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=878vafkm22.fsf@micropit.couberia.selfip.net \
    --to=pmlists@free.fr \
    --cc=emacs-orgmode@gnu.org \


* 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


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).