From mboxrd@z Thu Jan 1 00:00:00 1970 From: Niels Giesen Subject: Timestamp increment inside tables Date: Thu, 03 May 2007 19:33:45 +0200 Message-ID: <87ejlxolqe.fsf@gmail.com> References: <463a0628.02bdbc61.2bbf.2dafSMTPIN_ADDED@mx.google.com> 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 1HjfIq-0003Y7-Ah for emacs-orgmode@gnu.org; Thu, 03 May 2007 13:41:16 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1HjfIo-0003Wd-9w for emacs-orgmode@gnu.org; Thu, 03 May 2007 13:41:16 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1HjfIo-0003Wa-70 for emacs-orgmode@gnu.org; Thu, 03 May 2007 13:41:14 -0400 Received: from ug-out-1314.google.com ([66.249.92.171]) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1HjfCF-00025v-UB for emacs-orgmode@gnu.org; Thu, 03 May 2007 13:34:28 -0400 Received: by ug-out-1314.google.com with SMTP id j3so467527ugf for ; Thu, 03 May 2007 10:34:21 -0700 (PDT) In-Reply-To: <463a0628.02bdbc61.2bbf.2dafSMTPIN_ADDED@mx.google.com> (emacs-orgmode-request@gnu.org's message of "Thu, 03 May 2007 12:00:26 -0400") 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: emacs-orgmode@gnu.org Hi Carsten, Please consider this patch to `org-table-copy-down', serving to increment timestamps in an org-table while copying down, similar to integer icrements: --- org.el 2007-04-25 08:26:21.000000000 -0100 +++ org2.el 2007-05-03 19:24:00.776923788 -0100 @@ -6495,7 +6495,11 @@ column to be filled row-by-row. If the variable `org-table-copy-increment' is non-nil and the field is an -integer, it will be incremented while copying." +integer or a timestamp, it will be incremented while copying. In the case of +a timestamp, if the cursor is on the year, change the year. If it is on the +month or the day, change that. Point will stay on the current date field +in order to easily repeat the interval." (interactive "p") (let* ((colpos (org-table-current-column)) + (column (- (point) (point-at-bol))) (field (org-table-get-field)) (non-empty (string-match "[^ \t]" field)) @@ -6526,5 +6530,8 @@ (insert txt) (org-table-maybe-recalculate-line) - (org-table-align)) + (org-table-align) + (when (and org-table-copy-increment (org-at-timestamp-p t)) + (goto-char (+ (point-at-bol) column)) + (org-timestamp-up 1))) (error "No non-empty field found")))) Table alignment does not seem to pose any problems, but this is one thing that might require some critical looking into. Regards, Niels Giesen PS: its use? Making expenses claims for train tickets without having to fire up OOo. -- It's always darkest just before the lights go out. -- Alex Clark