From d2f219fd41de1a29c3cacae3a4b6eea117e409f8 Mon Sep 17 00:00:00 2001 From: Carsten Dominik Date: Fri, 12 Feb 2010 08:34:00 +0100 Subject: [PATCH] LaTeX export: When exporting to a buffer only, do not require a file name --- lisp/ChangeLog | 7 +++++++ lisp/org-latex.el | 41 +++++++++++++++++++++++++---------------- 2 files changed, 32 insertions(+), 16 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 61e5a4ec0..988497b3b 100755 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,10 @@ +2010-02-12 Carsten Dominik + + * org-latex.el (org-export-as-latex): Do nit require the buffer to + be visiting a file when only exporting to a buffer or string. + (org-export-latex-fix-inputenc): Only save the buffer is there is + a file name attached to it. + 2010-02-09 Dan Davison * org-src.el (org-edit-src-exit): Widen before exiting edit buffers diff --git a/lisp/org-latex.el b/lisp/org-latex.el index ecf9b67b8..2d4ced2d3 100644 --- a/lisp/org-latex.el +++ b/lisp/org-latex.el @@ -637,21 +637,29 @@ when PUB-DIR is set, use this as the publishing directory." (and (not (plist-get opt-plist :skip-before-1st-heading)) (org-export-grab-title-from-buffer)) - (file-name-sans-extension - (file-name-nondirectory buffer-file-name)))) - (filename (concat (file-name-as-directory - (or pub-dir - (org-export-directory :LaTeX ext-plist))) - (file-name-sans-extension - (or (and subtree-p - (org-entry-get rbeg "EXPORT_FILE_NAME" t)) - (file-name-nondirectory ;sans-extension - buffer-file-name))) - ".tex")) - (filename (if (equal (file-truename filename) - (file-truename buffer-file-name)) - (concat filename ".tex") - filename)) + (and buffer-file-name + (file-name-sans-extension + (file-name-nondirectory buffer-file-name))) + "No Title")) + (filename + (and (not to-buffer) + (concat + (file-name-as-directory + (or pub-dir + (org-export-directory :LaTeX ext-plist))) + (file-name-sans-extension + (or (and subtree-p + (org-entry-get rbeg "EXPORT_FILE_NAME" t)) + (file-name-nondirectory ;sans-extension + (or buffer-file-name + (error "Don't know which export file to use."))))) + ".tex"))) + (filename + (and filename + (if (equal (file-truename filename) + (file-truename (or buffer-file-name "dummy.org"))) + (concat filename ".tex") + filename))) (buffer (if to-buffer (cond ((eq to-buffer 'string) (get-buffer-create @@ -2056,7 +2064,8 @@ The conversion is made depending of STRING-BEFORE and STRING-AFTER." (goto-char (match-beginning 1)) (delete-region (match-beginning 1) (match-end 1)) (insert opt)) - (save-buffer)))) + (and buffer-file-name + (save-buffer))))) ;;; List handling: