aboutsummaryrefslogtreecommitdiffstats
path: root/lisp/textmodes
diff options
context:
space:
mode:
authorCarsten Dominik2008-03-13 08:57:53 +0000
committerCarsten Dominik2008-03-13 08:57:53 +0000
commit4b67ea89708f4cd7c3882272ed0e742f0c10582d (patch)
treec925f30b62b49c9d6daa88692e27fdb4b3f21703 /lisp/textmodes
parent2a57416ff5f4cdf77a02314eded2f38fc893c101 (diff)
downloademacs-4b67ea89708f4cd7c3882272ed0e742f0c10582d.tar.gz
emacs-4b67ea89708f4cd7c3882272ed0e742f0c10582d.zip
* org-export-latex.el (org-export-as-latex): Revert the change
that killed the LaTeX buffer.
Diffstat (limited to 'lisp/textmodes')
-rw-r--r--lisp/textmodes/org-export-latex.el21
1 files changed, 12 insertions, 9 deletions
diff --git a/lisp/textmodes/org-export-latex.el b/lisp/textmodes/org-export-latex.el
index 7624af8aa0e..d8dbeed4f76 100644
--- a/lisp/textmodes/org-export-latex.el
+++ b/lisp/textmodes/org-export-latex.el
@@ -4,7 +4,7 @@
4;; 4;;
5;; Emacs Lisp Archive Entry 5;; Emacs Lisp Archive Entry
6;; Filename: org-export-latex.el 6;; Filename: org-export-latex.el
7;; Version: 5.19 7;; Version: 5.23
8;; Author: Bastien Guerry <bzg AT altern DOT org> 8;; Author: Bastien Guerry <bzg AT altern DOT org>
9;; Maintainer: Bastien Guerry <bzg AT altern DOT org> 9;; Maintainer: Bastien Guerry <bzg AT altern DOT org>
10;; Keywords: org, wp, tex 10;; Keywords: org, wp, tex
@@ -42,7 +42,7 @@
42;; M-x `org-export-as-latex-to-buffer' 42;; M-x `org-export-as-latex-to-buffer'
43;; M-x `org-export-region-as-latex' 43;; M-x `org-export-region-as-latex'
44;; M-x `org-replace-region-by-latex' 44;; M-x `org-replace-region-by-latex'
45;; 45;;
46;;; Code: 46;;; Code:
47 47
48(eval-when-compile 48(eval-when-compile
@@ -329,7 +329,7 @@ in a window. A non-interactive call will only retunr the buffer."
329 329
330;;;###autoload 330;;;###autoload
331(defun org-export-as-latex (arg &optional hidden ext-plist 331(defun org-export-as-latex (arg &optional hidden ext-plist
332 to-buffer body-only) 332 to-buffer body-only pub-dir)
333 "Export current buffer to a LaTeX file. 333 "Export current buffer to a LaTeX file.
334If there is an active region, export only the region. The prefix 334If there is an active region, export only the region. The prefix
335ARG specifies how many levels of the outline should become 335ARG specifies how many levels of the outline should become
@@ -344,7 +344,8 @@ buffer. If TO-BUFFER is the symbol `string', don't leave any
344buffer behind but just return the resulting LaTeX as a string. 344buffer behind but just return the resulting LaTeX as a string.
345When BODY-ONLY is set, don't produce the file header and footer, 345When BODY-ONLY is set, don't produce the file header and footer,
346simply return the content of \begin{document}...\end{document}, 346simply return the content of \begin{document}...\end{document},
347without even the \begin{document} and \end{document} commands." 347without even the \begin{document} and \end{document} commands.
348when PUB-DIR is set, use this as the publishing directory."
348 (interactive "P") 349 (interactive "P")
349 ;; Make sure we have a file name when we need it. 350 ;; Make sure we have a file name when we need it.
350 (when (and (not (or to-buffer body-only)) 351 (when (and (not (or to-buffer body-only))
@@ -375,7 +376,8 @@ without even the \begin{document} and \end{document} commands."
375 (file-name-sans-extension 376 (file-name-sans-extension
376 (file-name-nondirectory buffer-file-name)))) 377 (file-name-nondirectory buffer-file-name))))
377 (filename (concat (file-name-as-directory 378 (filename (concat (file-name-as-directory
378 (org-export-directory :LaTeX ext-plist)) 379 (or pub-dir
380 (org-export-directory :LaTeX ext-plist)))
379 (file-name-sans-extension 381 (file-name-sans-extension
380 (file-name-nondirectory ;sans-extension 382 (file-name-nondirectory ;sans-extension
381 buffer-file-name)) ".tex")) 383 buffer-file-name)) ".tex"))
@@ -391,9 +393,10 @@ without even the \begin{document} and \end{document} commands."
391 (find-file-noselect filename))) 393 (find-file-noselect filename)))
392 (odd org-odd-levels-only) 394 (odd org-odd-levels-only)
393 (header (org-export-latex-make-header title opt-plist)) 395 (header (org-export-latex-make-header title opt-plist))
394 (skip (if subtree-p nil 396 (skip (cond (subtree-p nil)
397 (region-p t)
395 ;; never skip first lines when exporting a subtree 398 ;; never skip first lines when exporting a subtree
396 (plist-get opt-plist :skip-before-1st-heading))) 399 (t (plist-get opt-plist :skip-before-1st-heading))))
397 (text (plist-get opt-plist :text)) 400 (text (plist-get opt-plist :text))
398 (first-lines (if skip "" (org-export-latex-first-lines))) 401 (first-lines (if skip "" (org-export-latex-first-lines)))
399 (coding-system (and (boundp 'buffer-file-coding-system) 402 (coding-system (and (boundp 'buffer-file-coding-system)
@@ -1117,8 +1120,8 @@ Regexps are those from `org-export-latex-special-string-regexps'."
1117 (if (match-string 2) "" (match-string 1)))) t t)) 1120 (if (match-string 2) "" (match-string 1)))) t t))
1118 1121
1119 ;; Delete @<...> constructs 1122 ;; Delete @<...> constructs
1120 (goto-char (point-min))
1121 ;; Thanks to Daniel Clemente for this regexp 1123 ;; Thanks to Daniel Clemente for this regexp
1124 (goto-char (point-min))
1122 (while (re-search-forward "@<\\(?:[^\"\n]\\|\".*\"\\)*?>" nil t) 1125 (while (re-search-forward "@<\\(?:[^\"\n]\\|\".*\"\\)*?>" nil t)
1123 (replace-match "")) 1126 (replace-match ""))
1124 1127
@@ -1140,7 +1143,7 @@ Regexps are those from `org-export-latex-special-string-regexps'."
1140 (let ((end (save-excursion 1143 (let ((end (save-excursion
1141 (if (re-search-forward "^$\\|^#.*$\\|\\[[0-9]+\\]" nil t) 1144 (if (re-search-forward "^$\\|^#.*$\\|\\[[0-9]+\\]" nil t)
1142 (match-beginning 0) (point-max))))) 1145 (match-beginning 0) (point-max)))))
1143 (setq footnote (concat (org-trim (buffer-substring (point) end)) 1146 (setq footnote (concat (org-trim (buffer-substring (point) end))
1144 " ")) ; prevent last } being part of a link 1147 " ")) ; prevent last } being part of a link
1145 (delete-region (point) end)) 1148 (delete-region (point) end))
1146 (goto-char foot-beg) 1149 (goto-char foot-beg)