emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Nicolas Goaziou <mail@nicolasgoaziou.fr>
To: Timothy <tecosaur@gmail.com>
Cc: Bastien <bzg@gnu.org>, "emacs-orgmode@gnu.org" <emacs-orgmode@gnu.org>
Subject: Re: (Feature Request) have org-edit-special work inside non-environment LaTeX blocks, i.e. \( \) and \[ \]
Date: Sun, 24 May 2020 21:33:06 +0200	[thread overview]
Message-ID: <87r1v9ceml.fsf@nicolasgoaziou.fr> (raw)
In-Reply-To: <4274FCF8-5304-4B55-9586-0C718DA388D3@getmailspring.com> (Timothy's message of "Sun, 24 May 2020 23:43:05 +0800")

Hello,

Timothy <tecosaur@gmail.com> writes:

> Well that didn't quite work as intended. Here's a take two.

This doesn't look bad. Thank you.

> From 379e23545d7e55766e48b50514bd797bdf691a40 Mon Sep 17 00:00:00 2001
> From: TEC <tec@tecosaur.com>
> Date: Sun, 24 May 2020 23:35:33 +0800
> Subject: [PATCH] Extend org-edit-special to editing LaTeX-fragments

In the commit message, you need to list functions being modified. See
other commits messages for some examples.

> +      ((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))))

These are not correct buffer positions. BEG and END should be between
"\(" and "\)" (or "$" and "$", or…). See, in the same function, how
inline source blocks are handled.

> +    (pp (org-element-property :contents-begin context))

It is a left-over.

> +    (org-src--edit-element
> +     context
> +     (org-src--construct-edit-buffer-name (buffer-name) "LaTeX fragment")
> +     (org-src-get-lang-mode "latex")
> +     t)
> +  t))

You also need to put read-only property on fragment markers, and remove
any blank line as the final step. See `org-edit-footnote-reference'.

>  	 (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))

This line is perfect ;)

Regards,

-- 
Nicolas Goaziou


  reply	other threads:[~2020-05-24 19:33 UTC|newest]

Thread overview: 48+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-19  1:31 (Feature Request) have org-edit-special work inside non-environment LaTeX blocks, i.e. \( \) and \[ \] Timothy
2020-05-19  7:47 ` Nicolas Goaziou
2020-05-19  9:27   ` Timothy
2020-05-19  9:39     ` Nicolas Goaziou
2020-05-19  9:45       ` Timothy
2020-05-19 13:27         ` Nicolas Goaziou
2020-05-19 13:32           ` Timothy
2020-05-19 14:09             ` Nicolas Goaziou
2020-05-19 14:12               ` Timothy
2020-05-19 14:28                 ` Nicolas Goaziou
2020-05-19 14:33                   ` Timothy
2020-05-23  9:10 ` Bastien
2020-05-23  9:20   ` tecosaur
2020-05-23  9:34     ` Bastien
2020-05-24 15:07   ` TEC
2020-05-24 15:38     ` TEC
2020-05-24 15:43       ` Timothy
2020-05-24 19:33         ` Nicolas Goaziou [this message]
2020-05-25  1:33           ` TEC
2020-05-25  7:11             ` Nicolas Goaziou
2020-05-25  9:28           ` TEC
2020-05-25  9:41             ` Nicolas Goaziou
2020-05-25  9:42               ` TEC
2020-05-25  9:55                 ` TEC
2020-05-25 10:09                   ` Nicolas Goaziou
2020-05-25 10:09                     ` TEC
2020-05-25 10:23                       ` Nicolas Goaziou
2020-05-25 10:24                         ` TEC
2020-05-25 10:32                           ` Nicolas Goaziou
2020-05-25 10:33                             ` TEC
2020-05-25 10:05                 ` TEC
2020-05-25 10:20                   ` Nicolas Goaziou
2020-05-25 10:21                     ` TEC
2020-05-25 11:27                       ` Nicolas Goaziou
2020-05-25 13:22                         ` Timothy
2020-05-25 14:08                           ` TEC
2020-05-26  7:56                             ` Nicolas Goaziou
2020-05-26  8:39                               ` Timothy
2020-05-26  9:11                                 ` Nicolas Goaziou
2020-05-26  9:23                                   ` TEC
2020-05-26 13:56                                     ` TEC
2020-05-26 21:13                                       ` Nicolas Goaziou
2020-05-26 17:01                                 ` John Kitchin
2020-05-25 18:58                           ` Nicolas Goaziou
2020-05-26  4:48                             ` TEC
2020-05-25 10:11                 ` Nicolas Goaziou
2020-05-25 10:17                   ` TEC
  -- strict thread matches above, loose matches on Subject: below --
2020-05-18  6:44 Timothy

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87r1v9ceml.fsf@nicolasgoaziou.fr \
    --to=mail@nicolasgoaziou.fr \
    --cc=bzg@gnu.org \
    --cc=emacs-orgmode@gnu.org \
    --cc=tecosaur@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).