emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* exporting org to docx
@ 2017-06-24 15:23 Doyley, Marvin M.
  2017-06-24 17:07 ` John Kitchin
  0 siblings, 1 reply; 7+ messages in thread
From: Doyley, Marvin M. @ 2017-06-24 15:23 UTC (permalink / raw)
  To: emacs-orgmode@gnu.org

[-- Attachment #1: Type: text/plain, Size: 7598 bytes --]

Hi there,

I am play with John’s ox-word.el function, which us pandoc to convert org via latex to docx. However, when I try to use it, I get  the following error

helm-M-x: Wrong type argument: stringp, nil


Any suggestion on how to resolve this issue.

Cheers,
M

Ps Here is the backtrace

Debugger entered--Lisp error: (void-function my-other-delete-trailing-blank-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)) (write-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-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 ((output (org-export-as backend subtreep visible-only body-only ext-plist))) (let ((temp-buffer (generate-new-buffer " *temp*"))) (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))))) (if (and (org-export--copy-to-kill-ring-p) (org-string-nw-p output)) (progn (org-kill-new output))) (or (and (functionp post-process) (funcall post-process file)) file))
  (if async (let ((with-temp-message "Initializing asynchronous export process") (current-message)) (unwind-protect (progn (if with-temp-message (progn (setq current-message (current-message)) (message "%s" with-temp-message))) (let ((--copy-fun (org-export--generate-copy-script ...)) (--temp-file (make-temp-file "org-export-process")) (--coding buffer-file-coding-system)) (let ((temp-file --temp-file) (temp-buffer ...)) (unwind-protect (prog1 ... ...) (and ... ...))) (let* ((process-connection-type nil) (--proc-buffer ...) (--process ...)) (org-export-add-to-stack (get-buffer --proc-buffer) nil --process) (let (...) (set-process-sentinel --process ...))))) (and with-temp-message (if current-message (message "%s" current-message) (message nil))))) (let ((output (org-export-as backend subtreep visible-only body-only ext-plist))) (let ((temp-buffer (generate-new-buffer " *temp*"))) (save-current-buffer (set-buffer temp-buffer) (unwind-protect (progn (insert output) (let (...) (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))) (or (and (functionp post-process) (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-system))) (if async (let ((with-temp-message "Initializing asynchronous export process") (current-message)) (unwind-protect (progn (if with-temp-message (progn (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 current-message (message "%s" current-message) (message nil))))) (let ((output (org-export-as backend subtreep visible-only body-only ext-plist))) (let ((temp-buffer (generate-new-buffer " *temp*"))) (save-current-buffer (set-buffer temp-buffer) (unwind-protect (progn (insert output) (let ... ...)) (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))) (or (and (functionp post-process) (funcall post-process file)) file))))
  (if (not (file-writable-p file)) (error "Output file not writable") (let ((ext-plist (org-combine-plists (list (quote :output-file) file) ext-plist)) (encoding (or org-export-coding-system buffer-file-coding-system))) (if async (let ((with-temp-message "Initializing asynchronous export process") (current-message)) (unwind-protect (progn (if with-temp-message (progn ... ...)) (let (... ... ...) (let ... ...) (let* ... ... ...))) (and with-temp-message (if current-message (message "%s" current-message) (message nil))))) (let ((output (org-export-as backend subtreep visible-only body-only ext-plist))) (let ((temp-buffer (generate-new-buffer " *temp*"))) (save-current-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) (funcall 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-export-to-file (quote latex) outfile async subtreep visible-only body-only ext-plist))
  org-latex-export-to-latex(nil nil nil nil nil)
  (let* ((bibfiles (mapcar (quote expand-file-name) (org-ref-find-bibliography))) (temp-bib) (bibtex-entries) biboption csl (current-file (buffer-file-name)) (basename (file-name-sans-extension current-file)) (tex-file (concat basename ".tex")) (docx-file (concat basename ".docx"))) (save-buffer) (if bibfiles (progn (setq bibtex-entries (let* ((bibtex-files bibfiles) (keys (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-entry-kill-ring "\n\n")) temp-bib (make-temp-file "ox-word-" nil ".bib") biboption (format " --bibliography=%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) (insert bibtex-entries)) (save-current-buffer (set-buffer temp-buffer) (write-region 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=%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 (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 (match-part "ox-export-via-latex-pandoc-to-docx-and-open")))
  funcall-interactively(helm-M-x nil #("ox-export-via-latex-pandoc-to-docx-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)


[-- Attachment #2: Message signed with OpenPGP using GPGMail --]
[-- Type: application/pgp-signature, Size: 455 bytes --]

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: exporting org to docx
  2017-06-24 15:23 exporting org to docx Doyley, Marvin M.
@ 2017-06-24 17:07 ` John Kitchin
  2017-06-24 18:08   ` Doyley, Marvin M.
  0 siblings, 1 reply; 7+ messages in thread
From: John Kitchin @ 2017-06-24 17:07 UTC (permalink / raw)
  To: Doyley, Marvin M.; +Cc: emacs-orgmode@gnu.org

what is this function: my-other-delete-trailing-blank-lines

it appears it is not defined. but is getting called in a before-save-hook.

Doyley, Marvin M. writes:

> Hi there,
>
> I am play with John’s ox-word.el function, which us pandoc to convert org via latex to docx. However, when I try to use it, I get  the following error
>
> helm-M-x: Wrong type argument: stringp, nil
>
>
> Any suggestion on how to resolve this issue.
>
> Cheers,
> M
>
> Ps Here is the backtrace
>
> Debugger entered--Lisp error: (void-function my-other-delete-trailing-blank-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)) (write-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-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 ((output (org-export-as backend subtreep visible-only body-only ext-plist))) (let ((temp-buffer (generate-new-buffer " *temp*"))) (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))))) (if (and (org-export--copy-to-kill-ring-p) (org-string-nw-p output)) (progn (org-kill-new output))) (or (and (functionp post-process) (funcall post-process file)) file))
>   (if async (let ((with-temp-message "Initializing asynchronous export process") (current-message)) (unwind-protect (progn (if with-temp-message (progn (setq current-message (current-message)) (message "%s" with-temp-message))) (let ((--copy-fun (org-export--generate-copy-script ...)) (--temp-file (make-temp-file "org-export-process")) (--coding buffer-file-coding-system)) (let ((temp-file --temp-file) (temp-buffer ...)) (unwind-protect (prog1 ... ...) (and ... ...))) (let* ((process-connection-type nil) (--proc-buffer ...) (--process ...)) (org-export-add-to-stack (get-buffer --proc-buffer) nil --process) (let (...) (set-process-sentinel --process ...))))) (and with-temp-message (if current-message (message "%s" current-message) (message nil))))) (let ((output (org-export-as backend subtreep visible-only body-only ext-plist))) (let ((temp-buffer (generate-new-buffer " *temp*"))) (save-current-buffer (set-buffer temp-buffer) (unwind-protect (progn (insert output) (let (...) (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))) (or (and (functionp post-process) (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-system))) (if async (let ((with-temp-message "Initializing asynchronous export process") (current-message)) (unwind-protect (progn (if with-temp-message (progn (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 current-message (message "%s" current-message) (message nil))))) (let ((output (org-export-as backend subtreep visible-only body-only ext-plist))) (let ((temp-buffer (generate-new-buffer " *temp*"))) (save-current-buffer (set-buffer temp-buffer) (unwind-protect (progn (insert output) (let ... ...)) (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))) (or (and (functionp post-process) (funcall post-process file)) file))))
>   (if (not (file-writable-p file)) (error "Output file not writable") (let ((ext-plist (org-combine-plists (list (quote :output-file) file) ext-plist)) (encoding (or org-export-coding-system buffer-file-coding-system))) (if async (let ((with-temp-message "Initializing asynchronous export process") (current-message)) (unwind-protect (progn (if with-temp-message (progn ... ...)) (let (... ... ...) (let ... ...) (let* ... ... ...))) (and with-temp-message (if current-message (message "%s" current-message) (message nil))))) (let ((output (org-export-as backend subtreep visible-only body-only ext-plist))) (let ((temp-buffer (generate-new-buffer " *temp*"))) (save-current-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) (funcall 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-export-to-file (quote latex) outfile async subtreep visible-only body-only ext-plist))
>   org-latex-export-to-latex(nil nil nil nil nil)
>   (let* ((bibfiles (mapcar (quote expand-file-name) (org-ref-find-bibliography))) (temp-bib) (bibtex-entries) biboption csl (current-file (buffer-file-name)) (basename (file-name-sans-extension current-file)) (tex-file (concat basename ".tex")) (docx-file (concat basename ".docx"))) (save-buffer) (if bibfiles (progn (setq bibtex-entries (let* ((bibtex-files bibfiles) (keys (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-entry-kill-ring "\n\n")) temp-bib (make-temp-file "ox-word-" nil ".bib") biboption (format " --bibliography=%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) (insert bibtex-entries)) (save-current-buffer (set-buffer temp-buffer) (write-region 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=%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 (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 (match-part "ox-export-via-latex-pandoc-to-docx-and-open")))
>   funcall-interactively(helm-M-x nil #("ox-export-via-latex-pandoc-to-docx-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)


--
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

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: exporting org to docx
  2017-06-24 17:07 ` John Kitchin
