From mboxrd@z Thu Jan 1 00:00:00 1970 From: Jambunathan K Subject: org-odt: Batch exports creates data loss, deletes original org file Date: Sat, 22 Dec 2012 23:27:50 +0530 Message-ID: <87obhmezq9.fsf_-_@gmail.com> References: <50D4ADAF.2050800@gmail.com> <87txredz7h.fsf@gmail.com> <50D5D942.6050700@gmail.com> Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([208.118.235.92]:32865) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TmTH7-0004f1-Gu for emacs-orgmode@gnu.org; Sat, 22 Dec 2012 12:54:19 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TmTH2-0007yC-UE for emacs-orgmode@gnu.org; Sat, 22 Dec 2012 12:54:17 -0500 In-Reply-To: <50D5D942.6050700@gmail.com> (Wiskey's message of "Sat, 22 Dec 2012 11:01:06 -0500") List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: bug-gnu-emacs@gnu.org Cc: emacs-orgmode@gnu.org, Wiskey 5 Alpha > Thank you for your reply. Below you will find a small example to > illustrate the problem. First I have a small test org-mode file in > the directory, =test.org=. It's contents is shown next. I run the > batch process, which causes an error. All files in the directory are > deleted except for the .odt file ! Data loss is very bad. I am sorry. Looks like you hope you had backups. I will forward a fix to Org/Emacs in few hours. > $ emacs --batch --load=$HOME/.emacs --visit=./test.org --funcall > org-export-as-odt-batch Meanwhile, instead of using `org-export-as-odt-batch', you can try the following which uses `org-export-as-odt'. $ emacs --batch -Q -L ~/src/org-mode/lisp --visit=./test-new.org --funcall org-export-as-odt > Thanks again. I am running emacs version 23.4.1 on Ubuntu 12.10, and > org-mode from elpa package =org-plus-contrib 20121217= > > -Tim > > > aldrichtr@liberty:/tmp/export-process > $ ls > test.org > aldrichtr@liberty:/tmp/export-process > $ cat test.org > > * This is heading one > And some text > ** heading one two > And some text > > aldrichtr@liberty:/tmp/export-process > $ emacs --batch --load=$HOME/.emacs --visit=./test.org --funcall > org-export-as-odt-batch > ... > Debug (org-odt): Searching for OpenDocument schema files... > Debug (org-odt): Trying /usr/share/emacs/etc/org/schema/... > Debug (org-odt): Trying /usr/share/emacs/etc/org/schema/... > Debug (org-odt): No OpenDocument schema files installed > Debug (org-odt): Searching for OpenDocument styles files... > Debug (org-odt): Trying /usr/share/emacs/etc/org/styles/... > Debug (org-odt): Trying /usr/share/emacs/etc/org/styles/... > Debug (org-odt): Trying /home/aldrichtr/.emacs.d/elpa/etc/styles/... > Debug (org-odt): Trying > /home/aldrichtr/.emacs.d/elpa/org-plus-contrib-20121217/etc/styles/... > Debug (org-odt): Using styles under > /home/aldrichtr/.emacs.d/elpa/org-plus-contrib-20121217/etc/styles/ > Exporting to ODT using org-lparse... > Using vacuous schema > [yas] Loading for `nxml-mode', just-in-time: (yas--load-directory-1 > /home/aldrichtr/.emacs.d/elpa/yasnippet-20121127.25/snippets/nxml-mode > (quote nxml-mode) (quote (text-mode)))! > [yas] Loading compiled snippets from > /home/aldrichtr/.emacs.d/elpa/yasnippet-20121127.25/snippets/nxml-mode > LaTeX to MathML converter not available. Using verbatim instead. > Exporting... > ODT export done, pushed to kill ring and clipboard > Wrote /tmp/export-process/meta.xml > Using vacuous schema > Saving file /tmp/export-process/styles.xml... > Wrote /tmp/export-process/styles.xml > Wrote /tmp/export-process/mimetype > Using vacuous schema > Saving file /tmp/export-process/styles.xml... > Wrote /tmp/export-process/styles.xml > (No changes need to be saved) > Saving file /tmp/export-process/META-INF/manifest.xml... > Wrote /tmp/export-process/META-INF/manifest.xml > Saving file /tmp/export-process/content.xml... > Wrote /tmp/export-process/content.xml > Using vacuous schema > (No changes need to be saved) > Creating odt file... > Running zip -mX0 test.odt mimetype > Running zip -rmTq test.odt . > Debugger entered--Lisp error: (file-already-exists "File already > exists" "/tmp/export-process/test.odt") > rename-file("test.odt" "/tmp/export-process/") > (let* ((target-name ...) (target-dir ...) (cmds ...)) (when > (file-exists-p target) (delete-file target)) (let (... exitcode > err-string) (message "Creating odt file...") (mapc ... cmds)) > (rename-file target-name target-dir)) > (let ((xml-files ...)) (when (equal org-lparse-backend ...) (push > "styles.xml" xml-files)) (mapc (lambda ... ...) xml-files) (let* > (... ... ...) (when ... ...) (let ... ... ...) (rename-file > target-name target-dir))) > org-odt-save-as-outfile("/tmp/export-process/test.odt" > (:latex-image-options nil :exclude-tags ("noexport") :select-tags > ("export") :publishing-directory nil :timestamp nil > :expand-quoted-html t :html-table-tag " cellspacing=\"0\" cellpadding=\"6\" rules=\"groups\" > frame=\"hsides\">" :xml-declaration (("html" . " encoding=\"%s\"?>") ("php" . " encoding=\\\"%s\\\" ?>\"; ?>")) :html-postamble auto :html-preamble t > :html-extension "html" :inline-images maybe :convert-org-links t > :agenda-style nil :style-extra "" :style "" :style-include-scripts t > :style-include-default t :table-auto-headline t :tables t > :time-stamp-file t :creator-info t :email-info nil :author-info t > :email "wiskey5alpha@gmail.com" ...)) > funcall(org-odt-save-as-outfile "/tmp/export-process/test.odt" > (:latex-image-options nil :exclude-tags ("noexport") :select-tags > ("export") :publishing-directory nil :timestamp nil > :expand-quoted-html t :html-table-tag "
cellspacing=\"0\" cellpadding=\"6\" rules=\"groups\" > frame=\"hsides\">" :xml-declaration (("html" . " encoding=\"%s\"?>") ("php" . " encoding=\\\"%s\\\" ?>\"; ?>")) :html-postamble auto :html-preamble t > :html-extension "html" :inline-images maybe :convert-org-links t > :agenda-style nil :style-extra "" :style "" :style-include-scripts t > :style-include-default t :table-auto-headline t :tables t > :time-stamp-file t :creator-info t :email-info nil :author-info t > :email "wiskey5alpha@gmail.com" ...)) > (and f (functionp f) (funcall f filename opt-plist)) > (or (and f (functionp f) (funcall f filename opt-plist)) (save-buffer)) > (let ((f ...)) (or (and f ... ...) (save-buffer))) > (cond ((not to-buffer) (let ... ...) (or ... ...)) ((eq to-buffer > ...) (prog1 ... ...)) (t (current-buffer))) > (let ((case-fold-search nil) (org-odd-levels-only odd)) (mapc > (lambda ... ...) org-export-plist-vars) (setq umax (if arg > ... org-export-headline-levels)) (setq umax-toc (if ... ... umax)) > (setq org-lparse-opt-plist (plist-put org-lparse-opt-plist > :headline-levels umax)) (when (and org-export-with-toc ...) (setq > lines ...)) (unless body-only (org-lparse-begin ... opt-plist) > (org-lparse-begin ... opt-plist)) (setq head-count 0) > (org-init-section-numbers) (org-lparse-begin-paragraph) (while (setq > line ... origline line) (catch > ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ...)) > (when (org-lparse-current-environment-p ...) > (org-lparse-end-environment ...)) (org-lparse-end-level 1 umax) (when > (and ... org-lparse-dyn-first-heading-pos) > (org-lparse-end-outline-text-or-outline)) (org-lparse-end (quote > DOCUMENT-BODY) opt-plist) (unless body-only (org-lparse-end ...)) > (org-lparse-end (quote EXPORT)) (when org-lparse-collect-buffer > (kill-buffer org-lparse-collect-buffer)) (goto-char (point-min)) (or > (org-export-push-to-kill-ring ...) (message "Exporting... done")) > (cond (... ... ...) (... ...) (t ...))) > (let* (hfy-user-sheet-assoc org-lparse-encode-pending > org-lparse-par-open (org-lparse-par-open-stashed 0) > (org-lparse-list-stack ...) org-lparse-list-table-p > org-lparse-list-table:table-cell-open org-lparse-list-table:table-row > org-lparse-list-table:lines org-lparse-outline-text-open > (org-lparse-latex-fragment-fallback ...) > (org-lparse-insert-tag-with-newlines ...) (org-lparse-to-buffer > to-buffer) (org-lparse-body-only body-only) > (org-lparse-entity-control-callbacks-alist ...) > (org-lparse-entity-format-callbacks-alist ...) (opt-plist ...) > (body-only ...) valid org-lparse-dyn-first-heading-pos (odd > org-odd-levels-only) (region-p ...) (rbeg ...) (rend ...) (subtree-p > ...) (level-offset ...) (opt-plist ...) (org-current-export-dir ...) > (org-current-export-file buffer-file-name) (level 0) (line "") > (origline "") txt todo (umax nil) (umax-toc nil) (filename ...) > (current-dir ...) (auto-insert nil) (buffer ...) (org-levels-open ...) > (dummy ...) (date ...) (date ...) (dummy ...) (title ...) (dummy ...) > (html-table-tag ...) (quote-re0 ...) (quote-re ...) ...) (let (...) > (org-unmodified ...)) (message "Exporting...") > (org-init-section-numbers) (setq org-lparse-output-buffer buffer) > (set-buffer org-lparse-output-buffer) (let (...) (erase-buffer)) > (fundamental-mode) (org-install-letbind) (and (fboundp ...) > (set-buffer-file-coding-system coding-system-for-write)) (let > (... ...) (mapc ... org-export-plist-vars) (setq umax ...) (setq > umax-toc ...) (setq org-lparse-opt-plist ...) (when ... ...) (unless > body-only ... ...) (setq head-count 0) (org-init-section-numbers) > (org-lparse-begin-paragraph) (while ... ...) (when ... ...) > (org-lparse-end-level 1 umax) (when ... ...) (org-lparse-end > ... opt-plist) (unless body-only ...) (org-lparse-end ...) (when > org-lparse-collect-buffer ...) (goto-char ...) (or ... ...) (cond > ... ... ...))) > org-do-lparse(3 hidden nil nil nil nil) > (prog1 (org-do-lparse arg hidden ext-plist to-buffer body-only > pub-dir) (remove-hook (quote org-export-preprocess-hook) (quote > org-lparse-strip-experimental-blocks-maybe)) (remove-hook (quote > org-export-preprocess-after-blockquote-hook) (quote > org-lparse-preprocess-after-blockquote))) > (let* ((org-lparse-backend ...) (org-lparse-other-backend ...)) > (add-hook (quote org-export-preprocess-hook) (quote > org-lparse-strip-experimental-blocks-maybe)) (add-hook (quote > org-export-preprocess-after-blockquote-hook) (quote > org-lparse-preprocess-after-blockquote)) (unless > (org-lparse-backend-is-native-p native-backend) (error "Don't know how > to export natively to backend %s" native-backend)) (unless (or > ... ...) (error "Don't know how to export to backend %s %s" > target-backend ...)) (run-hooks (quote org-export-first-hook)) (prog1 > (org-do-lparse arg hidden ext-plist to-buffer body-only pub-dir) > (remove-hook ... ...) (remove-hook ... ...))) > org-lparse("odt" "odt" 3 hidden) > org-lparse-batch("odt") > org-export-as-odt-batch() > command-line-1(("--load=/home/aldrichtr/.emacs" "--visit=./test.org" > "--funcall" "org-export-as-odt-batch")) > command-line() > normal-top-level() > > aldrichtr@liberty:/tmp/export-process > $ ls > test.odt > aldrichtr@liberty:/tmp/export-process > $ > > > --