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.

1 Answer 1

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.

6
  • Can you show me an example? Oct 1, 2018 at 23:26
  • Does the edit help?
    – NickD
    Oct 2, 2018 at 4:11
  • Thank you, but why do I have to use angle brackets around the dates? Oct 2, 2018 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, 2018 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, 2018 at 12:22

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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