mirror of
https://git.savannah.gnu.org/git/emacs/org-mode.git
synced 2024-09-30 01:27:53 +00:00
org-babel-haskell: org-babel-haskell-export-to-lhs now optionally preserves indentation
based either on the value of org-src-preserve-indentation or the presence of the -i switch
This commit is contained in:
parent
260007e61f
commit
e3bf0b4a81
|
@ -153,6 +153,7 @@ constructs (header arguments, no-web syntax etc...) are ignored."
|
||||||
(lhs-file (concat base-name ".lhs"))
|
(lhs-file (concat base-name ".lhs"))
|
||||||
(tex-file (concat base-name ".tex"))
|
(tex-file (concat base-name ".tex"))
|
||||||
(command (concat org-babel-haskell-lhs2tex-command " " lhs-file " > " tex-file))
|
(command (concat org-babel-haskell-lhs2tex-command " " lhs-file " > " tex-file))
|
||||||
|
(preserve-indentp org-src-preserve-indentation)
|
||||||
indentation)
|
indentation)
|
||||||
;; escape haskell source-code blocks
|
;; escape haskell source-code blocks
|
||||||
(with-temp-file tmp-org-file
|
(with-temp-file tmp-org-file
|
||||||
|
@ -160,10 +161,14 @@ constructs (header arguments, no-web syntax etc...) are ignored."
|
||||||
(goto-char (point-min))
|
(goto-char (point-min))
|
||||||
(while (re-search-forward haskell-regexp nil t)
|
(while (re-search-forward haskell-regexp nil t)
|
||||||
(save-match-data (setq indentation (length (match-string 1))))
|
(save-match-data (setq indentation (length (match-string 1))))
|
||||||
(replace-match (save-match-data (concat
|
(replace-match (save-match-data
|
||||||
"#+begin_latex\n\\begin{code}\n"
|
(concat
|
||||||
(org-remove-indentation (match-string 3))
|
"#+begin_latex\n\\begin{code}\n"
|
||||||
"\n\\end{code}\n#+end_latex\n"))
|
(if (or preserve-indentp
|
||||||
|
(string-match "-i" (match-string 2)))
|
||||||
|
(match-string 3)
|
||||||
|
(org-remove-indentation (match-string 3)))
|
||||||
|
"\n\\end{code}\n#+end_latex\n"))
|
||||||
t t)
|
t t)
|
||||||
(indent-code-rigidly (match-beginning 0) (match-end 0) indentation)))
|
(indent-code-rigidly (match-beginning 0) (match-end 0) indentation)))
|
||||||
(save-excursion
|
(save-excursion
|
||||||
|
|
Loading…
Reference in a new issue