0

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 '17 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! – Calvin Beck Nov 5 '18 at 20:54
  • Is this an answer to the question or an "I too am having this problem" comment? – Drew Nov 5 '18 at 21:58
0

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
        ))
0

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)
New contributor
SaMeji is a new contributor to this site. Take care in asking for clarification, commenting, and answering. Check out our Code of Conduct.

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.