Exporting org-files to a temporary location

I have a private journal, which lives in an encrypted file in a Dropbox-backed-up directory. I use html export to examine the contents sometimes – there are some big old tables that are hard to read in org-mode – but I don’t want the html file to end up in Dropbox.

So I just copied the definition of org-export-html-as-html and made trivial modifications. There’s probably a better way to do this.

;; export html to tmp dir
(defun mwp-org-html-to-tmp
    (&optional async subtreep visible-only body-only ext-plist)
  "Export current buffer to a HTML file in the tmp directory.

If narrowing is active in the current buffer, only export its narrowed part.

If a region is active, export that region.

A non-nil optional argument ASYNC means the process should happen asynchronously. The resulting file should be accessible through the `org-export-stack' interface.

When optional argument SUBTREEP is non-nil, export the sub-tree at point, extracting information from the headline properties first.

When optional argument VISIBLE-ONLY is non-nil, don’t export contents of hidden elements.

When optional argument BODY-ONLY is non-nil, only write code between "<body>" and "</body>" tags.

EXT-PLIST, when provided, is a property list with external parameters overriding Org default settings, but still inferior to file-local settings.

Return output file’s name." (interactive) (let* ((extension (concat "." (or (plist-get ext-plist :html-extension) org-html-extension “html”))) ;; this is the code I’ve changed from the original function. (file (org-export-output-file-name extension subtreep "/home/matt/tmp/"))

     (org-export-coding-system org-html-coding-system))
(org-export-to-file 'html file
  async subtreep visible-only body-only ext-plist)
(org-open-file file)))

(org-defkey org-mode-map (kbd “C-c 0”) ‘mwp-org-html-to-tmp)

Last modified: 11 July 2015