emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* org-table-copy-down incrementor
@ 2014-04-12 11:56 Stacey Marshall
  2014-04-17 16:06 ` Bastien
  0 siblings, 1 reply; 12+ messages in thread
From: Stacey Marshall @ 2014-04-12 11:56 UTC (permalink / raw)
  To: emacs-orgmode

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

^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2014-05-30 10:37 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-04-12 11:56 org-table-copy-down incrementor Stacey Marshall
2014-04-17 16:06 ` 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

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).