From mboxrd@z Thu Jan 1 00:00:00 1970 From: Carlo Nucera Subject: [PATCH]: Fix latex image bug in org-mime-org-buffer-htmlize Date: Sat, 11 Jun 2016 01:32:47 +0200 Message-ID: Mime-Version: 1.0 Content-Type: multipart/mixed; boundary=001a113bcfdadaf6580534f4f433 Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:46772) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bBVv0-0002wK-8O for emacs-orgmode@gnu.org; Fri, 10 Jun 2016 19:32:51 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bBVuz-0005fH-2V for emacs-orgmode@gnu.org; Fri, 10 Jun 2016 19:32:50 -0400 Received: from mail-yw0-x235.google.com ([2607:f8b0:4002:c05::235]:32793) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bBVuy-0005fC-U1 for emacs-orgmode@gnu.org; Fri, 10 Jun 2016 19:32:49 -0400 Received: by mail-yw0-x235.google.com with SMTP id g20so80167867ywb.0 for ; Fri, 10 Jun 2016 16:32:48 -0700 (PDT) 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" To: emacs-orgmode@gnu.org --001a113bcfdadaf6580534f4f433 Content-Type: text/plain; charset=UTF-8 Hi, attached is a patch that should fix a bug in the function org-mime-org-buffer-htmlize (thanks to punchagan on irc!). When exporting an org buffer with a latex snippet including the org option tex: dvipng the images were always created in /tmp/ltxpng/, but the reported link in the htmlized buffer was the local ./ltxpng folder; so, unless the org file to htmlize was actually in /tmp, the user got an error saying that the image could not be found. This was caused by the two different ways in which the function org-mime-replace-images is used inside of org-mime-org-buffer-htmlize and org-mime-htmlize. To correct the problem, the function org-mime-replace-images doesn't take anymore the current-file parameter (that was only used to get its directory) and instead always creates a temporary directory using temporary-file-directory. Keep up the good work! Carlo Nucera --001a113bcfdadaf6580534f4f433 Content-Type: text/x-patch; charset=US-ASCII; name="0001-Fix-latex-image-bug-in-org-mime-org-buffer-htmlize.patch" Content-Disposition: attachment; filename="0001-Fix-latex-image-bug-in-org-mime-org-buffer-htmlize.patch" Content-Transfer-Encoding: base64 X-Attachment-Id: f_ipadas3g0 RnJvbSBlOGRjZjk5OTY0ODEwNTNkYTg1NmNkNjY4NDg5OGNmZjI4ZGYwMjEzIE1vbiBTZXAgMTcg MDA6MDA6MDAgMjAwMQpGcm9tOiBtZWRpdGFucyA8bWVkaXRhbnNAZ21haWwuY29tPgpEYXRlOiBG cmksIDEwIEp1biAyMDE2IDIzOjMyOjA1ICswMjAwClN1YmplY3Q6IFtQQVRDSF0gRml4IGxhdGV4 IGltYWdlIGJ1ZyBpbiBvcmctbWltZS1vcmctYnVmZmVyLWh0bWxpemUKCldoZW4gZXhwb3J0aW5n IGFuIG9yZyBidWZmZXIgd2l0aCBhIGxhdGV4IHNuaXBwZXQgaW5jbHVkaW5nIHRoZSBvcmcKb3B0 aW9uIHRleDogZHZpcG5nIHRoZSBpbWFnZXMgd2VyZSBhbHdheXMgY3JlYXRlZCBpbiAvdG1wL2x0 eHBuZy8sIGJ1dAp0aGUgcmVwb3J0ZWQgbGluayBpbiB0aGUgaHRtbGl6ZWQgYnVmZmVyIHdhcyB0 aGUgbG9jYWwgLi9sdHhwbmcgZm9sZGVyOwpzbywgdW5sZXNzIHRoZSBvcmcgZmlsZSB0byBodG1s aXplIHdhcyBhY3R1YWxseSBpbiAvdG1wLCB0aGUgdXNlciBnb3QgYW4KZXJyb3Igc2F5aW5nIHRo YXQgdGhlIGltYWdlIGNvdWxkIG5vdCBiZSBmb3VuZC4KClRoaXMgd2FzIGNhdXNlZCBieSB0aGUg dHdvIGRpZmZlcmVudCB3YXlzIGluIHdoaWNoIHRoZSBmdW5jdGlvbgpvcmctbWltZS1yZXBsYWNl LWltYWdlcyBpcyB1c2VkIGluc2lkZSBvZiBvcmctb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2VzKQogICAgIChjb25z CkBAIC0xODUsNyArMTg1LDcgQEAgYW5kIGltYWdlcyBpbiBhIG11bHRpcGFydC9yZWxhdGVkIHBh cnQuIgogICAgICAgICAgKGxldCogKCh1cmwgKGFuZCAoc3RyaW5nLW1hdGNoICJzcmM9XCJcXChb XlwiXStcXClcIiIgdGV4dCkKICAgICAgICAgICAgICAgICAgICAgICAgICAgKG1hdGNoLXN0cmlu ZyAxIHRleHQpKSkKICAgICAgICAgICAgICAgICAocGF0aCAoZXhwYW5kLWZpbGUtbmFtZQotICAg ICAgICAgICAgICAgICAgICAgICB1cmwgKGZpbGUtbmFtZS1kaXJlY3RvcnkgY3VycmVudC1maWxl KSkpCisgICAgICAgICAgICAgICAgICAgICAgIHVybCB0ZW1wb3JhcnktZmlsZS1kaXJlY3Rvcnkp KQogICAgICAgICAgICAgICAgIChleHQgKGZpbGUtbmFtZS1leHRlbnNpb24gcGF0aCkpCiAgICAg ICAgICAgICAgICAgKGlkIChyZXBsYWNlLXJlZ2V4cC1pbi1zdHJpbmcgIltcL1xcXFxdIiAiXyIg cGF0aCkpKQogICAgICAgICAgICAoYWRkLXRvLWxpc3QgJ2h0bWwtaW1hZ2VzCkBAIC0yMTIsOCAr MjEyLDYgQEAgb3RoZXJ3aXNlIGV4cG9ydCB0aGUgZW50aXJlIGJvZHkuIgogICAgICAgICAgICAg ICAgICAgICAgICAocG9pbnQtbWF4KSkpCiAgICAgICAgICAocmF3LWJvZHkgKGNvbmNhdCBvcmct bWltZS1kZWZhdWx0LWhlYWRlcgogCQkJICAgKGJ1ZmZlci1zdWJzdHJpbmcgaHRtbC1zdGFydCBo dG1sLWVuZCkpKQotICAgICAgICAgKHRtcC1maWxlIChtYWtlLXRlbXAtbmFtZSAoZXhwYW5kLWZp bGUtbmFtZQotCQkJCSAgICAibWFpbCIgdGVtcG9yYXJ5LWZpbGUtZGlyZWN0b3J5KSkpCiAgICAg ICAgICAoYm9keSAob3JnLWV4cG9ydC1zdHJpbmctYX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