2

Suppose I have an org-table like this:

| 2018-09-09 |        |        |        |        |         
| 2018-09-10 |        |        |        |        |  
| 2018-09-11 |        |        |        |        |   
|          X |        |        |        |        |

X marks the location of the caret. If I invoke org-table-copy-down (shift+enter) 1998 will be inserted in the current cell. I suppose because 1998 = 2018-9-11. How can I get it to insert 2018-09-12 instead? I'm hoping that org-mode can be smart enough to understand that the column is about dates.

3

You have to mark them as dates: <2018-09-11>. See Dates and times. You can change the increment in the usual way, by customizing org-table-copy-increment which in the case of dates is in units of days.

EDIT: Here's an example as requested:

| Date             | what |
|------------------+------|
| <2018-10-01>     | foo  |
| X                | bar  |

With the cursor at X, pressing S-RET fills in the next day:

| Date             | what |
|------------------+------|
| <2018-10-01>     | foo  |
| <2018-10-02 Tue> | bar  |

More S-RET keep filling in more dates.

This assumes that org-table-copy-increment has the default value of t. If it is set to nil:

 #+begin_src emacs-lisp
 (setq org-table-copy-increment nil)
 #+begin_src emacs-lisp

then no increment is applied when you press S-RET and you get the same date that you started with.

If you set it to a number (e.g 2):

#+begin_src emacs-lisp
(setq org-table-copy-increment 2)
#+end_src

then S-RET incements by two days every time.

UPDATE: you can also use "inactive" dates like this [2018-10-01] with square brackets instead of angle brackets, but org mode needs some markup to recognize dates.

  • Can you show me an example? – Björn Lindqvist Oct 1 '18 at 23:26
  • Does the edit help? – NickD Oct 2 '18 at 4:11
  • Thank you, but why do I have to use angle brackets around the dates? – Björn Lindqvist Oct 2 '18 at 9:41
  • That's how org-mode recognizes dates. Read the "Dates and times" link that I included in my answer. – NickD Oct 2 '18 at 12:13
  • BTW, if you insert a date with e.g. C-c . you will get <2018-10-02 Tue> - the angle brackets are part of the date spec. – NickD Oct 2 '18 at 12:22

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.