From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp2 ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms11 with LMTPS id ob2NOZ6Vyl7EIAAA0tVLHw (envelope-from ) for ; Sun, 24 May 2020 15:41:18 +0000 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp2 with LMTPS id sO3cNJ6Vyl4YOgAAB5/wlQ (envelope-from ) for ; Sun, 24 May 2020 15:41:18 +0000 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 62465940C01 for ; Sun, 24 May 2020 15:41:18 +0000 (UTC) Received: from localhost ([::1]:59826 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jcskW-0007nA-3O for larch@yhetil.org; Sun, 24 May 2020 11:41:16 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:49486) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jcsjv-0007mx-Fz for emacs-orgmode@gnu.org; Sun, 24 May 2020 11:40:39 -0400 Received: from mail-pj1-x1029.google.com ([2607:f8b0:4864:20::1029]:34920) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jcsju-0003We-JC; Sun, 24 May 2020 11:40:39 -0400 Received: by mail-pj1-x1029.google.com with SMTP id 5so7516674pjd.0; Sun, 24 May 2020 08:40:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:references:user-agent:in-reply-to :message-id:mime-version; bh=bvJGP87QoSwcF8WeSjvMGQdLwRa024T5M5u+SWbFcZw=; b=UzuZpPeMncaBW99hD5SoNR9ho49UzGHe+XKWXpUMIIzX0ZB/e5Smx0zkGaCAvOzXfA 32xT8YxIaot74AwKW96VqX8UC9qcYbOeTzHxL6THN2WWAdf5vsF0k54glqIr01BePCMd TAsgbm2GbhUucN6EPixpZDvuiHdbazSzYW2kKu3ZERWHY0zm2iCJe3qw4Ssq32laC5GN vJPV5jy9Iycac6Qcby87skoUpns7cmzsZLv1VKrdGmcUoxQvMKxqn0n+MOpZvBTfoiAK MO0zaNR7u/U4ErAPygvGGHycDzghYJkDOPvOucr4d5Q7GMjd2dUbAydYby20MRF0ghZk W4tA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:references:user-agent :in-reply-to:message-id:mime-version; bh=bvJGP87QoSwcF8WeSjvMGQdLwRa024T5M5u+SWbFcZw=; b=HfOW/p6nmC+f4/BWE8PIo8Ep3lOY3M+aJsQvM7AuexIg3OkWQ6dkAPSBmtGchkAGWd +gEFFSBo98cvt1Mjgv9ypCSmLX48pMyoWHQxwwbLE4jqLFzg/uAiXQdDGynCzCbYQB+9 gk4t5KbRcvgz49LxILcIGuqMe0e5T6HbLD4NbxDPO8bNKFWIhhHp0o/wwjzMfagioO5D czHidPNfFLf0eCJYopSC4TCVDah5QrCv25l4aNTtF/m8LUnBqxCbwM3V6IYBTBwWyC4c o0c5pnyCL34kmUisxDrRdVwgZuX/GYiRFInApRuiV4ycb45czCTIJlNdEVFrtvjqVjTS /F1Q== X-Gm-Message-State: AOAM533h+VsQC2wNbJEJnL1XxvI6mcKvkO0obbynLlGeEJnZeXvLndNe p0e9ENaZ49gi5g+y542eMMOXFZalP1k= X-Google-Smtp-Source: ABdhPJyzHCevPv/kvLuI4sG7lPDyPOHAm90roumRir0ws7FjcQdQ4fBmY4uv0ttolvHCCyM3NxklfA== X-Received: by 2002:a17:90b:ed3:: with SMTP id gz19mr16352607pjb.166.1590334836093; Sun, 24 May 2020 08:40:36 -0700 (PDT) Received: from localhost (180-150-91-8.b4965b.per.nbn.aussiebb.net. [180.150.91.8]) by smtp.gmail.com with ESMTPSA id s1sm6026904pjp.27.2020.05.24.08.40.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 24 May 2020 08:40:34 -0700 (PDT) From: TEC To: Bastien Subject: Re: (Feature Request) have org-edit-special work inside non-environment LaTeX blocks, i.e. \( \) and \[ \] Date: Sun, 24 May 2020 23:38:37 +0800 References: <87h7w7j9tr.fsf@gnu.org> <87d06tfjt6.fsf@gmail.com> User-agent: mu4e 1.4.6; emacs 26.3 In-reply-to: <87d06tfjt6.fsf@gmail.com> Message-ID: <87zh9xxrww.fsf@gmail.com> MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="=-=-=" Received-SPF: pass client-ip=2607:f8b0:4864:20::1029; envelope-from=tecosaur@gmail.com; helo=mail-pj1-x1029.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. X-Spam_score_int: -6 X-Spam_score: -0.7 X-Spam_bar: / X-Spam_report: (-0.7 / 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, HTML_MESSAGE=0.001, HTML_OBFUSCATE_05_10=0.26, MPART_ALT_DIFF_COUNT=1.112, RCVD_IN_DNSWL_NONE=-0.0001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-BeenThere: emacs-orgmode@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: "emacs-orgmode@gnu.org" Errors-To: emacs-orgmode-bounces+larch=yhetil.org@gnu.org Sender: "Emacs-orgmode" X-Scanner: scn0 Authentication-Results: aspmx1.migadu.com; dkim=fail (rsa verify failed) header.d=gmail.com header.s=20161025 header.b=UzuZpPeM; dmarc=fail reason="SPF not aligned (relaxed)" header.from=gmail.com (policy=none); spf=pass (aspmx1.migadu.com: domain of emacs-orgmode-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=emacs-orgmode-bounces@gnu.org X-Spam-Score: 1.59 X-TUID: v0HqxIASL3N0 --=-=-= Content-Type: text/plain; format=flowed TEC writes: > Well, I'm currently having a look at patching this, so this > looks hopeful :) Done! Here's a first-pass patch. Please try it out and let me know what you think. --=-=-= Content-Type: text/x-patch Content-Disposition: attachment; filename=0001-Extend-org-edit-special-to-editing-LaTeX-fragments.patch >From 379e23545d7e55766e48b50514bd797bdf691a40 Mon Sep 17 00:00:00 2001 From: TEC Date: Sun, 24 May 2020 23:35:33 +0800 Subject: [PATCH] Extend org-edit-special to editing LaTeX-fragments --- lisp/org-src.el | 19 +++++++++++++++++++ lisp/org.el | 1 + 2 files changed, 20 insertions(+) diff --git a/lisp/org-src.el b/lisp/org-src.el index c9eef744e..d648ce2c9 100644 --- a/lisp/org-src.el +++ b/lisp/org-src.el @@ -363,6 +363,10 @@ where BEG and END are buffer positions and CONTENTS is a string." (end (progn (goto-char (org-element-property :end datum)) (search-backward "}" (line-beginning-position) t)))) (list beg end (buffer-substring-no-properties beg end)))) + ((eq type 'latex-fragment) + (let ((beg (org-element-property :begin datum)) + (end (org-element-property :end datum))) + (list beg end (buffer-substring-no-properties beg end)))) ((org-element-property :contents-begin datum) (let ((beg (org-element-property :contents-begin datum)) (end (org-element-property :contents-end datum))) @@ -959,6 +963,21 @@ Throw an error when not at such a table." (table-recognize) t)) +(defun org-edit-latex-fragment () + "Edit LaTeX fragment at point." + (interactive) + (let ((context (org-element-context))) + (unless (and (eq (org-element-type context) 'latex-fragment) + (org-src--on-datum-p context)) + (user-error "Not on a LaTeX fragment")) + (pp (org-element-property :contents-begin context)) + (org-src--edit-element + context + (org-src--construct-edit-buffer-name (buffer-name) "LaTeX fragment") + (org-src-get-lang-mode "latex") + t) + t)) + (defun org-edit-latex-environment () "Edit LaTeX environment at point. \\ diff --git a/lisp/org.el b/lisp/org.el index 40c3c46b9..0808fc210 100644 --- a/lisp/org.el +++ b/lisp/org.el @@ -17347,6 +17347,7 @@ Otherwise, return a user error." (pcase (org-element-type context) (`footnote-reference (org-edit-footnote-reference)) (`inline-src-block (org-edit-inline-src-code)) + (`latex-fragment (org-edit-latex-fragment)) (`timestamp (if (eq 'inactive (org-element-property :type context)) (call-interactively #'org-time-stamp-inactive) (call-interactively #'org-time-stamp))) -- 2.26.2 --=-=-= Content-Type: multipart/related; boundary="==-=-=" --==-=-= Content-Type: text/html

TEC <tecosaur@gmail.com> writes:

> Well, I’m currently having a look at patching this, so this looks hopeful :)

Done! Here’s a first-pass patch. Please try it out and let me know what you
think.

<#part type=“text/x-patch” filename=“home/tec.emacs.d/.local/straight/repos/org-mode/0001-Extend-org-edit-special-to-editing-LaTeX-fragments.patch” disposition=attachment>
<#/part>

--==-=-=-- --=-=-=--