mirror of
https://git.savannah.gnu.org/git/emacs/org-mode.git
synced 2024-09-30 03:27:54 +00:00
org-babel: haskell lhs2tex export now responds to prefix argument
This commit is contained in:
parent
e079584e56
commit
0444ca8661
|
@ -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))
|
||||||
|
(if (not arg)
|
||||||
|
(find-file lhs-file)
|
||||||
;; process .lhs file with lhs2tex
|
;; process .lhs file with lhs2tex
|
||||||
(message "running %s" command) (shell-command command)))
|
(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
|
||||||
|
|
Loading…
Reference in a new issue