[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [O] How to programmatically use/edit data provided on capture
From: |
Richard Lawrence |
Subject: |
Re: [O] How to programmatically use/edit data provided on capture |
Date: |
Sat, 02 Aug 2014 23:55:54 -0700 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/23.4 (gnu/linux) |
Hi Marcin,
Marcin Antczak <address@hidden> 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