From: James TD Smith <ahktenzero@mohorovi.cc>
To: Tassilo Horn <tassilo@member.fsf.org>
Cc: emacs-orgmode@gnu.org
Subject: Re: Setting PROPERTIES in remember templates automatically
Date: Fri, 27 Nov 2009 12:53:38 +0000 [thread overview]
Message-ID: <20091127125338.GE2013@yog-sothoth.mohorovi.cc> (raw)
In-Reply-To: <87zl688fjd.fsf@thinkpad.tsdh.de>
Hi Tassilo,
On 2009-11-27 10:48:06(+0100), Tassilo Horn wrote:
<snip>
> 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?
I've actually got something like this working, as part of a whole load of
improvements to remember which I've been working on for ages. If you want to
take a look it's in the remember-lite branch at
git://yog-sothoth.mohorovi.cc/org-mode.
The first major change is that remember templates are now plists. Old-style
templates are automatically converted to the new format, but if you want to
access any of the new features you will need to use the new template format, and
add your templates to org-remember-templates-2.
Properties are now set by adding a :properties property to the list. This should
be followed by a list containing either:
- A string. Query the user for the property value.
- A cons cell. The head should be a string (the property name) and the tail can
be either:
- Another string: add the property with that string as its value
- A variable: add the property with the value of the variable
- A function: call the function to get the property value.
There is also a variable `org-remember-default-properties', for properties you
want added to all remembered items.
Mine is set like this
--8<---------------cut here---------------start------------->8---
(setq org-remember-default-properties
'(("CREATED" .
(lambda () (format-time-string (org-time-stamp-format t t)
org-remember-current-time)))
("CONTEXT" .
(lambda () (if (and (marker-buffer org-clock-marker)
(not (eq (marker-buffer org-clock-marker)
(current-buffer))))
(org-substring-no-properties org-clock-heading)
"Idle")))))
--8<---------------cut here---------------end--------------->8---
which adds two properties to every item I remember, one containing the current
time as an inactive timestamp and the other containing the name of the currently
clocked task or 'Idle' if I'm not clocked into anything.
Here's an example template with properties:
--8<---------------cut here---------------start------------->8---
(:key ?r :type headline :name "Book"
:target "~/Personal/ReadingList.org::Books"
:properties ("AUTHOR" "ISBN") :tag t :tagscope file
:template "* MEDIA %^{Title} %?")
--8<---------------cut here---------------end--------------->8---
When I remember something using this template, the CREATED and CONTEXT
properties are added automatically, and I get asked for the values for AUTHOR
and ISBN.
Anyway, there are lots of other changes, and probably a few bugs, and there
isn't much in the way of documentation yet :). Let me know how you get on.
James
--
|-<James TD Smith>-<email/ahktenzero@mohorovi.cc>-|
next prev parent reply other threads:[~2009-11-27 12:53 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-11-27 9:48 Setting PROPERTIES in remember templates automatically Tassilo Horn
2009-11-27 12:53 ` James TD Smith [this message]
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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20091127125338.GE2013@yog-sothoth.mohorovi.cc \
--to=ahktenzero@mohorovi.cc \
--cc=emacs-orgmode@gnu.org \
--cc=tassilo@member.fsf.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 external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.