Emacs 26.1 org-mode: 9.1.9

I have an issue with the way org-capture expands a template when it comes to line beginnings:

This template

(setq org-capture-templates
 '(("o" "Todo" entry (file+headline "~/org/experimental.org" "Tasks")
        "* TODO %^{One}\nBeginning-of-line-Text\n<-- There should be no whitespace -->%^{Two}\n** %^{Three}\n- %^{Four}")))

Expands to this:

* Tasks
** TODO One
 Beginning-of-line-Text
 <-- There should be no whitespace -->Two
*** Three
 - Four

The crucial issue are the lines that start with a space / whitespace / indentation (the lines 3, 4 and 6). It seems that C-c C-c inserts only at the beginning of lines a space as it does not add a space before "-->Two". Furthermore \n** Three was expanded as expected (see line 5: *** Three) I think this is not a bug but for some reason the intended behaviour . Yet I would like the template to expand more "literally", meaning the expression following directly after \n should always start at the beginning of the next line. Any help is highly appreciated.

I found the solution although I must admit, I still don’t see, why this problem never occured in Org outlines I typed in directly:

The custom-set-variable is called org-adapt-indentation and it has to be set to nil. In other words, after I added:

'(org-adapt-indentation nil)

to my .emacs file I finally got rid of the white space (actually the indentation) in the target file.

Your Answer

 
discard

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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