emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[O] org-table-copy-down incrementor


From: Stacey Marshall
Subject: [O] org-table-copy-down incrementor
Date: Sat, 12 Apr 2014 12:56:50 +0100

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






reply via email to

[Prev in Thread] Current Thread [Next in Thread]