* Timestamp increment inside tables
[not found] <463a0628.02bdbc61.2bbf.2dafSMTPIN_ADDED@mx.google.com>
@ 2007-05-03 17:33 ` Niels Giesen
2007-05-08 6:40 ` Carsten Dominik
0 siblings, 1 reply; 2+ messages in thread
From: Niels Giesen @ 2007-05-03 17:33 UTC (permalink / raw)
To: emacs-orgmode
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
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: Timestamp increment inside tables
2007-05-03 17:33 ` Timestamp increment inside tables Niels Giesen
@ 2007-05-08 6:40 ` Carsten Dominik
0 siblings, 0 replies; 2+ messages in thread
From: Carsten Dominik @ 2007-05-08 6:40 UTC (permalink / raw)
To: Niels Giesen; +Cc: emacs-orgmode
Hi Niels,
nice idea, I am taking the patch. There *could* be a problem if you
start this command in a table that is not correctly aligned, but I
don't think it is worth catering for this special case.
Thanks.
- Carsten
On May 3, 2007, at 19:33, Niels Giesen wrote:
> 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
>
>
> _______________________________________________
> Emacs-orgmode mailing list
> Emacs-orgmode@gnu.org
> http://lists.gnu.org/mailman/listinfo/emacs-orgmode
>
>
--
Carsten Dominik
Sterrenkundig Instituut "Anton Pannekoek"
Universiteit van Amsterdam
Kruislaan 403
NL-1098SJ Amsterdam
phone: +31 20 525 7477
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2007-05-08 7:54 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
[not found] <463a0628.02bdbc61.2bbf.2dafSMTPIN_ADDED@mx.google.com>
2007-05-03 17:33 ` Timestamp increment inside tables Niels Giesen
2007-05-08 6:40 ` Carsten Dominik
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).