From mboxrd@z Thu Jan 1 00:00:00 1970 From: Vincent Beffara Subject: Problem with org-html-format-latex Date: Thu, 7 Feb 2013 16:44:19 +0100 Message-ID: <20E4E4D8E34D465D9CF893C7EE0BBEFC@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Return-path: Received: from eggs.gnu.org ([208.118.235.92]:55766) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1U3cGb-0005ea-TS for emacs-orgmode@gnu.org; Thu, 07 Feb 2013 19:56:38 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1U3cGa-00074U-OF for emacs-orgmode@gnu.org; Thu, 07 Feb 2013 19:56:37 -0500 Received: from mail-wg0-f53.google.com ([74.125.82.53]:33480) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1U3Te9-0002Ny-Ui for emacs-orgmode@gnu.org; Thu, 07 Feb 2013 10:44:22 -0500 Received: by mail-wg0-f53.google.com with SMTP id fn15so2188584wgb.32 for ; Thu, 07 Feb 2013 07:44:21 -0800 (PST) Content-Disposition: inline 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 List Hi, Trying out the new exporter and hoping to have it work with o-blog ... A bug occurs with org-html-format-latex (in ox-html.el) when called from a non-file buffer. In the context of o-blog, it gets called as (org-html-format-latex "$x$" 'mathjax) but still tries to bind some ltxpng related support. This ends up calling file-name-sans-extension to the output of (file-name-nondirectory (buffer-file-name)) which is nil ... Crashing in such a case makes sense for ltxpng but not for mathjax. This makes it work: diff --git a/lisp/ox-html.el b/lisp/ox-html.el index f4fc27b..03e09aa 100644 --- a/lisp/ox-html.el +++ b/lisp/ox-html.el @@ -1994,8 +1994,8 @@ CONTENTS is nil. INFO is a plist holding contextual information." (defun org-html-format-latex (latex-frag processing-type) (let* ((cache-relpath (concat "ltxpng/" (file-name-sans-extension - (file-name-nondirectory (buffer-file-name))))) - (cache-dir (file-name-directory (buffer-file-name ))) + (file-name-nondirectory (or (buffer-file-name) ""))))) + (cache-dir (file-name-directory (or (buffer-file-name) ""))) (display-msg "Creating LaTeX Image...")) (with-temp-buffer but feels like the wrong solution, probably cache-relpath and cache-dir should be set to nil in such a case ... Regards, /v -- Vincent Beffara