From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp0.migadu.com ([2001:41d0:303:e16b::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms13.migadu.com with LMTPS id KNhaJzARCGfRRAAAqHPOHw:P1 (envelope-from ) for ; Thu, 10 Oct 2024 17:38:56 +0000 Received: from aspmx1.migadu.com ([2001:41d0:303:e16b::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp0.migadu.com with LMTPS id KNhaJzARCGfRRAAAqHPOHw (envelope-from ) for ; Thu, 10 Oct 2024 19:38:56 +0200 X-Envelope-To: larch@yhetil.org Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=posteo.net header.s=2017 header.b=PxSRZmqv; 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=1728581654; 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=YTFHxyVbrvWQKBUPCMX0X3bfe3TjDMqjyDxjJVrlBEg=; b=aDuyo2LLAIZ9wA+/oBQWf5+iH+H26XIgor2MNvSqtL6+yOPOYhMiVs8DMFB/ou527VwtQe CaZIifLGBE9U5CkqqsDPioVV8ajLw2cY1eoTiO2ju6ZZFFvC5J+nFi6jCBK7P6hKSiqyzE j2mtwbGPX8MULp2mAc+Mh++fuX/ftW57jTj2ntDFNcfeVTZxB4PnCNdEqmr4+9YkgRi/Hv vqFEKvRXEvbKqzPNuuAt8fFp0dw9BImsyn5OlS3sDok1KjNT/axA3RHl20eKitgSPRO4pf 3JHbCibqAYU88FLdNmDwxmIQUlYmmBT/QCtrsqmyNaZVzzaj4yGqqEqG5tFcBA== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1728581654; a=rsa-sha256; cv=none; b=I3QPqK1aQ1Ox0NZRY2y5rizH0OTdJyHxn60tQwhStcpsxvv1TRiAIwUT6vylGSLEJmaMCw 1xrHZzyY7cwuN0PrXHIMzuqnv8dWtz75VdCtfcQzOItf6AAD9TWNUQkP0ECbMXkslfrQ/G N5cGNZdbQq1twwrNn5zZCo4VGAfv0Z6QgomW6COjl99yWYR3BR7nrSwJiV0zuBnyJBuyCP rzEZN+oUGqWW3mZ5PiGF1jhNTDQJcXiFWwyTEFO3RWsLTup6ba4zdaGz7NoCLaIt5Q00m9 Tqv+qRmPEhwJbj8NaahK3PS5bdMjyAGbqZO2HtLcJy47gXHEzA5qDRJxb1lHsg== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=posteo.net header.s=2017 header.b=PxSRZmqv; 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 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 A55267A3F0 for ; Thu, 10 Oct 2024 19:34:14 +0200 (CEST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1syx2X-0008DX-PI; Thu, 10 Oct 2024 13:33:29 -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 1syx2S-0008DG-Dk for emacs-orgmode@gnu.org; Thu, 10 Oct 2024 13:33:24 -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 1syx2N-0004JK-PP for emacs-orgmode@gnu.org; Thu, 10 Oct 2024 13:33:24 -0400 Received: from submission (posteo.de [185.67.36.169]) by mout01.posteo.de (Postfix) with ESMTPS id C2C3F240027 for ; Thu, 10 Oct 2024 19:33:16 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017; t=1728581596; bh=ud2zrZwXHWYyQUbIklYhei41K346q0GRRRnCG2LbLLM=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version:Content-Type: From; b=PxSRZmqvWJEM6/AiwZmEEwNqMgCeIbpqNgHeWC/TNVUVxPRdjdD6OgKnuPl5DA5FN hg1jcoMawNHu4UR/MqISfFZXKdh5W12HZC7ECp1bubEbwhOIxXSeIHYHIiUpEubt0P 8swdhJBQM7benvhdEiR91fyUwppivjGPqtj4f50D2PBvfSpDhOKAT3rMnFhNvtM6eF 6n2iOKgOoTAuxZgMaBDtP7AlDCesSxBgFmAhFtNcyaWPfH40RdAvEMR6W2JWMeoGH9 /DIX7Od6PKQO4fTVKSaW4rL2GcY+qwVaCTDK3EPSq6AcSaU6vhFnHwdfxhezsem0p5 aRcmdpB+822Cw== Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 4XPcKm1tWrz9rxN; Thu, 10 Oct 2024 19:33:16 +0200 (CEST) From: Ihor Radchenko To: Karthik Chikmagalur Cc: Tony Zorman , emacs-orgmode@gnu.org Subject: Re: Using org-latex-preview in other major modes In-Reply-To: <87a5fffmuc.fsf@gmail.com> References: <87edbhljr7.fsf@hyperspace> <87msq5o03b.fsf@localhost> <87a5fffmuc.fsf@gmail.com> Date: Thu, 10 Oct 2024 17:35:05 +0000 Message-ID: <87o73rkgja.fsf@localhost> MIME-Version: 1.0 Content-Type: text/plain 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, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=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: -4.59 X-Spam-Score: -4.59 X-Migadu-Queue-Id: A55267A3F0 X-Migadu-Scanner: mx13.migadu.com X-TUID: pvI3FClowTcS Karthik Chikmagalur writes: >> Abstracting away previews is certainly welcome. >> RMS explicitly asked Org mode team to work towards this goal: >> https://list.orgmode.org/E1kIkxv-0007iy-Av@fencepost.gnu.org/ > > I recently spent some time on this feature (LaTeX previews in all > major-modes) and produced a few prototypes. You can see some demos in > > https://www.youtube.com/watch?v=u44X_th6_oY [1] Thanks! Also, talking about calc previews... there is https://github.com/johnbcoughlin/calctex > The way support for other major modes works right now is based on the > following observation: The `org-latex-preview' feature uses a tiny > subset of the `org-element' API. Specifically, it uses only the > functions > > - `org-element-context' > - `org-element-property', referring to the properties :value, > :begin and :end, and optionally :post-blank and :post-affiliated > - `org-element-type', which returns either latex-fragment, > latex-environment or any other symbol I think that it will be better to reuse thingatpt.el to retrieve object boundaries: fragments and sections. > In addition, it uses two functions to generate the preamble and find > section bounds: > > - `org-latex-preview--get-preamble' > - `org-latex-preview--section-bounds' For preamble, we may simply use buffer-local variable. Something like (defvar-local latex-preview-make-preamble-function #'latex-preview-default-preamble ...) Then, major modes may set it as needed. -- Ihor Radchenko // yantar92, Org mode contributor, Learn more about Org mode at . Support Org development at , or support my work at