I'm using org to store a list of links, I capture the links with org-capture and a custom template, but I want to write the new entries at top of the file. how I can do this?

  • 1
    See org-reverse-note-order. – glucas Jan 24 '17 at 1:24
  • 1
    Just a note that although the answer recommending :prepend t is correct that it ensures new entries are added above older ones, that applies only within a date header. The date headers themselves are still added latest after previous. And org-reverse-note-order doesn't change that either. Because the :prepend t answer has been marked as accepted, I've asked a similar question to this but specifying more completely what is required. It's here. – tkp Feb 10 '17 at 1:53

From the Org-Mode Manual, you can add the following template element to your custom captures:

:prepend t

Normally new captured information will be appended at the target location (last child, last table line, last list item...). Setting this property will change that.

See the related post Using properties in org-mode capture templates, where for example you can achieve the desired effect by using:

("w" "Default template" entry (file+headline (concat (file-name-as-directory org-directory) "journal.org") "Notes")
 "* TODO [#C] %^{Title} %?" :prepend t)
  • by the way, t is missing from the manual AFAICT, otherwise :prepend alone won't work. This gave me headache couple of days ago. – doctorate Apr 26 '19 at 11:01
  • @doctorate, I know it is old, but I have just stumbled across this wondering the same thing. All I can guess is that t is the value of a Unit type. in a functional language, all functions have to have an argument. If your function doesn't need an argument you just define it to receive a Unit. I could be wrong, but that is what it seems to me. – JonathanPeel Aug 12 '20 at 7:34

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.