[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[O] [PATCH] Capture: Expand keyword within %(SEXP) in template
From: |
Ryo TAKAISHI |
Subject: |
[O] [PATCH] Capture: Expand keyword within %(SEXP) in template |
Date: |
Fri, 2 Nov 2012 18:20:01 +0900 |
* lisp/org-capture.el: If %(SEXP) has %:keyword, expand it using
org-store-link-plist.
I want to expand %:description keyword in sexp "%(func %:description)".
But if org-capture template is "%(function %:keyword)", function take a symbol
%:keyword, it does'nt expand.
This patch expand %:keyword within %(SEXP), so funcsion is taken %:keyword's
value.
For example, when capture template is "%(func %:description)" and a keyword
:description is "foobar", func is taken string "foobar".
Modified from a patch proposal by Ryo TAKAISHI.
TINYCHANGE
---
lisp/org-capture.el | 10 +++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)
diff --git a/lisp/org-capture.el b/lisp/org-capture.el
index be973b0..a8e49d6 100644
--- a/lisp/org-capture.el
+++ b/lisp/org-capture.el
@@ -1620,7 +1620,15 @@ The template may still contain \"%?\" for cursor
positioning."
(goto-char (match-beginning 0))
(let ((template-start (point)))
(forward-char 1)
- (let ((result (org-eval (read (current-buffer)))))
+ (let* ((sexp (mapcar '(lambda (attr)
+ (let* ((attr-symbol (symbol-name attr))
+ (key (if (string-match "%\\(:.*\\)"
attr-symbol)
+ (intern (match-string 1
attr-symbol))
+ nil)))
+ (or (plist-get org-store-link-plist key)
+ attr)))
+ (read (current-buffer))))
+ (result (org-eval sexp)))
(delete-region template-start (point))
(insert result))))))
--
1.7.9.5
- [O] [PATCH] Capture: Expand keyword within %(SEXP) in template,
Ryo TAKAISHI <=
- Re: [O] [PATCH] Capture: Expand keyword within %(SEXP) in template, Nicolas Goaziou, 2012/11/02
- Re: [O] [PATCH] Capture: Expand keyword within %(SEXP) in template, Ryo TAKAISHI, 2012/11/02
- Re: [O] [PATCH] Capture: Expand keyword within %(SEXP) in template, Nicolas Goaziou, 2012/11/02
- Re: [O] [PATCH] Capture: Expand keyword within %(SEXP) in template, Ryo TAKAISHI, 2012/11/02
- Re: [O] [PATCH] Capture: Expand keyword within %(SEXP) in template, Nicolas Goaziou, 2012/11/03
- Re: [O] [PATCH] Capture: Expand keyword within %(SEXP) in template, Ryo TAKAISHI, 2012/11/04
- Re: [O] [PATCH] Capture: Expand keyword within %(SEXP) in template, Nicolas Goaziou, 2012/11/04
- Re: [O] [PATCH] Capture: Expand keyword within %(SEXP) in template, Ryo TAKAISHI, 2012/11/04
- Re: [O] [PATCH] Capture: Expand keyword within %(SEXP) in template, Nicolas Goaziou, 2012/11/04
- Re: [O] [PATCH] Capture: Expand keyword within %(SEXP) in template, Ryo TAKAISHI, 2012/11/05