@ 2017-06-24 18:08   ` Doyley, Marvin M.
  2017-06-27 14:53     ` John Kitchin
  0 siblings, 1 reply; 7+ messages in thread
From: Doyley, Marvin M. @ 2017-06-24 18:08 UTC (permalink / raw)
  To: John Kitchin; +Cc: emacs-orgmode@gnu.org, Doyley, Marvin M.

[-- Attachment #1: Type: text/plain, Size: 10947 bytes --]

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-bibliography))) (temp-bib) (bibtex-entries) biboption csl (current-file (buffer-file-name)) (basename (file-name-sans-extension current-file)) (tex-file (concat basename ".tex")) (docx-file (concat basename ".docx"))) (save-buffer) (if bibfiles (progn (setq bibtex-entries (let* ((bibtex-files bibfiles) (keys (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-entry-kill-ring "\n\n")) temp-bib (make-temp-file "ox-word-" nil ".bib") biboption (format " --bibliography=%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) (insert bibtex-entries)) (save-current-buffer (set-buffer temp-buffer) (write-region 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=%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 (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 (match-part "ox-export-via-latex-pandoc-to-docx-and-open")))
  funcall-interactively(helm-M-x nil #("ox-export-via-latex-pandoc-to-docx-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 <jkitchin@andrew.cmu.edu> wrote:
> 
> what is this function: my-other-delete-trailing-blank-lines
> 
> it appears it is not defined. but is getting called in a before-save-hook.
> 
> Doyley, Marvin M. writes:
> 
>> Hi there,
>> 
>> I am play with John’s ox-word.el function, which us pandoc to convert org via latex to docx. However, when I try to use it, I get  the following error
>> 
>> helm-M-x: Wrong type argument: stringp, nil
>> 
>> 
>> Any suggestion on how to resolve this issue.
>> 
>> Cheers,
>> M
>> 
>> Ps Here is the backtrace
>> 
>> Debugger entered--Lisp error: (void-function my-other-delete-trailing-blank-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)) (write-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-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 ((output (org-export-as backend subtreep visible-only body-only ext-plist))) (let ((temp-buffer (generate-new-buffer " *temp*"))) (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))))) (if (and (org-export--copy-to-kill-ring-p) (org-string-nw-p output)) (progn (org-kill-new output))) (or (and (functionp post-process) (funcall post-process file)) file))
>>  (if async (let ((with-temp-message "Initializing asynchronous export process") (current-message)) (unwind-protect (progn (if with-temp-message (progn (setq current-message (current-message)) (message "%s" with-temp-message))) (let ((--copy-fun (org-export--generate-copy-script ...)) (--temp-file (make-temp-file "org-export-process")) (--coding buffer-file-coding-system)) (let ((temp-file --temp-file) (temp-buffer ...)) (unwind-protect (prog1 ... ...) (and ... ...))) (let* ((process-connection-type nil) (--proc-buffer ...) (--process ...)) (org-export-add-to-stack (get-buffer --proc-buffer) nil --process) (let (...) (set-process-sentinel --process ...))))) (and with-temp-message (if current-message (message "%s" current-message) (message nil))))) (let ((output (org-export-as backend subtreep visible-only body-only ext-plist))) (let ((temp-buffer (generate-new-buffer " *temp*"))) (save-current-buffer (set-buffer temp-buffer) (unwind-protect (progn (insert output) (let (...) (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))) (or (and (functionp post-process) (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-system))) (if async (let ((with-temp-message "Initializing asynchronous export process") (current-message)) (unwind-protect (progn (if with-temp-message (progn (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 current-message (message "%s" current-message) (message nil))))) (let ((output (org-export-as backend subtreep visible-only body-only ext-plist))) (let ((temp-buffer (generate-new-buffer " *temp*"))) (save-current-buffer (set-buffer temp-buffer) (unwind-protect (progn (insert output) (let ... ...)) (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))) (or (and (functionp post-process) (funcall post-process file)) file))))
>>  (if (not (file-writable-p file)) (error "Output file not writable") (let ((ext-plist (org-combine-plists (list (quote :output-file) file) ext-plist)) (encoding (or org-export-coding-system buffer-file-coding-system))) (if async (let ((with-temp-message "Initializing asynchronous export process") (current-message)) (unwind-protect (progn (if with-temp-message (progn ... ...)) (let (... ... ...) (let ... ...) (let* ... ... ...))) (and with-temp-message (if current-message (message "%s" current-message) (message nil))))) (let ((output (org-export-as backend subtreep visible-only body-only ext-plist))) (let ((temp-buffer (generate-new-buffer " *temp*"))) (save-current-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) (funcall 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-export-to-file (quote latex) outfile async subtreep visible-only body-only ext-plist))
>>  org-latex-export-to-latex(nil nil nil nil nil)
>>  (let* ((bibfiles (mapcar (quote expand-file-name) (org-ref-find-bibliography))) (temp-bib) (bibtex-entries) biboption csl (current-file (buffer-file-name)) (basename (file-name-sans-extension current-file)) (tex-file (concat basename ".tex")) (docx-file (concat basename ".docx"))) (save-buffer) (if bibfiles (progn (setq bibtex-entries (let* ((bibtex-files bibfiles) (keys (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-entry-kill-ring "\n\n")) temp-bib (make-temp-file "ox-word-" nil ".bib") biboption (format " --bibliography=%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) (insert bibtex-entries)) (save-current-buffer (set-buffer temp-buffer) (write-region 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=%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 (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 (match-part "ox-export-via-latex-pandoc-to-docx-and-open")))
>>  funcall-interactively(helm-M-x nil #("ox-export-via-latex-pandoc-to-docx-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)
> 
> 
> --
> 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=http-3A__kitchingroup.cheme.cmu.edu&d=DwIFaQ&c=kbmfwr1Yojg42sGEpaQh5ofMHBeTl9EI2eaqQZhHbOU&r=s3_3riAscdqtNAzgOuwYB9g0dZVGcp8BNCy_RylYdxU&m=fpDGKjoBGMLn-IR_Ppzt26Yc5eU8GW50J-DqGll1blc&s=jqihIKTRKkfrF9V2SuWfN6RqVs6ghQUh-wXvKohuNi8&e=


[-- Attachment #2: Message signed with OpenPGP using GPGMail --]
[-- Type: application/pgp-signature, Size: 455 bytes --]

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: exporting org to docx
  2017-06-24 18:08   ` Doyley, Marvin M.
@ 2017-06-27 14:53     ` John Kitchin
  2017-06-27 23:21       ` Doyley, Marvin M.
  0 siblings, 1 reply; 7+ messages in thread
From: John Kitchin @ 2017-06-27 14:53 UTC (permalink / raw)
  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-bibliography))) (temp-bib) (bibtex-entries) biboption csl (current-file (buffer-file-name)) (basename (file-name-sans-extension current-file)) (tex-file (concat basename ".tex")) (docx-file (concat basename ".docx"))) (save-buffer) (if bibfiles (progn (setq bibtex-entries (let* ((bibtex-files bibfiles) (keys (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-entry-kill-ring "\n\n")) temp-bib (make-temp-file "ox-word-" nil ".bib") biboption (format " --bibliography=%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) (insert bibtex-entries)) (save-current-buffer (set-buffer temp-buffer) (write-region 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=%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 (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 (match-part "ox-export-via-latex-pandoc-to-docx-and-open")))
>   funcall-interactively(helm-M-x nil #("ox-export-via-latex-pandoc-to-docx-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 <jkitchin@andrew.cmu.edu> wrote:
>> 
>> what is this function: my-other-delete-trailing-blank-lines
>> 
>> it appears it is not defined. but is getting called in a before-save-hook.
>> 
>> Doyley, Marvin M. writes:
>> 
>>> Hi there,
>>> 
>>> I am play with John’s ox-word.el function, which us pandoc to convert org via latex to docx. However, when I try to use it, I get  the following error
>>> 
>>> helm-M-x: Wrong type argument: stringp, nil
>>> 
>>> 
>>> Any suggestion on how to resolve this issue.
>>> 
>>> Cheers,
>>> M
>>> 
>>> Ps Here is the backtrace
>>> 
>>> Debugger entered--Lisp error: (void-function my-other-delete-trailing-blank-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)) (write-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-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 ((output (org-export-as backend subtreep visible-only body-only ext-plist))) (let ((temp-buffer (generate-new-buffer " *temp*"))) (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))))) (if (and (org-export--copy-to-kill-ring-p) (org-string-nw-p output)) (progn (org-kill-new output))) (or (and (functionp post-process) (funcall post-process file)) file))
>>>  (if async (let ((with-temp-message "Initializing asynchronous export process") (current-message)) (unwind-protect (progn (if with-temp-message (progn (setq current-message (current-message)) (message "%s" with-temp-message))) (let ((--copy-fun (org-export--generate-copy-script ...)) (--temp-file (make-temp-file "org-export-process")) (--coding buffer-file-coding-system)) (let ((temp-file --temp-file) (temp-buffer ...)) (unwind-protect (prog1 ... ...) (and ... ...))) (let* ((process-connection-type nil) (--proc-buffer ...) (--process ...)) (org-export-add-to-stack (get-buffer --proc-buffer) nil --process) (let (...) (set-process-sentinel --process ...))))) (and with-temp-message (if current-message (message "%s" current-message) (message nil))))) (let ((output (org-export-as backend subtreep visible-only body-only ext-plist))) (let ((temp-buffer (generate-new-buffer " *temp*"))) (save-current-buffer (set-buffer temp-buffer) (unwind-protect (progn (insert output) (let (...) (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))) (or (and (functionp post-process) (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-system))) (if async (let ((with-temp-message "Initializing asynchronous export process") (current-message)) (unwind-protect (progn (if with-temp-message (progn (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 current-message (message "%s" current-message) (message nil))))) (let ((output (org-export-as backend subtreep visible-only body-only ext-plist))) (let ((temp-buffer (generate-new-buffer " *temp*"))) (save-current-buffer (set-buffer temp-buffer) (unwind-protect (progn (insert output) (let ... ...)) (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))) (or (and (functionp post-process) (funcall post-process file)) file))))
>>>  (if (not (file-writable-p file)) (error "Output file not writable") (let ((ext-plist (org-combine-plists (list (quote :output-file) file) ext-plist)) (encoding (or org-export-coding-system buffer-file-coding-system))) (if async (let ((with-temp-message "Initializing asynchronous export process") (current-message)) (unwind-protect (progn (if with-temp-message (progn ... ...)) (let (... ... ...) (let ... ...) (let* ... ... ...))) (and with-temp-message (if current-message (message "%s" current-message) (message nil))))) (let ((output (org-export-as backend subtreep visible-only body-only ext-plist))) (let ((temp-buffer (generate-new-buffer " *temp*"))) (save-current-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) (funcall 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-export-to-file (quote latex) outfile async subtreep visible-only body-only ext-plist))
>>>  org-latex-export-to-latex(nil nil nil nil nil)
>>>  (let* ((bibfiles (mapcar (quote expand-file-name) (org-ref-find-bibliography))) (temp-bib) (bibtex-entries) biboption csl (current-file (buffer-file-name)) (basename (file-name-sans-extension current-file)) (tex-file (concat basename ".tex")) (docx-file (concat basename ".docx"))) (save-buffer) (if bibfiles (progn (setq bibtex-entries (let* ((bibtex-files bibfiles) (keys (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-entry-kill-ring "\n\n")) temp-bib (make-temp-file "ox-word-" nil ".bib") biboption (format " --bibliography=%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) (insert bibtex-entries)) (save-current-buffer (set-buffer temp-buffer) (write-region 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=%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 (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 (match-part "ox-export-via-latex-pandoc-to-docx-and-open")))
>>>  funcall-interactively(helm-M-x nil #("ox-export-via-latex-pandoc-to-docx-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)
>> 
>> 
>> --
>> 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=http-3A__kitchingroup.cheme.cmu.edu&d=DwIFaQ&c=kbmfwr1Yojg42sGEpaQh5ofMHBeTl9EI2eaqQZhHbOU&r=s3_3riAscdqtNAzgOuwYB9g0dZVGcp8BNCy_RylYdxU&m=fpDGKjoBGMLn-IR_Ppzt26Yc5eU8GW50J-DqGll1blc&s=jqihIKTRKkfrF9V2SuWfN6RqVs6ghQUh-wXvKohuNi8&e=


-- 
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

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: exporting org to docx
  2017-06-27 14:53     ` John Kitchin
@ 2017-06-27 23:21       ` Doyley, Marvin M.
  2017-06-28  0:11         ` John Kitchin
  2017-06-28 17:20         ` Doyley, Marvin M.
  0 siblings, 2 replies; 7+ messages in thread
From: Doyley, Marvin M. @ 2017-06-27 23:21 UTC (permalink / raw)
  To: John Kitchin; +Cc: emacs-orgmode@gnu.org, Doyley, Marvin M.


[-- Attachment #1.1: Type: text/plain, Size: 47 bytes --]

Here is a sample file that I have been using,


[-- Attachment #1.2: simple_test.org --]
[-- Type: application/octet-stream, Size: 3359 bytes --]

#+title: Exporting org to docx
#+options: toc:nil

* Simple text
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed euismod lorem sit amet suscipit posuere. Aliquam eu venenatis nunc. Sed eget elit dui. Nulla ac tincidunt erat. Cras porta dui enim, sed sagittis ligula feugiat at. Fusce at metus vitae lacus imperdiet luctus. Vestibulum molestie placerat lacus vel aliquam. Nulla leo orci, aliquet a eleifend et, tincidunt eu ex. Integer vitae facilisis enim. Pellentesque faucibus eros volutpat, auctor odio eleifend, condimentum elit. Mauris vestibulum lacus ac massa fringilla, ut fringilla nisi hendrerit. In id rhoncus eros. Praesent quis facilisis nunc. Nulla ut sodales justo. Donec tincidunt vulputate mi quis aliquam. Aliquam ligula justo, sagittis ut nisl ac, imperdiet tristique dui.

Nunc gravida ultrices bibendum. Cras eget dui libero. Nam turpis turpis, consequat vitae sollicitudin in, volutpat et neque. Nam porta consectetur nulla, nec condimentum ipsum iaculis sed. Suspendisse eu nulla eget arcu porta convallis. Nunc aliquet, nibh in vulputate pharetra, enim erat fringilla orci, sit amet pharetra dolor risus ac nisl. Praesent efficitur tortor lorem, aliquet auctor urna sagittis nec. Praesent dictum rutrum quam a ultrices. Nunc vitae porta lorem, congue efficitur leo.

Aenean sollicitudin arcu urna. Quisque vehicula justo tellus, in ultrices justo suscipit nec. Nullam non ullamcorper ipsum. Curabitur magna odio, rhoncus ac rhoncus sit amet, vehicula non turpis. Nam dapibus consequat est in porta. Nam ac congue erat. Sed in leo in enim porttitor tempor a eu tortor. Etiam in nibh eu nisl posuere sollicitudin. Fusce enim urna, consequat sit amet consequat ut, vehicula at risus. Etiam eget sapien tempus, luctus neque eget, sollicitudin mauris.

Nullam posuere vel magna id mollis. Phasellus iaculis rutrum enim vel molestie. Proin vitae sagittis dolor, quis bibendum sapien. Quisque convallis dapibus varius. Nam euismod dignissim augue, vel maximus risus tempus vel. Nunc sit amet erat vitae nulla malesuada bibendum. Integer viverra vestibulum lobortis. Fusce porttitor dolor eu pellentesque viverra. Curabitur eu arcu nec sem consectetur molestie sit amet ut felis. Morbi auctor sapien dui, at pulvinar leo placerat non. Duis ut metus a diam ultricies elementum.

Vestibulum quis magna nunc. Fusce ac vestibulum ligula. Proin egestas, metus ut elementum congue,
tortor risus hendrerit elit, ut posuere tortor mauris a quam. Etiam vitae ligula vitae urna ornare
pharetra. Praesent euismod vestibulum mi in fringilla. In gravida felis vel eros tristique, nec
tincidunt ante congue. Fusce faucibus neque augue. Donec eu feugiat velit, non scelerisque
est. Morbi eget nunc sollicitudin, vestibulum est vitae, porttitor neque. Praesent suscipit nisi in
justo gravida, quis luctus tortor sodales. Ut iaculis sapien quam, nec vestibulum metus euismod in.
* Equations 

\begin{equation}
(\lambda + \mu)\nabla(\nabla \cdot
         \vec{u})+\mu\nabla^2\vec{u}=0
\end{equation}

* ipython 

#+BEGIN_SRC ipython :session :results output drawer
  import numpy as np
  import matplotlib.pyplot as plt
  import seaborn as sns
  %matplotlib inline
  x = np.linspace(0,2*np.pi,200)
  y = np.cos(x)
  plt.plot(x,y)

#+END_SRC

#+RESULTS:
:RESULTS:
[[file:ipython-inline-images/ob-ipython-f14d687d141b30c166e4329dd8339986.png]]
:END:

[-- Attachment #1.3: simple_test.tex --]
[-- Type: application/x-tex, Size: 4068 bytes --]

[-- Attachment #1.4: Type: text/plain, Size: 11742 bytes --]


> On Jun 27, 2017, at 10:53 AM, John Kitchin <jkitchin@andrew.cmu.edu> wrote:
> 
> 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-bibliography))) (temp-bib) (bibtex-entries) biboption csl (current-file (buffer-file-name)) (basename (file-name-sans-extension current-file)) (tex-file (concat basename ".tex")) (docx-file (concat basename ".docx"))) (save-buffer) (if bibfiles (progn (setq bibtex-entries (let* ((bibtex-files bibfiles) (keys (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-entry-kill-ring "\n\n")) temp-bib (make-temp-file "ox-word-" nil ".bib") biboption (format " --bibliography=%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) (insert bibtex-entries)) (save-current-buffer (set-buffer temp-buffer) (write-region 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=%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 (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 (match-part "ox-export-via-latex-pandoc-to-docx-and-open")))
>>  funcall-interactively(helm-M-x nil #("ox-export-via-latex-pandoc-to-docx-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 <jkitchin@andrew.cmu.edu> wrote:
>>> 
>>> what is this function: my-other-delete-trailing-blank-lines
>>> 
>>> it appears it is not defined. but is getting called in a before-save-hook.
>>> 
>>> Doyley, Marvin M. writes:
>>> 
>>>> Hi there,
>>>> 
>>>> I am play with John’s ox-word.el function, which us pandoc to convert org via latex to docx. However, when I try to use it, I get  the following error
>>>> 
>>>> helm-M-x: Wrong type argument: stringp, nil
>>>> 
>>>> 
>>>> Any suggestion on how to resolve this issue.
>>>> 
>>>> Cheers,
>>>> M
>>>> 
>>>> Ps Here is the backtrace
>>>> 
>>>> Debugger entered--Lisp error: (void-function my-other-delete-trailing-blank-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)) (write-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-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 ((output (org-export-as backend subtreep visible-only body-only ext-plist))) (let ((temp-buffer (generate-new-buffer " *temp*"))) (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))))) (if (and (org-export--copy-to-kill-ring-p) (org-string-nw-p output)) (progn (org-kill-new output))) (or (and (functionp post-process) (funcall post-process file)) file))
>>>> (if async (let ((with-temp-message "Initializing asynchronous export process") (current-message)) (unwind-protect (progn (if with-temp-message (progn (setq current-message (current-message)) (message "%s" with-temp-message))) (let ((--copy-fun (org-export--generate-copy-script ...)) (--temp-file (make-temp-file "org-export-process")) (--coding buffer-file-coding-system)) (let ((temp-file --temp-file) (temp-buffer ...)) (unwind-protect (prog1 ... ...) (and ... ...))) (let* ((process-connection-type nil) (--proc-buffer ...) (--process ...)) (org-export-add-to-stack (get-buffer --proc-buffer) nil --process) (let (...) (set-process-sentinel --process ...))))) (and with-temp-message (if current-message (message "%s" current-message) (message nil))))) (let ((output (org-export-as backend subtreep visible-only body-only ext-plist))) (let ((temp-buffer (generate-new-buffer " *temp*"))) (save-current-buffer (set-buffer temp-buffer) (unwind-protect (progn (insert output) (let (...) (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))) (or (and (functionp post-process) (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-system))) (if async (let ((with-temp-message "Initializing asynchronous export process") (current-message)) (unwind-protect (progn (if with-temp-message (progn (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 current-message (message "%s" current-message) (message nil))))) (let ((output (org-export-as backend subtreep visible-only body-only ext-plist))) (let ((temp-buffer (generate-new-buffer " *temp*"))) (save-current-buffer (set-buffer temp-buffer) (unwind-protect (progn (insert output) (let ... ...)) (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))) (or (and (functionp post-process) (funcall post-process file)) file))))
>>>> (if (not (file-writable-p file)) (error "Output file not writable") (let ((ext-plist (org-combine-plists (list (quote :output-file) file) ext-plist)) (encoding (or org-export-coding-system buffer-file-coding-system))) (if async (let ((with-temp-message "Initializing asynchronous export process") (current-message)) (unwind-protect (progn (if with-temp-message (progn ... ...)) (let (... ... ...) (let ... ...) (let* ... ... ...))) (and with-temp-message (if current-message (message "%s" current-message) (message nil))))) (let ((output (org-export-as backend subtreep visible-only body-only ext-plist))) (let ((temp-buffer (generate-new-buffer " *temp*"))) (save-current-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) (funcall 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-export-to-file (quote latex) outfile async subtreep visible-only body-only ext-plist))
>>>> org-latex-export-to-latex(nil nil nil nil nil)
>>>> (let* ((bibfiles (mapcar (quote expand-file-name) (org-ref-find-bibliography))) (temp-bib) (bibtex-entries) biboption csl (current-file (buffer-file-name)) (basename (file-name-sans-extension current-file)) (tex-file (concat basename ".tex")) (docx-file (concat basename ".docx"))) (save-buffer) (if bibfiles (progn (setq bibtex-entries (let* ((bibtex-files bibfiles) (keys (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-entry-kill-ring "\n\n")) temp-bib (make-temp-file "ox-word-" nil ".bib") biboption (format " --bibliography=%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) (insert bibtex-entries)) (save-current-buffer (set-buffer temp-buffer) (write-region 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=%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 (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 (match-part "ox-export-via-latex-pandoc-to-docx-and-open")))
>>>> funcall-interactively(helm-M-x nil #("ox-export-via-latex-pandoc-to-docx-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)
>>> 
>>> 
>>> --
>>> 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=http-3A__kitchingroup.cheme.cmu.edu&d=DwIFaQ&c=kbmfwr1Yojg42sGEpaQh5ofMHBeTl9EI2eaqQZhHbOU&r=s3_3riAscdqtNAzgOuwYB9g0dZVGcp8BNCy_RylYdxU&m=fpDGKjoBGMLn-IR_Ppzt26Yc5eU8GW50J-DqGll1blc&s=jqihIKTRKkfrF9V2SuWfN6RqVs6ghQUh-wXvKohuNi8&e=
> 
> 
> --
> 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=http-3A__kitchingroup.cheme.cmu.edu&d=DwIFaQ&c=kbmfwr1Yojg42sGEpaQh5ofMHBeTl9EI2eaqQZhHbOU&r=s3_3riAscdqtNAzgOuwYB9g0dZVGcp8BNCy_RylYdxU&m=Ak2zZPodYjZldCE4XzfFYpSENYzapnBe2-oTIEbBnI4&s=kQj3UIrDBe-cf4dsH6pm2x4G8P9a_nOw-uI1_hgatLI&e=


[-- Attachment #2: Message signed with OpenPGP using GPGMail --]
[-- Type: application/pgp-signature, Size: 455 bytes --]

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: exporting org to docx
  2017-06-27 23:21       ` Doyley, Marvin M.
@ 2017-06-28  0:11         ` John Kitchin
  2017-06-28 17:20         ` Doyley, Marvin M.
  1 sibling, 0 replies; 7+ messages in thread
From: John Kitchin @ 2017-06-28  0:11 UTC (permalink / raw)
  To: Doyley, Marvin M.; +Cc: emacs-orgmode@gnu.org


[-- Attachment #1.1: Type: text/plain, Size: 13237 bytes --]

Your file worked approximately right for me. The code block did not render
too well (I set it up to use minted), but everything else did fine I guess.
My tex header is different than yours, but I don't know how much that
matters. The output I got is attached.

I did see two places where delete-file might cause that and have pushed
fixes to scimax for them. They may have been the cause (although I don't
know why mine would have worked, and it didn't for you, the ox-word
versions should have been the same probably).

John

-----------------------------------
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


On Tue, Jun 27, 2017 at 7:21 PM, Doyley, Marvin M. <m.doyley@rochester.edu>
wrote:

> Here is a sample file that I have been using,
>
>
>
> > On Jun 27, 2017, at 10:53 AM, John Kitchin <jkitchin@andrew.cmu.edu>
> wrote:
> >
> > 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-bibliography))) (temp-bib) (bibtex-entries) biboption csl
> (current-file (buffer-file-name)) (basename (file-name-sans-extension
> current-file)) (tex-file (concat basename ".tex")) (docx-file (concat
> basename ".docx"))) (save-buffer) (if bibfiles (progn (setq bibtex-entries
> (let* ((bibtex-files bibfiles) (keys (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-entry-kill-ring "\n\n")) temp-bib (make-temp-file "ox-word-" nil
> ".bib") biboption (format " --bibliography=%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) (insert bibtex-entries)) (save-current-buffer (set-buffer
> temp-buffer) (write-region 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=%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 (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
> (match-part "ox-export-via-latex-pandoc-to-docx-and-open")))
> >>  funcall-interactively(helm-M-x nil #("ox-export-via-latex-pandoc-to-docx-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 <jkitchin@andrew.cmu.edu>
> wrote:
> >>>
> >>> what is this function: my-other-delete-trailing-blank-lines
> >>>
> >>> it appears it is not defined. but is getting called in a
> before-save-hook.
> >>>
> >>> Doyley, Marvin M. writes:
> >>>
> >>>> Hi there,
> >>>>
> >>>> I am play with John’s ox-word.el function, which us pandoc to convert
> org via latex to docx. However, when I try to use it, I get  the following
> error
> >>>>
> >>>> helm-M-x: Wrong type argument: stringp, nil
> >>>>
> >>>>
> >>>> Any suggestion on how to resolve this issue.
> >>>>
> >>>> Cheers,
> >>>> M
> >>>>
> >>>> Ps Here is the backtrace
> >>>>
> >>>> Debugger entered--Lisp error: (void-function my-other-delete-trailing-
> blank-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))
> (write-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-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 ((output (org-export-as backend subtreep visible-only body-only
> ext-plist))) (let ((temp-buffer (generate-new-buffer " *temp*")))
> (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))))) (if
> (and (org-export--copy-to-kill-ring-p) (org-string-nw-p output)) (progn
> (org-kill-new output))) (or (and (functionp post-process) (funcall
> post-process file)) file))
> >>>> (if async (let ((with-temp-message "Initializing asynchronous export
> process") (current-message)) (unwind-protect (progn (if with-temp-message
> (progn (setq current-message (current-message)) (message "%s"
> with-temp-message))) (let ((--copy-fun (org-export--generate-copy-script
> ...)) (--temp-file (make-temp-file "org-export-process")) (--coding
> buffer-file-coding-system)) (let ((temp-file --temp-file) (temp-buffer
> ...)) (unwind-protect (prog1 ... ...) (and ... ...))) (let*
> ((process-connection-type nil) (--proc-buffer ...) (--process ...))
> (org-export-add-to-stack (get-buffer --proc-buffer) nil --process) (let
> (...) (set-process-sentinel --process ...))))) (and with-temp-message (if
> current-message (message "%s" current-message) (message nil))))) (let
> ((output (org-export-as backend subtreep visible-only body-only
> ext-plist))) (let ((temp-buffer (generate-new-buffer " *temp*")))
> (save-current-buffer (set-buffer temp-buffer) (unwind-protect (progn
> (insert output) (let (...) (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))) (or (and (functionp post-process) (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-system))) (if async (let ((with-temp-message
> "Initializing asynchronous export process") (current-message))
> (unwind-protect (progn (if with-temp-message (progn (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 current-message (message "%s"
> current-message) (message nil))))) (let ((output (org-export-as backend
> subtreep visible-only body-only ext-plist))) (let ((temp-buffer
> (generate-new-buffer " *temp*"))) (save-current-buffer (set-buffer
> temp-buffer) (unwind-protect (progn (insert output) (let ... ...)) (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))) (or (and (functionp post-process) (funcall
> post-process file)) file))))
> >>>> (if (not (file-writable-p file)) (error "Output file not writable")
> (let ((ext-plist (org-combine-plists (list (quote :output-file) file)
> ext-plist)) (encoding (or org-export-coding-system
> buffer-file-coding-system))) (if async (let ((with-temp-message
> "Initializing asynchronous export process") (current-message))
> (unwind-protect (progn (if with-temp-message (progn ... ...)) (let (... ...
> ...) (let ... ...) (let* ... ... ...))) (and with-temp-message (if
> current-message (message "%s" current-message) (message nil))))) (let
> ((output (org-export-as backend subtreep visible-only body-only
> ext-plist))) (let ((temp-buffer (generate-new-buffer " *temp*")))
> (save-current-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) (funcall 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-export-to-file (quote latex) outfile async subtreep visible-only
> body-only ext-plist))
> >>>> org-latex-export-to-latex(nil nil nil nil nil)
> >>>> (let* ((bibfiles (mapcar (quote expand-file-name)
> (org-ref-find-bibliography))) (temp-bib) (bibtex-entries) biboption csl
> (current-file (buffer-file-name)) (basename (file-name-sans-extension
> current-file)) (tex-file (concat basename ".tex")) (docx-file (concat
> basename ".docx"))) (save-buffer) (if bibfiles (progn (setq bibtex-entries
> (let* ((bibtex-files bibfiles) (keys (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-entry-kill-ring "\n\n")) temp-bib (make-temp-file "ox-word-" nil
> ".bib") biboption (format " --bibliography=%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) (insert bibtex-entries)) (save-current-buffer (set-buffer
> temp-buffer) (write-region 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=%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 (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
> (match-part "ox-export-via-latex-pandoc-to-docx-and-open")))
> >>>> funcall-interactively(helm-M-x nil #("ox-export-via-latex-pandoc-to-docx-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)
> >>>
> >>>
> >>> --
> >>> 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=http-3A__
> kitchingroup.cheme.cmu.edu&d=DwIFaQ&c=kbmfwr1Yojg42sGEpaQh5ofMHBeTl9
> EI2eaqQZhHbOU&r=s3_3riAscdqtNAzgOuwYB9g0dZVGcp8BN
> Cy_RylYdxU&m=fpDGKjoBGMLn-IR_Ppzt26Yc5eU8GW50J-DqGll1blc&s=
> jqihIKTRKkfrF9V2SuWfN6RqVs6ghQUh-wXvKohuNi8&e=
> >
> >
> > --
> > 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=http-3A__
> kitchingroup.cheme.cmu.edu&d=DwIFaQ&c=kbmfwr1Yojg42sGEpaQh5ofMHBeTl9
> EI2eaqQZhHbOU&r=s3_3riAscdqtNAzgOuwYB9g0dZVGcp8BNCy_RylYdxU&m=
> Ak2zZPodYjZldCE4XzfFYpSENYzapnBe2-oTIEbBnI4&s=kQj3UIrDBe-
> cf4dsH6pm2x4G8P9a_nOw-uI1_hgatLI&e=
>
>
>

[-- Attachment #1.2: Type: text/html, Size: 16151 bytes --]

[-- Attachment #2: simple_test.docx --]
[-- Type: application/vnd.openxmlformats-officedocument.wordprocessingml.document, Size: 22818 bytes --]

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: exporting org to docx
  2017-06-27 23:21       ` Doyley, Marvin M.
  2017-06-28  0:11         ` John Kitchin
@ 2017-06-28 17:20         ` Doyley, Marvin M.
  1 sibling, 0 replies; 7+ messages in thread
From: Doyley, Marvin M. @ 2017-06-28 17:20 UTC (permalink / raw)
  To: John Kitchin; +Cc: emacs-orgmode@gnu.org

Hi John,

I really appreciate your help. I tried the latest version of ox-word.el that you place in scimax, but got the same error. I suspect that there is a bug in my set-up. 

I will investigate and keep you posted.

Cheers,
M 
> On Jun 27, 2017, at 7:21 PM, Doyley, Marvin M. <m.doyley@rochester.edu> wrote:
> 
> Here is a sample file that I have been using,
> 
> <simple_test.org><simple_test.tex>
>> On Jun 27, 2017, at 10:53 AM, John Kitchin <jkitchin@andrew.cmu.edu> wrote:
>> 
>> 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-bibliography))) (temp-bib) (bibtex-entries) biboption csl (current-file (buffer-file-name)) (basename (file-name-sans-extension current-file)) (tex-file (concat basename ".tex")) (docx-file (concat basename ".docx"))) (save-buffer) (if bibfiles (progn (setq bibtex-entries (let* ((bibtex-files bibfiles) (keys (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-entry-kill-ring "\n\n")) temp-bib (make-temp-file "ox-word-" nil ".bib") biboption (format " --bibliography=%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) (insert bibtex-entries)) (save-current-buffer (set-buffer temp-buffer) (write-region 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=%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 (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 (match-part "ox-export-via-latex-pandoc-to-docx-and-open")))
>>> funcall-interactively(helm-M-x nil #("ox-export-via-latex-pandoc-to-docx-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 <jkitchin@andrew.cmu.edu> wrote:
>>>> 
>>>> what is this function: my-other-delete-trailing-blank-lines
>>>> 
>>>> it appears it is not defined. but is getting called in a before-save-hook.
>>>> 
>>>> Doyley, Marvin M. writes:
>>>> 
>>>>> Hi there,
>>>>> 
>>>>> I am play with John’s ox-word.el function, which us pandoc to convert org via latex to docx. However, when I try to use it, I get  the following error
>>>>> 
>>>>> helm-M-x: Wrong type argument: stringp, nil
>>>>> 
>>>>> 
>>>>> Any suggestion on how to resolve this issue.
>>>>> 
>>>>> Cheers,
>>>>> M
>>>>> 
>>>>> Ps Here is the backtrace
>>>>> 
>>>>> Debugger entered--Lisp error: (void-function my-other-delete-trailing-blank-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)) (write-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-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 ((output (org-export-as backend subtreep visible-only body-only ext-plist))) (let ((temp-buffer (generate-new-buffer " *temp*"))) (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))))) (if (and (org-export--copy-to-kill-ring-p) (org-string-nw-p output)) (progn (org-kill-new output))) (or (and (functionp post-process) (funcall post-process file)) file))
>>>>> (if async (let ((with-temp-message "Initializing asynchronous export process") (current-message)) (unwind-protect (progn (if with-temp-message (progn (setq current-message (current-message)) (message "%s" with-temp-message))) (let ((--copy-fun (org-export--generate-copy-script ...)) (--temp-file (make-temp-file "org-export-process")) (--coding buffer-file-coding-system)) (let ((temp-file --temp-file) (temp-buffer ...)) (unwind-protect (prog1 ... ...) (and ... ...))) (let* ((process-connection-type nil) (--proc-buffer ...) (--process ...)) (org-export-add-to-stack (get-buffer --proc-buffer) nil --process) (let (...) (set-process-sentinel --process ...))))) (and with-temp-message (if current-message (message "%s" current-message) (message nil))))) (let ((output (org-export-as backend subtreep visible-only body-only ext-plist))) (let ((temp-buffer (generate-new-buffer " *temp*"))) (save-current-buffer (set-buffer temp-buffer) (unwind-protect (progn (insert output) (let (...) (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))) (or (and (functionp post-process) (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-system))) (if async (let ((with-temp-message "Initializing asynchronous export process") (current-message)) (unwind-protect (progn (if with-temp-message (progn (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 current-message (message "%s" current-message) (message nil))))) (let ((output (org-export-as backend subtreep visible-only body-only ext-plist))) (let ((temp-buffer (generate-new-buffer " *temp*"))) (save-current-buffer (set-buffer temp-buffer) (unwind-protect (progn (insert output) (let ... ...)) (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))) (or (and (functionp post-process) (funcall post-process file)) file))))
>>>>> (if (not (file-writable-p file)) (error "Output file not writable") (let ((ext-plist (org-combine-plists (list (quote :output-file) file) ext-plist)) (encoding (or org-export-coding-system buffer-file-coding-system))) (if async (let ((with-temp-message "Initializing asynchronous export process") (current-message)) (unwind-protect (progn (if with-temp-message (progn ... ...)) (let (... ... ...) (let ... ...) (let* ... ... ...))) (and with-temp-message (if current-message (message "%s" current-message) (message nil))))) (let ((output (org-export-as backend subtreep visible-only body-only ext-plist))) (let ((temp-buffer (generate-new-buffer " *temp*"))) (save-current-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) (funcall 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-export-to-file (quote latex) outfile async subtreep visible-only body-only ext-plist))
>>>>> org-latex-export-to-latex(nil nil nil nil nil)
>>>>> (let* ((bibfiles (mapcar (quote expand-file-name) (org-ref-find-bibliography))) (temp-bib) (bibtex-entries) biboption csl (current-file (buffer-file-name)) (basename (file-name-sans-extension current-file)) (tex-file (concat basename ".tex")) (docx-file (concat basename ".docx"))) (save-buffer) (if bibfiles (progn (setq bibtex-entries (let* ((bibtex-files bibfiles) (keys (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-entry-kill-ring "\n\n")) temp-bib (make-temp-file "ox-word-" nil ".bib") biboption (format " --bibliography=%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) (insert bibtex-entries)) (save-current-buffer (set-buffer temp-buffer) (write-region 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=%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 (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 (match-part "ox-export-via-latex-pandoc-to-docx-and-open")))
>>>>> funcall-interactively(helm-M-x nil #("ox-export-via-latex-pandoc-to-docx-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)
>>>> 
>>>> 
>>>> --
>>>> 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=http-3A__kitchingroup.cheme.cmu.edu&d=DwIFaQ&c=kbmfwr1Yojg42sGEpaQh5ofMHBeTl9EI2eaqQZhHbOU&r=s3_3riAscdqtNAzgOuwYB9g0dZVGcp8BNCy_RylYdxU&m=fpDGKjoBGMLn-IR_Ppzt26Yc5eU8GW50J-DqGll1blc&s=jqihIKTRKkfrF9V2SuWfN6RqVs6ghQUh-wXvKohuNi8&e=
>> 
>> 
>> --
>> 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=http-3A__kitchingroup.cheme.cmu.edu&d=DwIFaQ&c=kbmfwr1Yojg42sGEpaQh5ofMHBeTl9EI2eaqQZhHbOU&r=s3_3riAscdqtNAzgOuwYB9g0dZVGcp8BNCy_RylYdxU&m=Ak2zZPodYjZldCE4XzfFYpSENYzapnBe2-oTIEbBnI4&s=kQj3UIrDBe-cf4dsH6pm2x4G8P9a_nOw-uI1_hgatLI&e=
> 


^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2017-06-28 17:20 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-06-24 15:23 exporting org to docx Doyley, Marvin M.
2017-06-24 17:07 ` John Kitchin
2017-06-24 18:08   ` Doyley, Marvin M.
2017-06-27 14:53     ` John Kitchin
2017-06-27 23:21       ` Doyley, Marvin M.
2017-06-28  0:11         ` John Kitchin
2017-06-28 17:20         ` Doyley, Marvin M.

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).