I would like to manually create a orgmode file with date entries. Is it possible to do it without the org-capture template? Just at point?


  • 1
    Datetrees have ordering requirements, so the facilities that Org mode provides are all of the org-find-create variety: they find the proper place and then they create the entry at that place. There is no "automatic" facility to enter an arbitrary date tree entry at point. But you can of course just type it in. However, if you don't follow the ordering constraints, then adding more entries through the Org mode facilities might be problematic.
    – NickD
    Apr 27 '21 at 13:23
  • Thanks, I just wanted to be able to insert any day with day of week beside it as a heading automatically. Apr 27 '21 at 18:21
  • So is the problem then that you want to specify an arbitrary date and you want the day of the week to be calculated automatically? It would help if you gave an example: what input do you want to provide and what output do you expect?
    – NickD
    Apr 27 '21 at 20:32
  • I better explain myself :) I just want to create a heading in the form * 2021-04-28 Wed. Just that. Instead of having to do it by hand plus figuring out which day of the week it was, etc. Apr 28 '21 at 7:35
  • Just for today's date? Or do you want to be able to enter arbitrary dates? And if arbitrary dates, how do you want to specify the date? Finally, you should add all that information to your question. The objective is to have a well-defined question that does not depend on comments to make it well-defined.
    – NickD
    Apr 28 '21 at 7:57

If you don't mind what Org mode defines as inactive time stamps of the form [2021-04-28 Wed] (do C-h i g (org)Timestamps for more info), then Org mode has all the facilities you need:

(defun ndk/org-insert-heading-and-inactive-time-stamp ()
   (insert "\n"))

(define-key org-mode-map (kbd "C-c H") #'ndk/org-insert-heading-and-inactive-time-stamp)

If you want activetime stamps (of the form <2021-04-28 Wed> - see the same section above for info), just replace the call to org-time-stamp-inactive with org-time-stamp.

Both of these use the standard Org mode mechanism of popping up a calendar and letting you select a date by typing it in, or clicking on the calendar, or specifying the date using all sorts of shortcuts (e.g. +7 or +1w for the date one week ahead - the docs contain much more info).

OTOH, if you want a bare date as you indicated above, you'll have to use lower-level functions to produce the output you want.

I recommend you go either with inactive or active dates and forego bare dates.

  • Thanks, I don't program, so I wouldn't know how to turn that output into a heading (* yyyy-mm-dd DAYOFWEEK). :( Could you help me? Apr 28 '21 at 12:33
  • 1
    Why can't you use it as-is? It is a heading: (org-insert-heading) does that. Remember: there is nothing special in an Org mode file - it is just text. The magic is all the functions that Org mode uses to interpret that text (as headings, lists, links, tables etc). Just put the above code in your init file, restart emacs, open an Org mode file, put your cursor where you want to create the new heading and say C-C H.
    – NickD
    Apr 28 '21 at 13:20
  • Yes, you are right. Thanks! Apr 29 '21 at 6:52

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.