mirror of
https://git.savannah.gnu.org/git/emacs/org-mode.git
synced 2024-09-17 20:10:15 +00:00
Make org-notify.el work with latest org-element.el
* contrib/lisp/org-notify.el (org-notify-convert-deadline): New function. (org-notify-make-todo): Use that function.
This commit is contained in:
parent
907110e913
commit
8fb2cb8c19
|
@ -106,12 +106,21 @@
|
||||||
(cdr (assoc (match-string 3 str) conv))
|
(cdr (assoc (match-string 3 str) conv))
|
||||||
(if (= (length (match-string 1 str)) 1) -1 1)))))
|
(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)
|
(defun org-notify-make-todo (heading &rest ignored)
|
||||||
"Create one todo item."
|
"Create one todo item."
|
||||||
(macrolet ((get (k) `(plist-get list ,k))
|
(macrolet ((get (k) `(plist-get list ,k))
|
||||||
(pr (k v) `(setq result (plist-put result ,k ,v))))
|
(pr (k v) `(setq result (plist-put result ,k ,v))))
|
||||||
(let* ((list (nth 1 heading)) (notify (or (get :notify) "default"))
|
(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)
|
result)
|
||||||
(when (and (eq (get :todo-type) 'todo) heading deadline)
|
(when (and (eq (get :todo-type) 'todo) heading deadline)
|
||||||
(pr :heading heading) (pr :notify (intern notify))
|
(pr :heading heading) (pr :notify (intern notify))
|
||||||
|
|
Loading…
Reference in a new issue