From mboxrd@z Thu Jan 1 00:00:00 1970 From: Tassilo Horn Subject: Re: Setting PROPERTIES in remember templates automatically Date: Fri, 27 Nov 2009 23:17:12 +0100 Message-ID: <87my27k3yv.fsf@thinkpad.tsdh.de> References: <87zl688fjd.fsf@thinkpad.tsdh.de> <20091127125338.GE2013@yog-sothoth.mohorovi.cc> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Return-path: Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1NE97y-0008GR-8z for emacs-orgmode@gnu.org; Fri, 27 Nov 2009 17:17:22 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1NE97t-0008CF-Dc for emacs-orgmode@gnu.org; Fri, 27 Nov 2009 17:17:21 -0500 Received: from [199.232.76.173] (port=56381 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NE97s-0008By-UG for emacs-orgmode@gnu.org; Fri, 27 Nov 2009 17:17:16 -0500 Received: from out4.smtp.messagingengine.com ([66.111.4.28]:46792) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1NE97s-0001QG-LO for emacs-orgmode@gnu.org; Fri, 27 Nov 2009 17:17:16 -0500 In-Reply-To: <20091127125338.GE2013@yog-sothoth.mohorovi.cc> (James TD Smith's message of "Fri, 27 Nov 2009 12:53:38 +0000") List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: James TD Smith Cc: emacs-orgmode@gnu.org James TD Smith writes: Hi James, >> 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. Thanks, I'll have a look. > 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 > > (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"))))) > > 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. What if the function or variable evals to nil? I'd expect that then the property is not inserted at all. > Here's an example template with properties: > > (:key ?r :type headline :name "Book" > :target "~/Personal/ReadingList.org::Books" > :properties ("AUTHOR" "ISBN") :tag t :tagscope file > :template "* MEDIA %^{Title} %?") Looks pretty self-explanatory and logical to me. > 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. Nice. > 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. This looks all very nice. Do you plan to merge your enhancements back into Carsten's branch anytime soon? Bye, Tassilo