From mboxrd@z Thu Jan 1 00:00:00 1970 From: John Kitchin Subject: Re: exporting org to docx Date: Tue, 27 Jun 2017 10:53:13 -0400 Message-ID: References: <3ECD3A60-C8B0-4EA9-9A79-C4DDF133E870@ur.rochester.edu> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:54579) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dPrrr-0007JM-VR for emacs-orgmode@gnu.org; Tue, 27 Jun 2017 10:53:30 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dPrrl-0002aS-1D for emacs-orgmode@gnu.org; Tue, 27 Jun 2017 10:53:28 -0400 Received: from mail-qk0-x236.google.com ([2607:f8b0:400d:c09::236]:36707) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1dPrrk-0002Ju-Rc for emacs-orgmode@gnu.org; Tue, 27 Jun 2017 10:53:20 -0400 Received: by mail-qk0-x236.google.com with SMTP id p21so27081868qke.3 for ; Tue, 27 Jun 2017 07:53:16 -0700 (PDT) In-reply-to: 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" To: "Doyley, Marvin M." Cc: "emacs-orgmode@gnu.org" can you post a small org file that has this problem? Doyley, Marvin M. writes: > Thanks for point this out, which I have now removed, but I still get an = error. This time I get > > pandoc: nil: openFile: does not exist (No such file or directory) > helm-M-x: Wrong type argument: stringp, nil > > Thanks, > M > PS here is the back trace > Debugger entered--Lisp error: (wrong-type-argument stringp nil) > delete-file(nil) > (let* ((bibfiles (mapcar (quote expand-file-name) (org-ref-find-bibliog= raphy))) (temp-bib) (bibtex-entries) biboption csl (current-file (buffer-fi= le-name)) (basename (file-name-sans-extension current-file)) (tex-file (con= cat basename ".tex")) (docx-file (concat basename ".docx"))) (save-buffer) = (if bibfiles (progn (setq bibtex-entries (let* ((bibtex-files bibfiles) (ke= ys (reverse ...)) (bibtex-entry-kill-ring-max (length keys)) (bibtex-entry-= kill-ring (quote nil))) (let ((wconfig ...)) (unwind-protect (progn ...) (s= et-window-configuration wconfig))) (mapconcat (quote identity) bibtex-entry= -kill-ring "\n\n")) temp-bib (make-temp-file "ox-word-" nil ".bib") bibopti= on (format " --bibliography=3D%s " temp-bib)) (let ((temp-file temp-bib) (t= emp-buffer (get-buffer-create (generate-new-buffer-name " *temp file*")))) = (unwind-protect (prog1 (save-current-buffer (set-buffer temp-buffer) (inser= t bibtex-entries)) (save-current-buffer (set-buffer temp-buffer) (write-reg= ion nil nil temp-file nil 0))) (and (buffer-name temp-buffer) (kill-buffer = temp-buffer)))))) (setq csl (cdr (assoc "PANDOC-CSL" (org-element-map (org-= element-parse-buffer) (quote keyword) (function (lambda (key) (cons ... ...= ))))))) (if csl (setq csl (format " --csl=3D%s " csl)) (setq csl " ")) (org= -latex-export-to-latex async subtreep visible-only body-only options) (if (= file-exists-p docx-file) (progn (delete-file docx-file))) (shell-command (f= ormat "pandoc -s -S %s%s\"%s\" -o \"%s\"" biboption csl tex-file docx-file)= ) (delete-file temp-bib) (org-open-file docx-file (quote (16)))) > ox-export-via-latex-pandoc-to-docx-and-open() > funcall-interactively(ox-export-via-latex-pandoc-to-docx-and-open) > call-interactively(ox-export-via-latex-pandoc-to-docx-and-open record n= il) > command-execute(ox-export-via-latex-pandoc-to-docx-and-open record) > helm-M-x(nil #("ox-export-via-latex-pandoc-to-docx-and-open" 0 43 (matc= h-part "ox-export-via-latex-pandoc-to-docx-and-open"))) > funcall-interactively(helm-M-x nil #("ox-export-via-latex-pandoc-to-doc= x-and-open" 0 43 (match-part "ox-export-via-latex-pandoc-to-docx-and-open")= )) > call-interactively(helm-M-x nil nil) > command-execute(helm-M-x) > > > > >> On Jun 24, 2017, at 1:07 PM, John Kitchin wrot= e: >>=20 >> what is this function: my-other-delete-trailing-blank-lines >>=20 >> it appears it is not defined. but is getting called in a before-save-hoo= k. >>=20 >> Doyley, Marvin M. writes: >>=20 >>> Hi there, >>>=20 >>> I am play with John=E2=80=99s ox-word.el function, which us pandoc to c= onvert org via latex to docx. However, when I try to use it, I get the fol= lowing error >>>=20 >>> helm-M-x: Wrong type argument: stringp, nil >>>=20 >>>=20 >>> Any suggestion on how to resolve this issue. >>>=20 >>> Cheers, >>> M >>>=20 >>> Ps Here is the backtrace >>>=20 >>> Debugger entered--Lisp error: (void-function my-other-delete-trailing-b= lank-lines) >>> my-other-delete-trailing-blank-lines() >>> run-hooks(before-save-hook) >>> basic-save-buffer(nil) >>> save-buffer() >>> write-file("./test.tex.tex") >>> (let ((coding-system-for-write encoding)) (write-file file)) >>> (progn (insert output) (let ((coding-system-for-write encoding)) (writ= e-file file))) >>> (unwind-protect (progn (insert output) (let ((coding-system-for-write = encoding)) (write-file file))) (and (buffer-name temp-buffer) (kill-buffer = temp-buffer))) >>> (save-current-buffer (set-buffer temp-buffer) (unwind-protect (progn (= insert output) (let ((coding-system-for-write encoding)) (write-file file))= ) (and (buffer-name temp-buffer) (kill-buffer temp-buffer)))) >>> (let ((temp-buffer (generate-new-buffer " *temp*"))) (save-current-buf= fer (set-buffer temp-buffer) (unwind-protect (progn (insert output) (let ((= coding-system-for-write encoding)) (write-file file))) (and (buffer-name te= mp-buffer) (kill-buffer temp-buffer))))) >>> (let ((output (org-export-as backend subtreep visible-only body-only e= xt-plist))) (let ((temp-buffer (generate-new-buffer " *temp*"))) (save-curr= ent-buffer (set-buffer temp-buffer) (unwind-protect (progn (insert output) = (let ((coding-system-for-write encoding)) (write-file file))) (and (buffer-= name temp-buffer) (kill-buffer temp-buffer))))) (if (and (org-export--copy-= to-kill-ring-p) (org-string-nw-p output)) (progn (org-kill-new output))) (o= r (and (functionp post-process) (funcall post-process file)) file)) >>> (if async (let ((with-temp-message "Initializing asynchronous export p= rocess") (current-message)) (unwind-protect (progn (if with-temp-message (p= rogn (setq current-message (current-message)) (message "%s" with-temp-messa= ge))) (let ((--copy-fun (org-export--generate-copy-script ...)) (--temp-fil= e (make-temp-file "org-export-process")) (--coding buffer-file-coding-syste= m)) (let ((temp-file --temp-file) (temp-buffer ...)) (unwind-protect (prog1= ... ...) (and ... ...))) (let* ((process-connection-type nil) (--proc-buff= er ...) (--process ...)) (org-export-add-to-stack (get-buffer --proc-buffer= ) nil --process) (let (...) (set-process-sentinel --process ...))))) (and w= ith-temp-message (if current-message (message "%s" current-message) (messag= e nil))))) (let ((output (org-export-as backend subtreep visible-only body-= only ext-plist))) (let ((temp-buffer (generate-new-buffer " *temp*"))) (sav= e-current-buffer (set-buffer temp-buffer) (unwind-protect (progn (insert ou= tput) (let (...) (write-file file))) (and (buffer-name temp-buffer) (kill-b= uffer temp-buffer))))) (if (and (org-export--copy-to-kill-ring-p) (org-stri= ng-nw-p output)) (progn (org-kill-new output))) (or (and (functionp post-pr= ocess) (funcall post-process file)) file))) >>> (let ((ext-plist (org-combine-plists (list (quote :output-file) file) = ext-plist)) (encoding (or org-export-coding-system buffer-file-coding-syste= m))) (if async (let ((with-temp-message "Initializing asynchronous export p= rocess") (current-message)) (unwind-protect (progn (if with-temp-message (p= rogn (setq current-message ...) (message "%s" with-temp-message))) (let ((-= -copy-fun ...) (--temp-file ...) (--coding buffer-file-coding-system)) (let= (... ...) (unwind-protect ... ...)) (let* (... ... ...) (org-export-add-to= -stack ... nil --process) (let ... ...)))) (and with-temp-message (if curre= nt-message (message "%s" current-message) (message nil))))) (let ((output (= org-export-as backend subtreep visible-only body-only ext-plist))) (let ((t= emp-buffer (generate-new-buffer " *temp*"))) (save-current-buffer (set-buff= er temp-buffer) (unwind-protect (progn (insert output) (let ... ...)) (and = (buffer-name temp-buffer) (kill-buffer temp-buffer))))) (if (and (org-expor= t--copy-to-kill-ring-p) (org-string-nw-p output)) (progn (org-kill-new outp= ut))) (or (and (functionp post-process) (funcall post-process file)) file))= )) >>> (if (not (file-writable-p file)) (error "Output file not writable") (l= et ((ext-plist (org-combine-plists (list (quote :output-file) file) ext-pli= st)) (encoding (or org-export-coding-system buffer-file-coding-system))) (i= f async (let ((with-temp-message "Initializing asynchronous export process"= ) (current-message)) (unwind-protect (progn (if with-temp-message (progn ..= . ...)) (let (... ... ...) (let ... ...) (let* ... ... ...))) (and with-tem= p-message (if current-message (message "%s" current-message) (message nil))= ))) (let ((output (org-export-as backend subtreep visible-only body-only ex= t-plist))) (let ((temp-buffer (generate-new-buffer " *temp*"))) (save-curre= nt-buffer (set-buffer temp-buffer) (unwind-protect (progn ... ...) (and ...= ...)))) (if (and (org-export--copy-to-kill-ring-p) (org-string-nw-p output= )) (progn (org-kill-new output))) (or (and (functionp post-process) (funcal= l post-process file)) file))))) >>> org-export-to-file(latex "./test.tex.tex" nil nil nil nil nil) >>> (let ((outfile (org-export-output-file-name ".tex" subtreep))) (org-ex= port-to-file (quote latex) outfile async subtreep visible-only body-only ex= t-plist)) >>> org-latex-export-to-latex(nil nil nil nil nil) >>> (let* ((bibfiles (mapcar (quote expand-file-name) (org-ref-find-biblio= graphy))) (temp-bib) (bibtex-entries) biboption csl (current-file (buffer-f= ile-name)) (basename (file-name-sans-extension current-file)) (tex-file (co= ncat basename ".tex")) (docx-file (concat basename ".docx"))) (save-buffer)= (if bibfiles (progn (setq bibtex-entries (let* ((bibtex-files bibfiles) (k= eys (reverse ...)) (bibtex-entry-kill-ring-max (length keys)) (bibtex-entry= -kill-ring (quote nil))) (let ((wconfig ...)) (unwind-protect (progn ...) (= set-window-configuration wconfig))) (mapconcat (quote identity) bibtex-entr= y-kill-ring "\n\n")) temp-bib (make-temp-file "ox-word-" nil ".bib") bibopt= ion (format " --bibliography=3D%s " temp-bib)) (let ((temp-file temp-bib) (= temp-buffer (get-buffer-create (generate-new-buffer-name " *temp file*"))))= (unwind-protect (prog1 (save-current-buffer (set-buffer temp-buffer) (inse= rt bibtex-entries)) (save-current-buffer (set-buffer temp-buffer) (write-re= gion nil nil temp-file nil 0))) (and (buffer-name temp-buffer) (kill-buffer= temp-buffer)))))) (setq csl (cdr (assoc "PANDOC-CSL" (org-element-map (org= -element-parse-buffer) (quote keyword) (function (lambda (key) (cons ... ..= .))))))) (if csl (setq csl (format " --csl=3D%s " csl)) (setq csl " ")) (or= g-latex-export-to-latex async subtreep visible-only body-only options) (if = (file-exists-p docx-file) (progn (delete-file docx-file))) (shell-command (= format "pandoc -s -S %s%s\"%s\" -o \"%s\"" biboption csl tex-file docx-file= )) (delete-file temp-bib) (org-open-file docx-file (quote (16)))) >>> ox-export-via-latex-pandoc-to-docx-and-open() >>> funcall-interactively(ox-export-via-latex-pandoc-to-docx-and-open) >>> call-interactively(ox-export-via-latex-pandoc-to-docx-and-open record = nil) >>> command-execute(ox-export-via-latex-pandoc-to-docx-and-open record) >>> helm-M-x(nil #("ox-export-via-latex-pandoc-to-docx-and-open" 0 43 (mat= ch-part "ox-export-via-latex-pandoc-to-docx-and-open"))) >>> funcall-interactively(helm-M-x nil #("ox-export-via-latex-pandoc-to-do= cx-and-open" 0 43 (match-part "ox-export-via-latex-pandoc-to-docx-and-open"= ))) >>> call-interactively(helm-M-x nil nil) >>> command-execute(helm-M-x) >>=20 >>=20 >> -- >> Professor John Kitchin >> Doherty Hall A207F >> Department of Chemical Engineering >> Carnegie Mellon University >> Pittsburgh, PA 15213 >> 412-268-7803 >> @johnkitchin >> https://urldefense.proofpoint.com/v2/url?u=3Dhttp-3A__kitchingroup.cheme= .cmu.edu&d=3DDwIFaQ&c=3Dkbmfwr1Yojg42sGEpaQh5ofMHBeTl9EI2eaqQZhHbOU&r=3Ds3_= 3riAscdqtNAzgOuwYB9g0dZVGcp8BNCy_RylYdxU&m=3DfpDGKjoBGMLn-IR_Ppzt26Yc5eU8GW= 50J-DqGll1blc&s=3DjqihIKTRKkfrF9V2SuWfN6RqVs6ghQUh-wXvKohuNi8&e=3D --=20 Professor John Kitchin Doherty Hall A207F Department of Chemical Engineering Carnegie Mellon University Pittsburgh, PA 15213 412-268-7803 @johnkitchin http://kitchingroup.cheme.cmu.edu