From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp0.migadu.com ([2001:41d0:403:58f0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms1.migadu.com with LMTPS id 4Og0B5rcJWY+JAAAqHPOHw:P1 (envelope-from ) for ; Mon, 22 Apr 2024 05:42:18 +0200 Received: from aspmx1.migadu.com ([2001:41d0:403:58f0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp0.migadu.com with LMTPS id 4Og0B5rcJWY+JAAAqHPOHw (envelope-from ) for ; Mon, 22 Apr 2024 05:42:18 +0200 X-Envelope-To: larch@yhetil.org Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=IMcfMfO5; dmarc=pass (policy=none) header.from=gmail.com; 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" ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1713757338; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post:dkim-signature; bh=VypFu8bCNxiTL0tMG8LcyocPz7YXlxMOYgFrTLf0i3Y=; b=RUMEBZyjWOdJGAzQBDq9H3xTAEmSuOS4GLG9sbVknR/rvIm8+fBDKOHvip3debTN8KFqBw nVKxDTiyTN/fmYuhG4AsmYNYfwGDxrG0CG3D4qMci4dRPO9eFu6Vk7l1B83lhCre9ilul/ +ZM5BJyj5F+PN4SmakKV/sl28OVt6vGqmPrGkzU1uQPexsxIVX6IGx7VgV3Fp7A8lUIbuh 1OyMWcr3TicOtdIERcalKw6DgjWnMrWE5E7cWFJpBFGNJnGsl+SJTA5FB/hnaH5mj5knXQ gMmQkTu2ZgDtnV2Cm8Knmxkh5go8VNsd807TaA+Xli+opmYWHpCndE21gA0Iag== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=IMcfMfO5; dmarc=pass (policy=none) header.from=gmail.com; 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" ARC-Seal: i=1; s=key1; d=yhetil.org; t=1713757338; a=rsa-sha256; cv=none; b=XAI8FOF+sF35053otPN2FigMZ3Q0O3P/9Kh1MUHZuDLl/VyB9YnODjKH48jSs9C06Vp/6q VEsKz01JFWEyOdKicC16vjkvQrU28KBLoa2X/R56DHwhV297ku1lldojkqlWX62yqpL/I1 D37CRZKqyKWZ/jNSOfVMr3ScJEa2kWWZdsB5gn/sRYaB8t0LGRzW5iOI4j6kX+PRMGaGAx ZfGtAzLPZrHfShkhxsJL0DvKULuf329j7MZNBxAThqTh8PL9oChQz1gz2VNvarWsDGjCQO YltiKU3X9IEVypEMChPynXUTdJuyFF8kG1g22dA1EnD75t6DgGiGGCnTWeGIwQ== 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 DC18B7F17 for ; Mon, 22 Apr 2024 05:42:17 +0200 (CEST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rykYa-00073c-HI; Sun, 21 Apr 2024 23:41:28 -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 1rykYV-00073F-FC for emacs-orgmode@gnu.org; Sun, 21 Apr 2024 23:41:23 -0400 Received: from mail-pl1-x62a.google.com ([2607:f8b0:4864:20::62a]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rykYR-0007U9-BT for emacs-orgmode@gnu.org; Sun, 21 Apr 2024 23:41:20 -0400 Received: by mail-pl1-x62a.google.com with SMTP id d9443c01a7336-1e8fce77bb2so15090095ad.0 for ; Sun, 21 Apr 2024 20:41:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1713757277; x=1714362077; darn=gnu.org; h=content-transfer-encoding:mime-version:message-id:date:references :in-reply-to:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=VypFu8bCNxiTL0tMG8LcyocPz7YXlxMOYgFrTLf0i3Y=; b=IMcfMfO5JmDdxtq25E6FfvwzT08vlCiG8pHSgz+anlMk/ahnwgIho8DJsuj2CCQbXO R1ugiQciGbxPYIdxgV/shxJEBSvGq13wbhB5uvVmIsXuUbxCgQykiMn+CoJrj+aY67IF zfepvQq/+Z/RLnCrx8s3nYlePZRMFG36I21i9XHkz9Wh1r/iX8R27bmfDa7hERIHUQmL 2AX78zDMfeGTdfiJklM0q/ydU237/nMXSYzKhUcaY1ZwOiQJn8u42dlVJmuiWDp4hKkg Djwc9DKt1cPJkB/WES40bcLUPSkmA6BhPzUhup3UIRiguHjIjcLeeDwavU9nteOI4Ra/ Dxuw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1713757277; x=1714362077; h=content-transfer-encoding:mime-version:message-id:date:references :in-reply-to:subject:to:from:x-gm-message-state:from:to:cc:subject :date:message-id:reply-to; bh=VypFu8bCNxiTL0tMG8LcyocPz7YXlxMOYgFrTLf0i3Y=; b=Gdatm5tLBeOxfeoFC/NOyeFgRHjRmjfUPhkld1f/+iuelKlOyafRQt6xvWh97a/kZ0 lfTRflWe2qL7VSzt0tptRXS2Mk4FZ22UDGLGJscNqkpiO4UMbzc7HrMDFcpuFvSDlmQ6 Lq9kV05MExOh3xgupIOKCV8Vdi5dI9eZILSH//1GiwOrOyV+yEJUM0Gyf7aDi6+7esDo jUExfN4DeR/ugHPIVOxfEihrVyauRVGkXf2aqlFZMfbvaIlIZYiLpoNwAAOLwurhCZII boNDYsRK1/srmj65dSsM8cmFKhxfITJ5euJO52CApN5R5HQNz6UXanGP2rSa25GRYECS ZECA== X-Forwarded-Encrypted: i=1; AJvYcCXTjaQHPmHrL9zqkXijmcFExPE+EmJOYwUSra6Y1KFp+vdazE7639OYRUPyZkKOz3cKMUaynVkpWpEmH4BaVpX1NiaG81s= X-Gm-Message-State: AOJu0YzyEP5sgKN7b0JQbXGePLFtrEiCmKoz0UzeKJAwJ67L4Q1cmoKZ I2BE5J+SYC2P8V43CGr9gjkBVu/xGgZFPnPOFIswGFmOOOA9ei75wXUwaA== X-Google-Smtp-Source: AGHT+IFzAhKmGZl5rtNDKau7U+0ceJuP36BS83hqAEs4Qw86FzPMi1ENeD4TCnrKJPcYRhMb1jkBpQ== X-Received: by 2002:a17:902:ee84:b0:1e5:9d4:9bb4 with SMTP id a4-20020a170902ee8400b001e509d49bb4mr9513889pld.66.1713757276623; Sun, 21 Apr 2024 20:41:16 -0700 (PDT) Received: from localhost ([2600:8802:5726:2500:7418:4c25:6f2:70bb]) by smtp.gmail.com with ESMTPSA id jb11-20020a170903258b00b001e249903b0fsm7013505plb.256.2024.04.21.20.41.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 21 Apr 2024 20:41:15 -0700 (PDT) From: Karthik Chikmagalur To: Tony Zorman , emacs-orgmode@gnu.org Subject: Re: Using org-latex-preview in other major modes In-Reply-To: <87cyqi8rb6.fsf@hyperspace> References: <87edbhljr7.fsf@hyperspace> <874jcdf4hj.fsf@gmail.com> <87wmp8l6dg.fsf@hyperspace> <87y19oe4yd.fsf@gmail.com> <87cyqyqp1w.fsf@hyperspace> <87cyqi8rb6.fsf@hyperspace> Date: Sun, 21 Apr 2024 20:41:15 -0700 Message-ID: <87o7a2gj38.fsf@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Received-SPF: pass client-ip=2607:f8b0:4864:20::62a; envelope-from=karthikchikmagalur@gmail.com; helo=mail-pl1-x62a.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 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, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, 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.69 X-Migadu-Scanner: mx11.migadu.com X-Spam-Score: -9.69 X-Migadu-Queue-Id: DC18B7F17 X-TUID: 1pslEpqzqV5R > Anyways, before I put this off for much longer, there is some more code > attached. Live previews (and general environments) work now, and besides > the above mentioned points there were no new surprises waiting=E2=80=94at= least > for getting the basic functionality to work. Thank you for the update! This looks promising. I'll test it when I have time. > I did notice that precompilation being a bit flaky. In the end, this > was the result of importing local packages; with the precompilation > happening somewhere in /tmp/, access to these files wasn't given. > haven't looked too closely into this=E2=80=94and it's probably a use-case > that's specific to LaTeX-mode=E2=80=94but it seems worth considering Sorry, I should have mentioned this in my original write-up. There is a reason for this, as explained below. This issue should not be happening in most cases though, so I'll need more details to help. > (lots of people carry one big style file around that they include in > all of their projects). This is true of Org mode files that are intended for LaTeX export too, but we avoid this problem in Org. 1. Why we precompile in /tmp: Precompilation is a blocking operation, so we want to do it as infrequently as possible. Imagine if LaTeX previews in every Org buffer/file you opened required a precompile step that blocked Emacs for 3 seconds. Precompiled dump files are identified by a hash that includes the preamble and a default-directory. If we precompile in /tmp (or some other fixed directory), we can reuse dump files for all Org buffers that have the same preamble, irrespective of where they're located. Precompiled files are stored in org-persist and don't expire for a long time. So we'd like to avoid generating loads of them, and reuse them whenever possible. 1a. Why is precompilation a blocking operation? It doesn't have to be, but including it in the async chain is a little annoying. It can be made async in the future. 2. What happens if the user includes a directory-local .sty, .cls or other tex files in the header? When precompiling, we check the header to see if it has an \input{} or \include{} statement. If it does, we assume that there are local dependencies and precompile it in the default-directory. See org-latex-preview--create-tex-file for the implementation of this logic. Is there some other common way that a LaTeX file can have local dependencies? 3. How to force precompilation to occur in the default-directory instead of in /tmp: Based on 1 and 2, the easiest way would be to add an \input{} or \include{} statement to the preamble. The current test is very simple, you can even place it in a LaTeX comment and it should work. Karthik