From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp2.migadu.com ([2001:41d0:303:e16b::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms1.migadu.com with LMTPS id EBRGIiNrM2YQuwAAe85BDQ:P1 (envelope-from ) for ; Thu, 02 May 2024 12:29:55 +0200 Received: from aspmx1.migadu.com ([2001:41d0:303:e16b::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp2.migadu.com with LMTPS id EBRGIiNrM2YQuwAAe85BDQ (envelope-from ) for ; Thu, 02 May 2024 12:29:55 +0200 X-Envelope-To: larch@yhetil.org Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=posteo.net header.s=2017 header.b=dal9gg2y; spf=pass (aspmx1.migadu.com: domain of "emacs-orgmode-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="emacs-orgmode-bounces+larch=yhetil.org@gnu.org"; dmarc=pass (policy=none) header.from=posteo.net ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1714645795; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:in-reply-to:in-reply-to: references:references:list-id:list-help:list-unsubscribe: list-subscribe:list-post:dkim-signature; bh=F/BHuth6y4jtN1c66X2CorBvWhY7dVayb3VfuAmhl6w=; b=D5SdHl2qbhaAxqWWUurKfKeRzln3nOQ5nL92YqvnA0k58Ex5Xa4hLpJNMIAtU0nyg6hl8w TKmOxvM4RtOEkmyB52vmRDHgqBMAv91nJ+ihz4IYZkgEkTlaevPrwgIjeM9GwSvq46Oub3 VKf0661g6Jzo7lrvnSawSJu/4VuWYymX3Y9wga3ReNE3OykRnuqCPWKQz4zH2FLlydEjHC LPtlKk+btlLs2cEUKWb1MImQkHMbM0e6KUgBWA3QiWmbdgMAPncHtUprIcPpExMA4UNbPY QQ+qUSpntRwwC76f7hia9vGsXhElCciaQeDJXjjpfjMOaMixMBrkM0thcjd4JQ== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=posteo.net header.s=2017 header.b=dal9gg2y; spf=pass (aspmx1.migadu.com: domain of "emacs-orgmode-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="emacs-orgmode-bounces+larch=yhetil.org@gnu.org"; dmarc=pass (policy=none) header.from=posteo.net ARC-Seal: i=1; s=key1; d=yhetil.org; t=1714645795; a=rsa-sha256; cv=none; b=ENxLG9Ptcs/9aKENVocK+McDg6JkehHjHE1umx82NZ7jXjwUh2kxDYYX3u8CZ/gpNvDMbX jLgB6jVx4dkZ8W4OQ8HL7EoAIJ4Xjfbtw6nMxwNa01j90cbAAS36wlpiBsgqL75mNop6hL /SVkjSiOTgH9eEpruuDtEoq1qU6fW1HxmHK2bp//a7BKYek5WuthDjdvPYcycYDBlNfo6x 7Kg2euqaSdfpiRfk3libuL4joaLs+rj72F3G7+frsSnG/jR13p4EtKZfUll9Mjpl4L3s9l CIALYw/rzy1RR/lgYdTEpTs39czV927Hx9nbzaFMqA/nfdlLQMm515Z/+EIpXA== Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id 58F8615F05 for ; Thu, 2 May 2024 12:29:55 +0200 (CEST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1s2Tgc-0006hj-Sm; Thu, 02 May 2024 06:29:10 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1s2Tga-0006gq-KP for emacs-orgmode@gnu.org; Thu, 02 May 2024 06:29:08 -0400 Received: from mout01.posteo.de ([185.67.36.65]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1s2TgY-0006bP-F1 for emacs-orgmode@gnu.org; Thu, 02 May 2024 06:29:08 -0400 Received: from submission (posteo.de [185.67.36.169]) by mout01.posteo.de (Postfix) with ESMTPS id 082A8240029 for ; Thu, 2 May 2024 12:29:04 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017; t=1714645744; bh=0dMXib8HDEdT6hsIRedgRoyKg04GnDT4L/tDcY62TEY=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version:Content-Type: From; b=dal9gg2y4dPnLYYQQBPeacrAhmRdztvlBRyOZwwcNtiNOihr3/EC4oD9G21Jnuft9 wBLdjs9qFQ+D4jCrVrLhy9vdZ2ap0rivIzeUm6O9YBKnRXXmcnsGK0jjrrxmASHKAL aDmGtN9086kNlgpKvBZk0/urWJUu/4PPCxiNR6NZiNclQuMfjZ5nEzlxH/VvjsEV1N AU+zKvdfC2MjMwnbCHaYJW+XHb8Ld0tRH00NQOxo971sCaQ7pyITe1bqs28qTspz/d b/dfsWZvcqU4WCEMUktuQ6IbnkmbPTWeJaG4e1jOdnSz+dGDJncomSD7TlYjFeeJ9D KIcA/WHQz8tmQ== Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 4VVVXb1rKwz6twM; Thu, 2 May 2024 12:29:03 +0200 (CEST) From: Ihor Radchenko To: Emmanuel Charpentier Cc: emacs-orgmode@gnu.org Subject: Re: [BUG] LaTeX preview should use a subdirectory in /tmp In-Reply-To: <59096bd365ccf1cb3ec2b45b0f2ecb5c508ded34.camel@free.fr> References: <70491d4bb65173aef34296dd71d7a1e55872bf26.camel@free.fr> <87frvkaqat.fsf@localhost> <59096bd365ccf1cb3ec2b45b0f2ecb5c508ded34.camel@free.fr> Date: Thu, 02 May 2024 10:30:14 +0000 Message-ID: <87edakbj61.fsf@localhost> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Received-SPF: pass client-ip=185.67.36.65; envelope-from=yantar92@posteo.net; helo=mout01.posteo.de X-Spam_score_int: -43 X-Spam_score: -4.4 X-Spam_bar: ---- X-Spam_report: (-4.4 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_MED=-2.3, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-orgmode@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+larch=yhetil.org@gnu.org Sender: emacs-orgmode-bounces+larch=yhetil.org@gnu.org X-Migadu-Flow: FLOW_IN X-Migadu-Country: US X-Migadu-Spam-Score: -9.60 X-Spam-Score: -9.60 X-Migadu-Queue-Id: 58F8615F05 X-Migadu-Scanner: mx13.migadu.com X-TUID: 0PByARvibTbs --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Emmanuel Charpentier writes: >> (plist-put (alist-get 'dvipng org-preview-latex-process-alist) >> =C2=A0=C2=A0 :image-converter >> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 '("dvipng -= D %D -T tight -o %O %F")) > > Nope, same problem : the *Org Preview LaTeX Output* buffer says : > > ../../../../../tmp/orgtexSyy18r.dvi: No such file or directory > This is dvipng 1.15 Copyright 2002-2015 Jan-Ake Larsson > > If I understand it correctly, the %F placeholder should be an > *absolute* filename. It is not... May you try the attached patch? I changed the default command templates to use absolute paths everywhere. --=-=-= Content-Type: text/x-patch Content-Disposition: inline; filename=0001-org-preview-latex-process-alist-Work-around-relative.patch >From 7ac1aacb977ded45dc713b24e18d9068baaa5148 Mon Sep 17 00:00:00 2001 Message-ID: <7ac1aacb977ded45dc713b24e18d9068baaa5148.1714645744.git.yantar92@posteo.net> From: Ihor Radchenko Date: Thu, 2 May 2024 13:19:37 +0300 Subject: [PATCH] org-preview-latex-process-alist: Work around relative path oddities in WSL * lisp/org-macs.el (org-compile-file-commands): Add new allowed placeholder %P - absolute path to output dir. * lisp/org.el (org-preview-latex-process-alist): Use absolute paths in commands. List all the allowed placeholders in the docstring. Reported-by: Emmanuel Charpentier Link: https://orgmode.org/list/87zftr4uaj.fsf@localhost --- lisp/org-macs.el | 18 ++++++++++-------- lisp/org.el | 18 ++++++++++-------- 2 files changed, 20 insertions(+), 16 deletions(-) diff --git a/lisp/org-macs.el b/lisp/org-macs.el index 1254ddb54..53dc75425 100644 --- a/lisp/org-macs.el +++ b/lisp/org-macs.el @@ -1690,12 +1690,12 @@ (defun org-compile-file-commands (source process ext &optional spec err-msg) the SOURCE file. If PROCESS is a list of commands, each of them is called using -`shell-command'. By default, in each command, %b, %f, %F, %o and -%O are replaced with, respectively, SOURCE base name, relative -file name, absolute file name, relative directory and absolute -output file name. It is possible, however, to use more -place-holders by specifying them in optional argument SPEC, as an -alist following the pattern +`shell-command'. By default, in each command, %b, %f, %F, %o, %P, and +%O are replaced with, respectively, SOURCE base name, relative file +name, absolute file name, relative output directory, absolute output +directory, and absolute output file name. It is possible, however, to +use more place-holders by specifying them in optional argument SPEC, +as an alist following the pattern (CHARACTER . REPLACEMENT-STRING). @@ -1707,9 +1707,10 @@ (defun org-compile-file-commands (source process ext &optional spec err-msg) (pwd (file-truename default-directory)) (absname (expand-file-name source pwd)) (relname (if (file-name-absolute-p source) - (file-relative-name source pwd) - source)) + (file-relative-name source pwd) + source)) (relpath (or (file-name-directory relname) "./")) + (abspath (expand-file-name relpath)) (output (concat (file-name-sans-extension absname) "." ext)) (err-msg (if (stringp err-msg) (concat ". " err-msg) ""))) (pcase process @@ -1720,6 +1721,7 @@ (defun org-compile-file-commands (source process ext &optional spec err-msg) (?f . ,(shell-quote-argument relname)) (?F . ,(shell-quote-argument absname)) (?o . ,(shell-quote-argument relpath)) + (?P . ,(shell-quote-argument abspath)) (?O . ,(shell-quote-argument output)))))) (mapcar (lambda (command) (format-spec command spec)) process))) (_ (error "No valid command to process %S%s" source err-msg))))) diff --git a/lisp/org.el b/lisp/org.el index 809fd8ba3..1c78c2024 100644 --- a/lisp/org.el +++ b/lisp/org.el @@ -3326,10 +3326,10 @@ (defcustom org-preview-latex-process-alist :image-input-type "dvi" :image-output-type "png" :image-size-adjust (1.0 . 1.0) - :latex-compiler ("latex -interaction nonstopmode -output-directory %o %f") - :image-converter ("dvipng -D %D -T tight -o %O %f") + :latex-compiler ("latex -interaction nonstopmode -output-directory %P %F") + :image-converter ("dvipng -D %D -T tight -o %O %F") :transparent-image-converter - ("dvipng -D %D -T tight -bg Transparent -o %O %f")) + ("dvipng -D %D -T tight -bg Transparent -o %O %F")) (dvisvgm :programs ("latex" "dvisvgm") :description "dvi > svg" @@ -3337,7 +3337,7 @@ (defcustom org-preview-latex-process-alist :image-input-type "dvi" :image-output-type "svg" :image-size-adjust (1.7 . 1.5) - :latex-compiler ("latex -interaction nonstopmode -output-directory %o %f") + :latex-compiler ("latex -interaction nonstopmode -output-directory %P %F") :image-converter ("dvisvgm %f --no-fonts --exact-bbox --scale=%S --output=%O")) (imagemagick :programs ("latex" "convert") @@ -3346,9 +3346,9 @@ (defcustom org-preview-latex-process-alist :image-input-type "pdf" :image-output-type "png" :image-size-adjust (1.0 . 1.0) - :latex-compiler ("pdflatex -interaction nonstopmode -output-directory %o %f") + :latex-compiler ("pdflatex -interaction nonstopmode -output-directory %P %F") :image-converter - ("convert -density %D -trim -antialias %f -quality 100 %O"))) + ("convert -density %D -trim -antialias %F -quality 100 %O"))) "Definitions of external processes for LaTeX previewing. Org mode can use some external commands to generate TeX snippet's images for previewing or inserting into HTML files, e.g., \"dvipng\". This variable tells @@ -3389,9 +3389,11 @@ (defcustom org-preview-latex-process-alist Place-holders used by `:image-converter' and `:latex-compiler': - %f input file name + %f input file name (relative) + %F input file name (absolute) %b base name of input file - %o base directory of input file + %o base directory of input file (relative) + %P base directory of input file (absolute) %O absolute output file name Place-holders only used by `:image-converter': -- 2.44.0 --=-=-= Content-Type: text/plain -- Ihor Radchenko // yantar92, Org mode contributor, Learn more about Org mode at . Support Org development at , or support my work at --=-=-=--