I irregularly see that org-capture has led to the disappearance of a newline, leaving me with lines like these

* meeting w/ ch.
<2017-12-01 Fri 11:00>* reading group
<2017-10-09 Mon 16:15 +2w>

Which could make me forget all about that reading group. Is this a bug or am I doing something wrong?

(There is not so much information here, but I'm hoping someone will have had the same problem.)

  • I've had the same problem.. and finally the only solution has been insert a new line at the end of the template: '(("a" "Axenda" entry (file+headline "~/axenda.org" "daily") "* %?\n")) <.. '\n'
    – Pedro
    Nov 26, 2017 at 21:39
  • I have had this exact same problem as well. This happens when you capture anything. For instance I have this template: ("t" "Todo" entry (file+headline "~/org/todo.org" "Tasks") "* TODO %?\n SCHEDULED: %t\n %a\n") But if you delete the newline while capturing a Todo entry, or write anything on the last line in the template you will actually remove the newline separating the heading you're entering from the next one, or you'll put some text on the line before the heading. This is really frustrating, and I'm surprised more people don't run into this problem! Nov 5, 2018 at 20:54
  • Is this an answer to the question or an "I too am having this problem" comment?
    – Drew
    Nov 5, 2018 at 21:58

5 Answers 5


org-capture-templates provides the options :empty-lines, :empty-lines-before, :empty-lines-after etc., maybe this is helpful to others.


This is not really a solution, nor very elegant, but it ensures that you stop writing on the last line and, thereby, swallowing your next TODO: Add at the end of each capture a comment:# end of capture

For instance:

("t" "Todo" entry (file+headline "~/org/gtd.org" "Tasks") "* TODO %?\n\n# end of capture)

I had similar issue. I managed to solve it with help of @parsnip from #emacs channel on freenode IRC.

It's all because of of org-mode-hook with (org-next-visible-heading 1)

(defun setup-org-log-buffer () (org-next-visible-heading 1))
(add-hook 'org-mode-hook 'setup-org-buffer)

After removing it everything works as expected. Maybe in your case it's something different. Just try to remove all your custom hooks.

I figured this out by running fresh Emacs without config (emacs -q). Then you can enable capture templates with new line characters. Try it and if it's ok then you probably have something nasty in config. Try to evaluate config piece by piece until capture template will be broken.

This was my test setup:

(global-set-key (kbd "C-c k") 'org-capture)
(setq org-capture-templates
      '(("n" "new-line-test")
        ("n1" "without new line" plain (file "~/new-line-test.org")
         "test %T %?") ; without new line
        ("n2" "with new line after 'test'" plain (file "~/new-line-test.org")
         "test\n %T %?") ; with new line
        ("n3" "with new line after timestamp" plain (file "~/new-line-test.org")
         "test %T\n %?") ; with new line

This should work:

I added my function to org-capture-prepare-finalize-hook and not org-capture-before-finalize

The function I added to the hook:

(defun my-org-capture-newlines-at-end ()
  (goto-char (point-max))
  (insert "\n\n"))

For example, if you're using use-package, it would look like:

(org-capture-prepare-finalize . my-org-capture-newlines-at-end)

This works for me with :prepend t :empty-lines 1

Note: this is the same answer I provided here. It seems that the issue also occurs during refiling.


Maybe this helps identify the problem: in my case it is the "aborting" of the process of adding a task through org-capture in the capture buffer (C-c C-k in Spacemacs) that deletes a new line in the todo.org.

I have two sections in my todo.org, but I often find the second one "glued to" the first one because of this.

One solution seems to be to give the sections (in the todo.org) a property, e.g.

* Misc
** TODO bla
** TODO bla2

* Misc2
  :CATEGORY: Misc2
** TODO bla
** TODO bla2

That appears to preserve the sections.

Your Answer

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

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