Hello all, I want to define a capture template which pre-processes the head of the kill ring with a sexp that takes a string as an argument: (setq org-capture-templates (quote (("l" "Link" entry (file+headline "" "Links") "* \"%c\" %(get-page-title \"%c\")")))) ;; throws Bad url (get-page-title "foo-bar") ;; works as expected (get-page-title "http://orgmode.org/manual/Template-expansion.html") (defun get-page-title (url) "Get title of web page, whose url can be found in the current line" ;; Get title of web page, with the help of functions in url.el (with-current-buffer (url-retrieve-synchronously url) ;; find title by grep the html code (goto-char 0) (re-search-forward "\\([^<]*\\)" nil t 1) (setq web_title_str (match-string 1)) ;; find charset by grep the html code (goto-char 0) ;; find the charset, assume utf-8 otherwise (if (re-search-forward "charset=\\([-0-9a-zA-Z]*\\)" nil t 1) (setq coding_charset (downcase (match-string 1))) (setq coding_charset "utf-8") ;; decode the string of title. (setq web_title_str (decode-coding-string web_title_str (intern coding_charset))) ) (concat "[[" url "][" web_title_str "]]") )) Please just ignore that I'm trying to parse XML with a regexp here. get-page-title works when called from code but always returns bad url when called from the capture template. Is the problem the way I escape the string or is this just not the way the sexp in capture are supposed to be used? Regards, Philipp