Merge branch 'master' of git+ssh://repo.or.cz/srv/git/org-mode

This commit is contained in:
Carsten Dominik 2009-10-10 16:54:27 +02:00
commit 545d59d0b9

View file

@ -132,16 +132,16 @@ Emacs-lisp table, otherwise return the results as a string."
"'" "\"" results))))) "'" "\"" results)))))
results))) results)))
(defun org-babel-haskell-export-to-lhs () (defun org-babel-haskell-export-to-lhs (&optional arg)
"Export to a .lhs with all haskell code blocks escaped "Export to a .lhs with all haskell code blocks escaped
appropriately, then process the resulting .lhs file using appropriately. When called with a prefix argument the resulting
lhs2tex. This function will create two new files, base-name.lhs .lhs file will be exported to a .tex file. This function will
and base-name.tex where base-name is the name of the current create two new files, base-name.lhs and base-name.tex where
org-mode file. base-name is the name of the current org-mode file.
Note that all standard org-babel literate programming Note that all standard org-babel literate programming
constructs (header arguments, no-web syntax etc...) are ignored." constructs (header arguments, no-web syntax etc...) are ignored."
(interactive) (interactive "P")
(let* ((contents (buffer-string)) (let* ((contents (buffer-string))
(haskell-regexp (haskell-regexp
(concat "^\\([ \t]*\\)#\\+begin_src[ \t]haskell*\\(.*\\)?[\r\n]" (concat "^\\([ \t]*\\)#\\+begin_src[ \t]haskell*\\(.*\\)?[\r\n]"
@ -168,7 +168,7 @@ constructs (header arguments, no-web syntax etc...) are ignored."
(indent-code-rigidly (match-beginning 0) (match-end 0) indentation))) (indent-code-rigidly (match-beginning 0) (match-end 0) indentation)))
(save-excursion (save-excursion
;; export to latex w/org and save as .lhs ;; export to latex w/org and save as .lhs
(find-file tmp-org-file) (call-interactively 'org-export-as-latex) (find-file tmp-org-file) (funcall 'org-export-as-latex nil)
(kill-buffer) (kill-buffer)
(delete-file tmp-org-file) (delete-file tmp-org-file)
(find-file tmp-tex-file) (find-file tmp-tex-file)
@ -183,8 +183,10 @@ constructs (header arguments, no-web syntax etc...) are ignored."
(delete-file tmp-tex-file) (delete-file tmp-tex-file)
;; save org exported latex to a .lhs file ;; save org exported latex to a .lhs file
(with-temp-file lhs-file (insert contents)) (with-temp-file lhs-file (insert contents))
;; process .lhs file with lhs2tex (if (not arg)
(message "running %s" command) (shell-command command))) (find-file lhs-file)
;; process .lhs file with lhs2tex
(message "running %s" command) (shell-command command) (find-file tex-file))))
(provide 'org-babel-haskell) (provide 'org-babel-haskell)
;;; org-babel-haskell.el ends here ;;; org-babel-haskell.el ends here