emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Dmitry Gutov <dgutov@yandex.ru>
To: Dmitrii Korobeinikov <dim1212k@gmail.com>,
	Ihor Radchenko <yantar92@gmail.com>
Cc: 35419@debbugs.gnu.org
Subject: bug#35419: [O] [Proposal] Buffer Lenses and the Case of Org-Mode (also, Jupyter)
Date: Sun, 5 Apr 2020 04:46:08 +0300	[thread overview]
Message-ID: <4bb84e9a-7058-3deb-30f0-b4c8f337b116@yandex.ru> (raw)
In-Reply-To: <CA+Yh0ST+u0s6L-hR2=rs3O_46FqXn8utGotORx+FMDb7Jn0Rfw@mail.gmail.com>


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.

  parent reply	other threads:[~2020-04-05  1:47 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-04-24 19:20 [Proposal] Buffer Lenses and the Case of Org-Mode (also, Jupyter) Dmitrii Korobeinikov
2019-04-25  3:25 ` Ihor Radchenko
     [not found]   ` <CA+Yh0SQ7yWQBjXhKbJPrCroriNpwhyFyQWAfHsUvxwmojsjKuw@mail.gmail.com>
2019-04-25  1:37     ` bug#35419: " Noam Postavsky
2019-04-25  7:11     ` bug#35419: Fwd: " 'Ihor Radchenko'
     [not found]     ` <87sgu6rhkt.fsf@gmail.com>
2019-04-25  8:40       ` bug#35419: " Dmitrii Korobeinikov
     [not found]       ` <CA+Yh0SSvQMucaC1EJR9GBxpKeP6haGiHN+Lf2QYo8csNoy0Waw@mail.gmail.com>
2019-04-25 17:52         ` Philipp Stephani
     [not found]         ` <CAArVCkQcwnjeMyRU6rpiuvGsOCUOsnQTQwQSGdDFKwQz_Sbi3g@mail.gmail.com>
2019-04-25 21:14           ` Dmitrii Korobeinikov
2019-04-26 12:05         ` Roland Everaert
2019-05-02 21:24     ` bug#35419: " Dmitrii Korobeinikov
2019-05-02 21:31     ` Dmitrii Korobeinikov
2019-04-25 21:00   ` Dmitrii Korobeinikov
     [not found]   ` <CA+Yh0ST+u0s6L-hR2=rs3O_46FqXn8utGotORx+FMDb7Jn0Rfw@mail.gmail.com>
2020-04-05  1:46     ` Dmitry Gutov [this message]
2020-04-05 10:05       ` bug#35419: [O] " Dmitrii Korobeinikov

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:

  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=4bb84e9a-7058-3deb-30f0-b4c8f337b116@yandex.ru \
    --to=dgutov@yandex.ru \
    --cc=35419@debbugs.gnu.org \
    --cc=dim1212k@gmail.com \
    --cc=yantar92@gmail.com \


* 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


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