GNU bug report logs - #35419
[Proposal] Buffer Lenses and the Case of Org-Mode (also, Jupyter)

Previous Next

Packages: emacs, org-mode;

Reported by: Dmitrii Korobeinikov <dim1212k <at> gmail.com>

Date: Wed, 24 Apr 2019 18:36:01 UTC

Severity: wishlist

Full log


Message #57 received at 35419 <at> debbugs.gnu.org (full text, mbox):

From: Dmitry Gutov <dgutov <at> yandex.ru>
To: Dmitrii Korobeinikov <dim1212k <at> gmail.com>,
 Ihor Radchenko <yantar92 <at> gmail.com>
Cc: 35419 <at> debbugs.gnu.org
Subject: Re: bug#35419: [O] [Proposal] Buffer Lenses and the Case of Org-Mode
 (also, Jupyter)
Date: Sun, 5 Apr 2020 04:46:08 +0300
Hi!

Some late clarifications about mmm-mode.

On 26.04.2019 00:00, Dmitrii Korobeinikov wrote:
>  > A lot of the functionality of MMM Mode---that which makes the major mode
>  > appear to change---is implemented by saving and restoring the values of
>  > local variables, or pseudo-variables.
> 
> What I don't understand is where the modes of the submode region run and 
> when they are turned on.

They are run in an empty temporary buffer, see mmm-update-mode-info. 
That is true for all the "submodes" in a buffer. The primary major mode 
is run in the context of that buffer (IIRC). After any of them runs, the 
code responsible for it collects the values of a certain number of known 
variables and associates that map with the major mode (this is a bit of 
a simplification).

> Are necessary modes just allowed to run at the right time for the whole 
> buffer?

When you move between the "chunks", no major mode functions are called. 
Instead, the values of variables are swapped in. Including the value of 
the 'major-mode' variable.

> But then, how are they limited in their effect to just the 
> necessary region? Narrowing?

Usually, yes. Especially when we're talking about font-lock and 
syntax-propertize-function. See mmm-fontify-region-list for an example.

> Could, for example, syntax checking be done efficiently that way?

That depends on the combination of modes and how they are used (either 
they can be nested, like in web templates, or it's a flat list where 
chunks are largely independent like in Jupyter). But in most cases, I 
think, you could pick a good strategy. There are no universal ones, though.




This bug report was last modified 5 years and 75 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.