From mboxrd@z Thu Jan 1 00:00:00 1970 From: Erik Hetzner Subject: export to temporary HTML file and open Date: Wed, 12 Feb 2014 18:37:27 -0800 Message-ID: <87txc3ivq0.wl%egh@e6h.org> Reply-To: Erik Hetzner Mime-Version: 1.0 (generated by SEMI-EPG 1.14.7 - "Harue") Content-Type: text/plain; charset=ISO-8859-7 Content-Transfer-Encoding: quoted-printable Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:57316) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WDmBI-0004qR-JV for emacs-orgmode@gnu.org; Wed, 12 Feb 2014 21:37:46 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WDmBD-0003JL-0A for emacs-orgmode@gnu.org; Wed, 12 Feb 2014 21:37:40 -0500 Received: from mail-pd0-x22f.google.com ([2607:f8b0:400e:c02::22f]:62675) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WDmBC-0003JB-Ol for emacs-orgmode@gnu.org; Wed, 12 Feb 2014 21:37:34 -0500 Received: by mail-pd0-f175.google.com with SMTP id w10so9845781pde.34 for ; Wed, 12 Feb 2014 18:37:33 -0800 (PST) Received: from michel.e6h.org (50-0-83-149.dsl.static.sonic.net. [50.0.83.149]) by mx.google.com with ESMTPSA id ss2sm2515201pab.8.2014.02.12.18.37.31 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Wed, 12 Feb 2014 18:37:31 -0800 (PST) List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: Org Mode Hi all, This may be of some interest to list members, and possibly for org mode itself. I find myself wanting to get a nice view of org files, for printing or otherwise, and would like to export to HTML. But I don=A2t want to have a bunch of HTML files in my org directory. Here is a hack to allow you to export to a temporary HTML file and open in a browser, for when you don=A2t want to create an HTML file in your org directory. best, Erik (defun org-html-export-to-temp-file (&optional async subtreep visible-only body-only ext-plist) "Export current buffer to a temporary HTML file. 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 \"\" and \"\" 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 "." org-html-extension)) (file (make-temp-file "org-export" nil extension)) (org-export-coding-system org-html-coding-system)) (org-export-to-file 'html file async subtreep visible-only body-only ext-plist))) (org-export-define-derived-backend 'html-temp 'html :menu-entry=20 '(?h 2 ((?t "As temporary HTML file and open" (lambda (a s v b) (if a (org-html-export-to-temp-file t s v b) (org-open-file (org-html-export-to-temp-file nil s v b)))))))) --=20 Sent from my free software system .