mirror of
https://git.savannah.gnu.org/git/emacs/org-mode.git
synced 2024-11-23 07:18:53 +00:00
org-babel: make tangling honour org-src-preserve-indentation
This allows python code to be tangled (i.e. extracted) correctly by org-babel-tangle. Previously, if e.g. methods of a class were in separate blocks, then they would be incorrectly indented as top-level functions in the tangled output.
This commit is contained in:
parent
8dff317e33
commit
e079584e56
@ -366,13 +366,14 @@ may be specified in the properties of the current outline entry."
|
||||
(defun org-babel-parse-src-block-match ()
|
||||
(let* ((lang (org-babel-clean-text-properties (match-string 1)))
|
||||
(lang-headers (intern (concat "org-babel-default-header-args:" lang)))
|
||||
(body (org-babel-clean-text-properties (match-string 4))))
|
||||
(body (org-babel-clean-text-properties (match-string 4)))
|
||||
(preserve-indentation org-src-preserve-indentation))
|
||||
(list lang
|
||||
;; get src block body removing properties, protective commas, and indentation
|
||||
(with-temp-buffer
|
||||
(save-match-data
|
||||
(insert (org-babel-strip-protective-commas body))
|
||||
(org-do-remove-indentation)
|
||||
(unless preserve-indentation (org-do-remove-indentation))
|
||||
(buffer-string)))
|
||||
(org-babel-merge-params
|
||||
org-babel-default-header-args
|
||||
|
Loading…
Reference in New Issue
Block a user