emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Tassilo Horn <tassilo@member.fsf.org>
To: emacs-orgmode@gnu.org
Subject: Setting PROPERTIES in remember templates automatically
Date: Fri, 27 Nov 2009 10:48:06 +0100	[thread overview]
Message-ID: <87zl688fjd.fsf@thinkpad.tsdh.de> (raw)

Hi all,

in my remember templates, I'd like to set some PROPERTIES to the value
of some org-remember escape sequences.  Till now, I did that by defining
a template like that:

  ("NORMAL"  ?n "* %?\n  %i\n  :PROPERTIES:\n  :created: %U\n  :END:")

This works, but templates become very large quickly.  And I don't like
that I have to do the indentation on my own.

Ok, now I have a new usecase.  I want to set a property if some escape
sequence is non-nil.  Or more concrete: I want to set a property :link:
if the template escape sequence %a has a value.

Therefore, I tried this template using the %(sexp) escape:

  ("NORMAL"  ?n
   "* %?\n  %i %(org-set-property \"created\" \"%U\")
               %(org-set-property \"annotation\" \"%a\")")

Unfortunately, when I select this template, emacs hangs and I have to
hit C-g.  At that point, I get this expansion in my remember buffer:

--8<---------------cut here---------------start------------->8---
* %?
   %(org-set-property "created" "[2009-11-27 Fri 10:38]")
   %(org-set-property "annotation"
   "[[file:~/News/drafts/drafts/4::hit%20C%20g][file:~/News/drafts/drafts/4::hit C g]]")
--8<---------------cut here---------------end--------------->8---

What I'd like to have is something like the existing

  %^{prop}p   Prompt the user for a value for property `prop'

but more like

  %{prop,escape}p   Insert property `prop' with value taken from escape,
                    if that is non-nil

With this

  "%{created,U} %{link,a}"

in a template would always create a :created: property with an inactive
timestamp, and :link: would only be inserted, if there is an annotation
for that remember invocation.

What do you think?

Bye,
Tassilo

             reply	other threads:[~2009-11-27  9:48 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-11-27  9:48 Tassilo Horn [this message]
2009-11-27 12:53 ` Setting PROPERTIES in remember templates automatically James TD Smith
2009-11-27 22:17   ` Tassilo Horn

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=87zl688fjd.fsf@thinkpad.tsdh.de \
    --to=tassilo@member.fsf.org \
    --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).