Fork me on GitHub
#emacs
<
2022-04-07
>
paulspencerwilliams13:04:04

How can I disable all auto indenting within Org mode? I’ve tried disabling org-indent-mode and electric-indent-mode amongst other experiments but Emacs continues to attempt (and screw up) indenting in Org mode. For example, at lunch today, I created a yasnippet to allow me create a nicely formatted begin_src block, but Emacs has decided. that I want Indentation setup for shell type zsh. Nope, I just want the snipped, all snippets and all future text entry in org to be manually indented.

paulspencerwilliams13:04:00

Note, its out of the box attempts and indenting json within that source block is hilarious.,

w08r07:04:44

Worth having the gql as a separate source block? Then maybe bring it into the shell block as a variable? I did raise this a while back and keep meaning to have a stab one day: https://github.com/davazp/graphql-mode/issues/39

paulspencerwilliams14:04:42

Cheers, so the idea would be to reference an external source file, so indentation would occur there? That might work in some cases, but in my specific use case of learning elastic search in depth, inlining this stuff is actually more important than making it executable.

hkjels12:04:43

(setq org-adapt-indentation nil)          ;; Disable indentation of content below headlines
  (setq org-edit-src-content-indentation 0) ;; Disable indentation of source blocks
  (setq org-src-preserve-indentation nil)   ;; Disable indentation for exported source blocks
  (setq org-indent-indentation-per-level 0) ;; Keep everything flush-left

hkjels12:04:19

I’ve disabled all indentation as well, as it doesn’t behave as expected at all times

👍 1
paulspencerwilliams17:04:32

Perfect @U0B1SDL67, that works a treat. Thank you.

dpsutton13:04:56

i’ve found that when editing the source blocks in org to use C-c ' which is org-edit-special and it’ll open a buffer just for the source in the correct mode

paulspencerwilliams14:04:20

Cheers, so that might help within the source block, but doesn’t help the end_src being indented about 8 characters?

paulspencerwilliams14:04:32

In fact, I need any auto indenting to be done after application of the snippet. It does seem the special window works better when the code’s already sensibly edited than in the main org buffer, but it’s messed up before that point.