summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarsten Dominik <carsten.dominik@gmail.com>2010-12-20 15:50:23 +0100
committerCarsten Dominik <carsten.dominik@gmail.com>2010-12-20 15:50:23 +0100
commit5f77fd6a81a4241ce5a8e346acb9df089d65b462 (patch)
tree502517de8043f3bf142af0b47aa88cf64d0c2fd7
parentf9e174b74ed197cd61781936b08fb926140c393c (diff)
parent2be22d9aa4829432d3c3e511d664f3fc2f454354 (diff)
downloadorg-mode-5f77fd6a81a4241ce5a8e346acb9df089d65b462.tar.gz
Merge branch 't/patch491'
-rw-r--r--lisp/org-agenda.el25
1 files changed, 15 insertions, 10 deletions
diff --git a/lisp/org-agenda.el b/lisp/org-agenda.el
index 23ad0e7..f32c60e 100644
--- a/lisp/org-agenda.el
+++ b/lisp/org-agenda.el
@@ -1316,6 +1316,8 @@ This format works similar to a printf format, with the following meaning:
%t the time-of-day specification if one applies to the entry, in the
format HH:MM
%s Scheduling/Deadline information, a short string
+ %(expression) Eval expression and replaces the control string
+ by the result
All specifiers work basically like the standard `%s' of printf, but may
contain two additional characters: A question mark just after the `%' and
@@ -5389,11 +5391,12 @@ The resulting form is returned and stored in the variable
(t " %-12:c%?-12t% s")))
(start 0)
varform vars var e c f opt)
- (while (string-match "%\\(\\?\\)?\\([-+]?[0-9.]*\\)\\([ .;,:!?=|/<>]?\\)\\([ctsei]\\)"
+ (while (string-match "%\\(\\?\\)?\\([-+]?[0-9.]*\\)\\([ .;,:!?=|/<>]?\\)\\([ctsei]\\|(.+)\\)"
s start)
- (setq var (cdr (assoc (match-string 4 s)
- '(("c" . category) ("t" . time) ("s" . extra)
- ("i" . category-icon) ("T" . tag) ("e" . effort))))
+ (setq var (or (cdr (assoc (match-string 4 s)
+ '(("c" . category) ("t" . time) ("s" . extra)
+ ("i" . category-icon) ("T" . tag) ("e" . effort))))
+ 'eval)
c (or (match-string 3 s) "")
opt (match-beginning 1)
start (1+ (match-beginning 0)))
@@ -5409,12 +5412,14 @@ The resulting form is returned and stored in the variable
(save-match-data
(if (string-match "\\.[0-9]+" x)
(string-to-number (substring (match-string 0 x) 1)))))))
- (if opt
- (setq varform
- `(if (equal "" ,var)
- ""
- (format ,f (if (equal "" ,var) "" (concat ,var ,c)))))
- (setq varform `(format ,f (if (equal ,var "") "" (concat ,var ,c (get-text-property 0 'extra-space ,var))))))
+ (if (eq var 'eval)
+ (setq varform `(format ,f (org-eval ,(read (match-string 4 s)))))
+ (if opt
+ (setq varform
+ `(if (equal "" ,var)
+ ""
+ (format ,f (if (equal "" ,var) "" (concat ,var ,c)))))
+ (setq varform `(format ,f (if (equal ,var "") "" (concat ,var ,c (get-text-property 0 'extra-space ,var)))))))
(setq s (replace-match "%s" t nil s))
(push varform vars))
(setq vars (nreverse vars))