From: Juan Pechiar <pechiar@computer.org>
To: carsten.dominik@gmail.com
Cc: emacs-orgmode@gnu.org
Subject: [PATCH] org-capture with LISP function template
Date: Sun, 18 Jul 2010 22:45:52 -0300 [thread overview]
Message-ID: <20100719014552.GI5569@soloJazz.com> (raw)
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))
next reply other threads:[~2010-07-19 1:46 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-07-19 1:45 Juan Pechiar [this message]
2010-07-19 7:05 ` [PATCH] org-capture with LISP function template Carsten Dominik
2010-07-19 12:26 ` Juan
2010-07-19 12:43 ` Carsten Dominik
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.orgmode.org/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20100719014552.GI5569@soloJazz.com \
--to=pechiar@computer.org \
--cc=carsten.dominik@gmail.com \
--cc=emacs-orgmode@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).