emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* [PATCH] Make org-notify.el work with latest org-element.el
@ 2012-11-06 11:27 Peter Münster
  2012-11-14 18:32 ` Nicolas Goaziou
  0 siblings, 1 reply; 2+ messages in thread
From: Peter Münster @ 2012-11-06 11:27 UTC (permalink / raw)
  To: emacs-orgmode

* 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

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] Make org-notify.el work with latest org-element.el
  2012-11-06 11:27 [PATCH] Make org-notify.el work with latest org-element.el Peter Münster
@ 2012-11-14 18:32 ` Nicolas Goaziou
  0 siblings, 0 replies; 2+ messages in thread
From: Nicolas Goaziou @ 2012-11-14 18:32 UTC (permalink / raw)
  To: Peter Münster; +Cc: emacs-orgmode

Hello,

Peter Münster <pmlists@free.fr> writes:

> * contrib/lisp/org-notify.el (org-notify-convert-deadline): New function.
> (org-notify-make-todo): Use that function.

Applied. Thank you.


Regards,

-- 
Nicolas Goaziou

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2012-11-14 18:36 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-11-06 11:27 [PATCH] Make org-notify.el work with latest org-element.el Peter Münster
2012-11-14 18:32 ` Nicolas Goaziou

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