From 35e623da77892650b8a9ffab89a62a32192eab6c Mon Sep 17 00:00:00 2001 From: "Toby S. Cubitt" Date: Sun, 29 Jan 2012 10:51:46 +0100 Subject: [PATCH] Agenda: Add org-agenda-diary-sexp-prefix customization option * lisp/org-agenda.el (org-agenda-diary-sexp-prefix): Regexp matching deadline/scheduling information to be displayed in diary sexp agenda items. (org-agenda-get-sexps): Extract deadline/scheduling information from diary sexp entries. --- lisp/org-agenda.el | 18 ++++++++++++++++-- 1 files changed, 16 insertions(+), 2 deletions(-) diff --git a/lisp/org-agenda.el b/lisp/org-agenda.el index 796f158..1af37c1 100644 --- a/lisp/org-agenda.el +++ b/lisp/org-agenda.el @@ -1516,6 +1516,16 @@ to occupy a fixed space in the agenda display." :group 'org-agenda-line-format :type 'string) +(defcustom org-agenda-diary-sexp-prefix nil + "A regexp that matches part of a diary sexp entry +which should be treated as scheduling/deadline information in +`org-agenda'. + +For example, you can use this to extract the `diary-remind-message' from +`diary-remind' entries." + :group 'org-agenda-line-format + :type '(choice (const :tag "None" nil) (regexp :tag "Regexp"))) + (defcustom org-agenda-timerange-leaders '("" "(%d/%d): ") "Text preceding timerange entries in the agenda view. This is a list with two strings. The first applies when the range @@ -5046,7 +5056,7 @@ This function is invoked if `org-agenda-todo-ignore-deadlines', (format "mouse-2 or RET jump to org file %s" (abbreviate-file-name buffer-file-name)))) (regexp "^&?%%(") - marker category org-category-pos ee txt tags entry + marker category extra org-category-pos ee txt tags entry result beg b sexp sexp-entry todo-state) (goto-char (point-min)) (while (re-search-forward regexp nil t) @@ -5070,12 +5080,16 @@ This function is invoked if `org-agenda-todo-ignore-deadlines', (dolist (r (if (stringp result) (list result) result)) ;; we expect a list here + (when (and org-agenda-diary-sexp-prefix + (string-match org-agenda-diary-sexp-prefix r)) + (setq extra (match-string 0 r) + r (replace-match "" nil nil r))) (if (string-match "\\S-" r) (setq txt r) (setq txt "SEXP entry returned empty string")) (setq txt (org-agenda-format-item - "" txt category tags 'time)) + extra txt category tags 'time)) (org-add-props txt props 'org-marker marker) (org-add-props txt nil 'org-category category 'date date 'todo-state todo-state -- 1.7.8.5