emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: (Feature Request) have org-edit-special work inside non-environment


From: Nicolas Goaziou
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
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/26.3 (gnu/linux)

Hello,

Timothy <address@hidden> 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 <address@hidden>
> 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 via email to

[Prev in Thread] Current Thread [Next in Thread]