From: Stacey Marshall <stacey.marshall@oracle.com>
To: emacs-orgmode@gnu.org
Subject: org-table-copy-down incrementor
Date: Sat, 12 Apr 2014 12:56:50 +0100 [thread overview]
Message-ID: <26CB62FB-01B3-49F6-A3E2-61FC25825493@oracle.com> (raw)
Hi,
I've been using org-mode for a little over a year, wish I had been using it for far longer.
I am not a member of this list... I discovered it via <http://orgmode.org/org.html#Feedback>, a link to the list there would be helpful.
I discovered org-table-copy-down and its ability to increment dates. I would like to be able to specify the number to increment, and then ideally increment by that number again. For example lets say I want to create a table of Mondays....
| [2014-05-19 Mon] | | | | | | | |
| [2014-05-26 Mon] | | | | | | | |
| [2014-06-02 Mon] | | | | | | | |
| [2014-06-09 Mon] | | | | | | | |
Firstly, should I be using #+TBLFM: to fill in the table above... I think that would only work if I was writing across columns, and would require a calculation for each field... is that right? Hmm, is their a repeat keyword.....
I wonder if a simple solution might be to add a couple of custom variables, say
org-table-copy-inc-count to hold the count, and for the time specific
org-table-copy-inc-by to specify what is being incremented, i.e. days, hours, mins.
For my use a simple integer would have sufficed, but a time element would be more suitable for others uses.
*** /opt/local/share/emacs/site-lisp/org/org-table.el Tue May 14 15:13:53 2013
--- /var/folders/6f/qt_5cdl91051fz5tbwrf8yy00000gn/T/ediff275HnR Sat Apr 12 12:52:12 2014
***************
*** 224,229 ****
--- 224,250 ----
:group 'org-table-calculation
:type 'boolean)
+ (defcustom org-table-copy-inc-count 1
+ "Increment value used to increment field following copy by \\[org-table-copy-down]."
+ :group 'org-table-calculation
+ :type 'integer)
+
+ (defcustom org-table-copy-inc-by 'day
+ "Measure in which to increment org-table-copy-inc-count value by \\[org-table-copy-down].
+ Possible values are:
+ day
+ month
+ year
+ minute
+ second"
+ :group 'org-table-calculation
+ :type '(choice
+ (const :tag "day" day)
+ (const :tag "month" month)
+ (const :tag "year" year)
+ (const :tag "minute" minute)
+ (const :tag "second" second)))
+
(defcustom org-calc-default-modes
'(calc-internal-prec 12
calc-float-format (float 8)
***************
*** 1150,1156 ****
(insert txt)
(org-move-to-column col)
(if (and org-table-copy-increment (org-at-timestamp-p t))
! (org-timestamp-up-day)
(org-table-maybe-recalculate-line))
(org-table-align)
(org-move-to-column col))
--- 1171,1178 ----
(insert txt)
(org-move-to-column col)
(if (and org-table-copy-increment (org-at-timestamp-p t))
! (org-timestamp-change org-table-copy-inc-count org-table-copy-inc-by)
! ; (org-timestamp-up-day)
(org-table-maybe-recalculate-line))
(org-table-align)
(org-move-to-column col))
The above works for my needs, but perhaps someone has a more elegant solution...
Yours sincerely,
Stacey
next reply other threads:[~2014-04-12 11:57 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-04-12 11:56 Stacey Marshall [this message]
2014-04-17 16:06 ` org-table-copy-down incrementor Bastien
2014-04-30 16:25 ` Michael Brand
2014-05-20 14:11 ` Bastien
2014-05-20 16:26 ` Michael Brand
2014-05-20 19:45 ` Bastien
2014-05-21 15:32 ` Michael Brand
2014-05-21 15:49 ` Bastien
2014-05-21 16:22 ` Michael Brand
2014-05-21 16:38 ` Bastien
2014-05-21 17:09 ` Michael Brand
2014-05-30 10:37 ` Stacey Marshall
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=26CB62FB-01B3-49F6-A3E2-61FC25825493@oracle.com \
--to=stacey.marshall@oracle.com \
--cc=emacs-orgmode@gnu.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.