emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Orgmode] [PATCH] org-capture with LISP function template


From: Juan Pechiar
Subject: [Orgmode] [PATCH] org-capture with LISP function template
Date: Sun, 18 Jul 2010 22:45:52 -0300
User-agent: Mutt/1.5.20 (2009-06-14)

Hi Carsten + crowd,

Below is a patch for org-capture when the template is given by a LISP
function.

Problem was that the function is inside a string (not a LISP form), so
the string has to be evaluated explicitly.

Now it's working for me. I use it to get a template formed by
URL/title and selected text from Opera browser (on Mac OSX). I´ll
publish this after polishing the code.

I've also been testing exotic org-capture templates and I've found no
other errors yet.

Best regards,
.j.

8<------------------------------------------------------------

diff --git a/lisp/org-capture.el b/lisp/org-capture.el
index 2a3a1b8..409427f 100644
--- a/lisp/org-capture.el
+++ b/lisp/org-capture.el
@@ -440,8 +440,8 @@ bypassed."
          (setq txt (org-file-contents file))
        (setq txt (format "* Template file %s not found" (nth 1
        txt)))))
      ((and (listp txt) (eq (car txt) 'function))
-      (if (fboundp (nth 1 txt))
-         (setq txt (funcall (nth 1 txt)))
+      (if (eval (concat "fboundp " (nth 1 txt)))
+         (setq txt (eval (read (nth 1 txt))))
        (setq txt (format "* Template function %s not found" (nth 1
        txt)))))
      ((not txt) (setq txt ""))
      ((stringp txt))



reply via email to

[Prev in Thread] Current Thread [Next in Thread]