summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric Schulte <schulte.eric@gmail.com>2009-11-04 17:46:55 -0700
committerEric Schulte <schulte.eric@gmail.com>2009-11-04 17:46:55 -0700
commite3bf0b4a8107b6bec1b3e25edfa3fa577e7349b3 (patch)
treea141ef472cca3952f63ee392914a8a3756fb7f59
parent260007e61f5023ff886d5de26c4c3ccb9ee97a97 (diff)
downloadorg-mode-e3bf0b4a8107b6bec1b3e25edfa3fa577e7349b3.tar.gz
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
-rw-r--r--contrib/babel/lisp/langs/org-babel-haskell.el13
1 files changed, 9 insertions, 4 deletions
diff --git a/contrib/babel/lisp/langs/org-babel-haskell.el b/contrib/babel/lisp/langs/org-babel-haskell.el
index 4118074..d8b56e7 100644
--- a/contrib/babel/lisp/langs/org-babel-haskell.el
+++ b/contrib/babel/lisp/langs/org-babel-haskell.el
@@ -153,6 +153,7 @@ constructs (header arguments, no-web syntax etc...) are ignored."
(lhs-file (concat base-name ".lhs"))
(tex-file (concat base-name ".tex"))
(command (concat org-babel-haskell-lhs2tex-command " " lhs-file " > " tex-file))
+ (preserve-indentp org-src-preserve-indentation)
indentation)
;; escape haskell source-code blocks
(with-temp-file tmp-org-file
@@ -160,10 +161,14 @@ constructs (header arguments, no-web syntax etc...) are ignored."
(goto-char (point-min))
(while (re-search-forward haskell-regexp nil t)
(save-match-data (setq indentation (length (match-string 1))))
- (replace-match (save-match-data (concat
- "#+begin_latex\n\\begin{code}\n"
- (org-remove-indentation (match-string 3))
- "\n\\end{code}\n#+end_latex\n"))
+ (replace-match (save-match-data
+ (concat
+ "#+begin_latex\n\\begin{code}\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)
(indent-code-rigidly (match-beginning 0) (match-end 0) indentation)))
(save-excursion