emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[O] [PATCH] Make org-notify.el work with latest org-element.el


From: Peter Münster
Subject: [O] [PATCH] Make org-notify.el work with latest org-element.el
Date: Tue, 6 Nov 2012 12:27:39 +0100
User-agent: Gnus/5.130006 (Ma Gnus v0.6) Emacs/24.2 (gnu/linux)

* 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))
            result)
       (when (and (eq (get :todo-type) 'todo) heading deadline)
         (pr :heading heading)     (pr :notify (intern notify))
-- 
1.7.3.4


-- 
           Peter




reply via email to

[Prev in Thread] Current Thread [Next in Thread]