emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Marcin Antczak <marcin.antczak@neutrico-themes.pl>
To: emacs orgmode-mailinglist <emacs-orgmode@gnu.org>
Subject: How to programmatically use/edit data provided on capture
Date: Sun, 03 Aug 2014 03:03:10 +0200	[thread overview]
Message-ID: <53DD8A4E.5090504@neutrico-themes.pl> (raw)

Hi all!

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.

For example: I got variable NAME and would like to use function like 
(s-dashed-words string) from s.el to make sure that my NAME is valid and 
converted to dashed syntax.

Let's say that my input is: New random project

I would like to have:

#+begin_src
* TODO new-random-project / Some task description
    :PROPERTIES:
    :NAME: "New random project"
    :END:
#+end_src

While currently I got:

#+begin_src
* TODO New random project / Some task description
    :PROPERTIES:
    :NAME: "New random project"
    :END:
#+end_src

I have been trying:

#+BEGIN_SRC
* TODO %(custom-dashify-function %\1) / Some task description
    :PROPERTIES:
    :NAME: %^{NAME}
    :END:
#+END_SRC

or

#+BEGIN_SRC
* TODO %(custom-dashify-function %\\1) / Some task description
    :PROPERTIES:
    :NAME: %^{NAME}
    :END:
#+END_SRC

But apparently function is executed before %\1 is replaced by my data 
and it dodesn't work.
Could someone help me to write function that would get data I provided 
for property NAME, convert using s-dashed-words and return to template 
before finalize?


Marcin

             reply	other threads:[~2014-08-03  1:06 UTC|newest]

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

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=53DD8A4E.5090504@neutrico-themes.pl \
    --to=marcin.antczak@neutrico-themes.pl \
    --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).