From mboxrd@z Thu Jan 1 00:00:00 1970 From: Jambunathan K Subject: Re: bug#13254: org-odt: Batch exports creates data loss, deletes original org file Date: Sun, 23 Dec 2012 12:59:56 +0530 Message-ID: <87k3s9w7ij.fsf__39340.9193763093$1356247815$gmane$org@gmail.com> References: <50D4ADAF.2050800@gmail.com> <87txredz7h.fsf@gmail.com> <50D5D942.6050700@gmail.com> <87mwx6ezpn.fsf_-_@gmail.com> Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([208.118.235.92]:41938) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Tmg06-0000bv-SU for emacs-orgmode@gnu.org; Sun, 23 Dec 2012 02:29:43 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Tmfwz-0006dZ-2c for emacs-orgmode@gnu.org; Sun, 23 Dec 2012 02:26:27 -0500 Received: from mail-pa0-f41.google.com ([209.85.220.41]:51134) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Tmfwy-0006dB-ND for emacs-orgmode@gnu.org; Sun, 23 Dec 2012 02:26:20 -0500 Received: by mail-pa0-f41.google.com with SMTP id bj3so3587554pad.14 for ; Sat, 22 Dec 2012 23:26:20 -0800 (PST) In-Reply-To: <87mwx6ezpn.fsf_-_@gmail.com> (Jambunathan K.'s message of "Sat, 22 Dec 2012 23:28:12 +0530") 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: 13254@debbugs.gnu.org, Bastien Cc: emacs-orgmode@gnu.org, Wiskey 5 Alpha Bastien I have pushed a fix to my private branch (see below). Please merge both `maint' AND `master' branches. `maint' branch - has 2 fixes for org-odt.el `master' branch - above fixes - New exporter changes. ,---- http://repo.or.cz/w/org-mode/org-kjn.git | | URL: git://repo.or.cz/org-mode/org-kjn.git | http://repo.or.cz/r/org-mode/org-kjn.git | | Push URL: ssh://repo.or.cz/srv/git/org-mode/org-kjn.git | `---- ,---- git log --format=oneline upstream/maint.. | | 82e061 org-odt.el: Fix Emacs Bug#13254 | 443542 org-odt.el: Correctly format link to headlines that have | `---- ,---- git log --format=oneline upstream/master.. | | 507ce4 org-odt.el: Fix Emacs Bug#13254 | 0754e3 org-e-odt.el: Handle links to target, list items | ad2ee6 org-e-odt.el: Handle links to headline, table etc that h | 3a2b5d org-odt.el: Correctly format link to headlines that have | c4597f org-e-odt.el: Handle clickable images | a7ad1c org-e-odt.el: Use `org-export-data-with-translations' | 76d529 org-e-odt.el: Support for short captions | 9d496c org-e-odt.el: Port fix for Bug#13197 | 9d56ba org-e-odt.el: Fix typesetting of Math formulae | fe0b1c org-e-odt.el: Add frame title and description to latex e | 6faf36 org-odt.el: Improve TOC entries | d9d62a org-e-odt.el: Emit priority in headlines, right justify | 533c8a org-e-odt.el: Not all keywords are supported | 1e30ef org-e-odt.el: Use new version of org-export-get-previous | 84eadb org-e-odt.el: New experimental option `org-e-odt-use-dat | 64b7c8 Fix Table of Contents, Clock block and various styles | acbb74 org-e-odt.el: Fix export issues on Windows XP | a2f5d8 org-e-odt.el: Honor `org-export-with-date' | 087936 Update OpenDocument schema files to v1.2 OASIS standard | d904e5 OrgOdtStyles.xml, OrgOdtContentTemplate.xml: Refresh | `---- Jambunathan K writes: >> 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 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 >> $ >> >> >> --