Org writer: always indent src blocks content by 2 spaces

Emacs always uses two spaces when indenting the content of src blocks,
e.g., when exiting a `C-c '` edit-buffer. Pandoc used to indent contents
by the space-equivalent of one tab, but now always uses two spaces, too.

Closes: #5440
This commit is contained in:
Albert Krewinkel 2019-05-12 14:19:01 +02:00
parent 5c7ad59ffe
commit da9638e6a3
No known key found for this signature in database
GPG key ID: 388DC0B21F631124
3 changed files with 27 additions and 29 deletions

View file

@ -169,8 +169,6 @@ blockToOrg (Header level attr inlines) = do
else cr <> nest (level + 1) (propertiesDrawer attr)
return $ headerStr <> " " <> contents <> drawerStr <> blankline
blockToOrg (CodeBlock (_,classes,kvs) str) = do
opts <- gets stOptions
let tabstop = writerTabStop opts
let startnum = maybe "" (\x -> ' ' : trimr x) $ lookup "startFrom" kvs
let numberlines = if "numberLines" `elem` classes
then if "continuedSourceBlock" `elem` classes
@ -181,7 +179,7 @@ blockToOrg (CodeBlock (_,classes,kvs) str) = do
let (beg, end) = case at of
[] -> ("#+BEGIN_EXAMPLE" ++ numberlines, "#+END_EXAMPLE")
(x:_) -> ("#+BEGIN_SRC " ++ x ++ numberlines, "#+END_SRC")
return $ text beg $$ nest tabstop (text str) $$ text end $$ blankline
return $ text beg $$ nest 2 (text str) $$ text end $$ blankline
blockToOrg (BlockQuote blocks) = do
contents <- blockListToOrg blocks
return $ blankline $$ "#+BEGIN_QUOTE" $$