emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Richard Lawrence <richard.lawrence@berkeley.edu>
To: emacs-orgmode@gnu.org
Subject: Re: How to programmatically use/edit data provided on capture
Date: Sat, 02 Aug 2014 23:55:54 -0700	[thread overview]
Message-ID: <87wqaqjc3p.fsf@berkeley.edu> (raw)
In-Reply-To: 53DD8A4E.5090504@neutrico-themes.pl

Hi Marcin,

Marcin Antczak <marcin.antczak@neutrico-themes.pl> 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

      reply	other threads:[~2014-08-03  6:57 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-08-03  1:03 How to programmatically use/edit data provided on capture Marcin Antczak
2014-08-03  6:55 ` Richard Lawrence [this message]

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=87wqaqjc3p.fsf@berkeley.edu \
    --to=richard.lawrence@berkeley.edu \
    --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).