From mboxrd@z Thu Jan 1 00:00:00 1970 From: Rainer Stengele Subject: Re: add a list item and automatically insert an incative timestamp without being asked to confirm "now" Date: Thu, 26 Mar 2009 16:18:01 +0100 Message-ID: <49CB9CA9.2040207@diplan.de> References: Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Return-path: Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1LmrLY-0001Le-5V for emacs-orgmode@gnu.org; Thu, 26 Mar 2009 11:18:20 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1LmrLS-0001H9-Vp for emacs-orgmode@gnu.org; Thu, 26 Mar 2009 11:18:19 -0400 Received: from [199.232.76.173] (port=46008 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1LmrLS-0001H1-PR for emacs-orgmode@gnu.org; Thu, 26 Mar 2009 11:18:14 -0400 Received: from ns.diplan.de ([212.34.188.4]:35142 helo=mail.diplan.de) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1LmrLS-00029s-C0 for emacs-orgmode@gnu.org; Thu, 26 Mar 2009 11:18:14 -0400 In-Reply-To: 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: Carsten Dominik Cc: emacs-orgmode@gnu.org Carsten Dominik schrieb: > > On Mar 25, 2009, at 2:30 PM, Rainer Stengele wrote: > >> Hi all, >> >> I want to write a function to create a new item in an item list and >> immediately >> insert an inactive timestamp. How could I possibly do this? >> I can write a keyboard macro, yes. >> But can somebody show me how to write a function which I can >> global-set-key to? >> >> >> Must be something like >> ... >> (org-meta-return) >> (org-time-stamp-inactive t) >> ... >> >> >> Problem is I then get asked to confirm the current timestamp. In this >> case I >> always want to use the current timestamp without being asked. >> > > (defun xxx () > (interactive) > (org-insert-item) > (org-insert-time-stamp (current-time) 'with-hm 'inactive)) > > This assumes that you are in a plain list already. Funnily > enough, there is no command to insert an item at any location, except > pressing > > - SPC > > of course :-) > > So you could do > > > (defun xxx () > (interactive) > (if (not (org-in-item-p)) > (insert "- ") > (org-insert-item)) > (org-insert-time-stamp (current-time) 'with-hm 'inactive)) > > > > HTH > > - Carsten > > > - Carsten > Hi Carsten, thanks a lot! Why didn't I find that myself? I simply tried C-h k C-c ! and found (org-time-stamp-inactive &optional arg). If I only had found a hint to (org-insert-time-stamp time &optional with-hm inactive pre post extra) ... Thanks again! Rainer