From mboxrd@z Thu Jan 1 00:00:00 1970 From: Richard Lawrence Subject: Re: How to programmatically use/edit data provided on capture Date: Sat, 02 Aug 2014 23:55:54 -0700 Message-ID: <87wqaqjc3p.fsf@berkeley.edu> References: <53DD8A4E.5090504@neutrico-themes.pl> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:41762) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XDpjZ-0005Tc-MX for emacs-orgmode@gnu.org; Sun, 03 Aug 2014 02:57:39 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XDpjT-0004Ul-IX for emacs-orgmode@gnu.org; Sun, 03 Aug 2014 02:57:33 -0400 Received: from plane.gmane.org ([80.91.229.3]:56783) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XDpjT-0004UW-Bp for emacs-orgmode@gnu.org; Sun, 03 Aug 2014 02:57:27 -0400 Received: from list by plane.gmane.org with local (Exim 4.69) (envelope-from ) id 1XDpjR-0005zc-FA for emacs-orgmode@gnu.org; Sun, 03 Aug 2014 08:57:25 +0200 Received: from 67.164.45.159 ([67.164.45.159]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Sun, 03 Aug 2014 08:57:25 +0200 Received: from richard.lawrence by 67.164.45.159 with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Sun, 03 Aug 2014 08:57:25 +0200 List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: emacs-orgmode@gnu.org Hi Marcin, Marcin Antczak writes: > I got capture template with prompts to collect some properties: > > #+BEGIN_SRC > * TODO %\1 / Some task description > :PROPERTIES: > :NAME: %^{NAME} > :END: > #+END_SRC > > My question is: How to get information on user input data to transform > this data before capture finalize. I too have wanted to do something like this, but I am not sure that it is possible without hacking org-capture, because I don't think you can hook into the template processing at an arbitrary point. Is it really important that you transform the data *before* capture finalize? If not, I think you could do this *during* capture finalize by replacing, say, a pre-determined string "PUT-NAME-HERE" with the value of (custom-dashify-function (org-entry-get (point) "NAME")) You could do that from org-capture-prepare-finalize-hook, maybe. Would that work for you? It has some limitations: - it's only easy to recover data that was entered as properties or tags, not arbitrary strings - you can't continue to edit the capture buffer after doing this processing, since the hook will only be called after you start finalization If you come up with a better solution, I'd like to hear about it! I have scratched my head about this several times before, but I've never come up with a satisfactory solution. Good luck! Best, Richard