From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.ciao.gmane.io!not-for-mail From: Dmitry Gutov Newsgroups: gmane.emacs.bugs Subject: bug#35419: [O] [Proposal] Buffer Lenses and the Case of Org-Mode (also, Jupyter) Date: Sun, 5 Apr 2020 04:46:08 +0300 Message-ID: <4bb84e9a-7058-3deb-30f0-b4c8f337b116@yandex.ru> References: <87v9z2ojf8.fsf@yantar92-laptop.i-did-not-set--mail-host-address--so-tickle-me> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Injection-Info: ciao.gmane.io; posting-host="ciao.gmane.io:159.69.161.202"; logging-data="87673"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.4.1 Cc: 35419@debbugs.gnu.org To: Dmitrii Korobeinikov , Ihor Radchenko Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sun Apr 05 03:47:17 2020 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jKuNY-000Mg8-Rj for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 05 Apr 2020 03:47:16 +0200 Original-Received: from localhost ([::1]:43740 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jKuNX-0001Vs-Tv for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 04 Apr 2020 21:47:15 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:55680) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jKuNP-0001UW-Af for bug-gnu-emacs@gnu.org; Sat, 04 Apr 2020 21:47:08 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1jKuNM-0003iT-70 for bug-gnu-emacs@gnu.org; Sat, 04 Apr 2020 21:47:07 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:33459) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1jKuNJ-0003hD-UB; Sat, 04 Apr 2020 21:47:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1jKuNJ-0001CV-Rr; Sat, 04 Apr 2020 21:47:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Dmitry Gutov Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org, emacs-orgmode@gnu.org Resent-Date: Sun, 05 Apr 2020 01:47:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 35419 X-GNU-PR-Package: emacs,org-mode Original-Received: via spool by 35419-submit@debbugs.gnu.org id=B35419.15860511794459 (code B ref 35419); Sun, 05 Apr 2020 01:47:01 +0000 Original-Received: (at 35419) by debbugs.gnu.org; 5 Apr 2020 01:46:19 +0000 Original-Received: from localhost ([127.0.0.1]:45005 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jKuMc-00019r-UO for submit@debbugs.gnu.org; Sat, 04 Apr 2020 21:46:19 -0400 Original-Received: from mail-wr1-f43.google.com ([209.85.221.43]:33948) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jKuMb-00019Q-BS for 35419@debbugs.gnu.org; Sat, 04 Apr 2020 21:46:17 -0400 Original-Received: by mail-wr1-f43.google.com with SMTP id 65so13207758wrl.1 for <35419@debbugs.gnu.org>; Sat, 04 Apr 2020 18:46:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=Wj4hoQ++aIkijeQbTJKoFwP01RC2GK08HoB5D3/RkHw=; b=DEINpwY/FRhkcC1gtKkUidAZSDF27enntHlpHuLPdfkIxhZsW4c2S5Y97T7adLugeM fo0KewI+hcofRGHfZmRPtcx2d9xXrjS79rRhB2b6ebQAFEPbF+jt3Q80b+IdX3nqNlVa SnwIBTYvjOMnSKsrG9V6/cUmh751yQLpx03As1uSNAiAk3sh+qlMrLJDkbxXg/vOGshz Ma+JVsWRPoXor/K9c/yTd3UPKi/O/9f5eeoSPRgUCec2vmKSUCdS/I2sCYN1zus12LeW nuevFoP65NpnTEQYHskvJkWehn1WvplGpAKjljXsQ5PSHLHkaoGAf7XDr+EfxKzoqp/x eULg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:subject:to:cc:references:from:message-id :date:user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=Wj4hoQ++aIkijeQbTJKoFwP01RC2GK08HoB5D3/RkHw=; b=dhgixSwRL3mBKQVy792UAWkl0tHsRvrsZwLAFSh9zYYxS4VHoIjzoEafUfhfHwIN2C 7e+IUqhrjqq/yEh2olNPi6Or3IIYa88deUv7IS4NVXX/OiNNi0MDUHm/ZBjVPDCFcyiE 1vKA1mbiwz7diWiv/1tn9hxpQI0xWaOUHlBZ4CJdpzT3DTdGCkUwchrcmMtCxa4R8RS6 Uw6FPPakw7nVowKLALDfLENDCuhaDAvF74YvW3UfufL4grcP1STrnxn7h8OOS4FOJsET UaA9hCO8IGTgve0XpQjBAP1WQHNNQNAkdkJY9/Ijqc394977sjR2joPIxZBwayVqjnDd J/aw== X-Gm-Message-State: AGi0PuYrRIkjeik1P+tgnlJSM8qzY4ObaX1fN5Y9RpDbCbzIOQaGRUFr BGAfLY0bct+PnPBiDLYnVD2slCf25r0= X-Google-Smtp-Source: APiQypKfumo2BaMCIAIJj6vUNTl5zWOrIM2QICP29uk1sdn8cjNHTHNn5dLBakHZeWdtbqbXCLrrDQ== X-Received: by 2002:adf:f808:: with SMTP id s8mr7877614wrp.219.1586051170727; Sat, 04 Apr 2020 18:46:10 -0700 (PDT) Original-Received: from [192.168.0.2] ([66.205.73.129]) by smtp.googlemail.com with ESMTPSA id y22sm199579wma.0.2020.04.04.18.46.09 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sat, 04 Apr 2020 18:46:10 -0700 (PDT) In-Reply-To: Content-Language: en-US X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.51.188.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:178047 Archived-At: 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.