emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: John Kitchin <jkitchin@andrew.cmu.edu>
To: "Doyley, Marvin M." <m.doyley@rochester.edu>
Cc: "emacs-orgmode@gnu.org" <emacs-orgmode@gnu.org>
Subject: Re: exporting org to docx
Date: Sat, 24 Jun 2017 13:07:36 -0400	[thread overview]
Message-ID: <m2fuepuxev.fsf@andrew.cmu.edu> (raw)
In-Reply-To: <3ECD3A60-C8B0-4EA9-9A79-C4DDF133E870@ur.rochester.edu>

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

  reply	other threads:[~2017-06-24 17:07 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-06-24 15:23 exporting org to docx Doyley, Marvin M.
2017-06-24 17:07 ` John Kitchin [this message]
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.

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=m2fuepuxev.fsf@andrew.cmu.edu \
    --to=jkitchin@andrew.cmu.edu \
    --cc=emacs-orgmode@gnu.org \
    --cc=m.doyley@rochester.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).