all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Org-mode blocks multiline fontification performance
@ 2021-06-23 18:41 Sébastien Miquel
  2021-06-24  6:12 ` Jean Louis
  0 siblings, 1 reply; 4+ messages in thread
From: Sébastien Miquel @ 2021-06-23 18:41 UTC (permalink / raw)
  To: help-gnu-emacs

Hi,

Org allows the use of special blocks such as

#+begin_proof
Some LaTeX fragments in here: $a^2 + b^2 = c^2$.
#+end_proof

that may be exported to matching LaTeX environments.

We want some light fontification of such blocks:
  1. *Matching* #+begin and #+end lines should be fontified
  2. Some background color face should be applied to the inside of the 
block.
     (This isn't actually currently the case for such special blocks, 
but applies
     for other blocks)

It is currently implemented by adding the `font-lock-multiline' property 
to the
block.

When the inside of the block is modified, the region to refontify is 
extended to
the whole block (the multiline region), and the whole block is refontified.

The issue is that
  + the block may be quite large
  + the LaTeX fragment fontification can be quite expensive.

For very large blocks, this makes emacs unusable, and for smaller 
blocks, it can
still incur some noticeable delay.

Is there a better way to achieve 1. and 2. ?
If not, how about 2. only ?

Regards,

-- 
Sébastien Miquel




^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Org-mode blocks multiline fontification performance
  2021-06-23 18:41 Org-mode blocks multiline fontification performance Sébastien Miquel
@ 2021-06-24  6:12 ` Jean Louis
  2021-06-24  6:26   ` Sébastien Miquel
  0 siblings, 1 reply; 4+ messages in thread
From: Jean Louis @ 2021-06-24  6:12 UTC (permalink / raw)
  To: Sébastien Miquel; +Cc: help-gnu-emacs

* Sébastien Miquel <sebastien.miquel@posteo.eu> [2021-06-23 21:42]:
> Hi,
> 
> Org allows the use of special blocks such as
> 
> #+begin_proof
> Some LaTeX fragments in here: $a^2 + b^2 = c^2$.
> #+end_proof
> 
> that may be exported to matching LaTeX environments.
> 
> We want some light fontification of such blocks:
>  1. *Matching* #+begin and #+end lines should be fontified
>  2. Some background color face should be applied to the inside of the block.
>     (This isn't actually currently the case for such special blocks, but
> applies
>     for other blocks)
> 
> It is currently implemented by adding the `font-lock-multiline'
> property to the block.
> 
> When the inside of the block is modified, the region to refontify is
> extended to the whole block (the multiline region), and the whole
> block is refontified.
> 
> The issue is that
>  + the block may be quite large
>  + the LaTeX fragment fontification can be quite expensive.

Use the chunked approach, make 2 files one including the other.


-- 
Jean

Take action in Free Software Foundation campaigns:
https://www.fsf.org/campaigns

In support of Richard M. Stallman
https://stallmansupport.org/



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Org-mode blocks multiline fontification performance
  2021-06-24  6:12 ` Jean Louis
@ 2021-06-24  6:26   ` Sébastien Miquel
  2021-06-24  6:38     ` Jean Louis
  0 siblings, 1 reply; 4+ messages in thread
From: Sébastien Miquel @ 2021-06-24  6:26 UTC (permalink / raw)
  To: help-gnu-emacs

Jean Louis writes:
> Use the chunked approach, make 2 files one including the other.
A workaround, certainly. But a reasonable document might contains some 
20 such
blocks of moderate size, say 10-30 lines each.

Really what I'm wondering is if there's a different way to achieve such
fontification with font-lock.

-- 
Sébastien Miquel




^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Org-mode blocks multiline fontification performance
  2021-06-24  6:26   ` Sébastien Miquel
@ 2021-06-24  6:38     ` Jean Louis
  0 siblings, 0 replies; 4+ messages in thread
From: Jean Louis @ 2021-06-24  6:38 UTC (permalink / raw)
  To: Sébastien Miquel; +Cc: help-gnu-emacs

* Sébastien Miquel <sebastien.miquel@posteo.eu> [2021-06-24 09:27]:
> Jean Louis writes:
> > Use the chunked approach, make 2 files one including the other.
> A workaround, certainly. But a reasonable document might contains some 20
> such
> blocks of moderate size, say 10-30 lines each.
> 
> Really what I'm wondering is if there's a different way to achieve such
> fontification with font-lock.

Somebody else may help on that.

Personally I have switched from Org to meta-level database backed
editing of any objects with any kind of modes. I am similarly using
programming blocks (often PostgreSQL reports) and they are opened as a
single object in PostgreSQL or SQL mode. I can describe them but their
description is in a different place and separate. If I wish to include
them in a main Org (or other type) file, it is matter of a second, and
their report is included. Though I don't use files the same approach
can work well with files and Org files to include programming blocks
from other files.

Then I would make a non-exporting link in Org file that brings me to
other file to be edited, and in that other (included) file I would
make a link back to the master Org file. This way switching back and
forth is easy.


-- 
Jean

Take action in Free Software Foundation campaigns:
https://www.fsf.org/campaigns

In support of Richard M. Stallman
https://stallmansupport.org/



^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2021-06-24  6:38 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-06-23 18:41 Org-mode blocks multiline fontification performance Sébastien Miquel
2021-06-24  6:12 ` Jean Louis
2021-06-24  6:26   ` Sébastien Miquel
2021-06-24  6:38     ` Jean Louis

Code repositories for project(s) associated with this external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.