From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp1 ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms1 with LMTPS id WMjtJ7k4iV4VUAAAk0OIDg (envelope-from ) for ; Sun, 05 Apr 2020 01:47:37 +0000 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp1 with LMTPS id QEWgB7g4iV7KFwAAbx9fmQ (envelope-from ) for ; Sun, 05 Apr 2020 01:47:36 +0000 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id F28B0941B6B for ; Sun, 5 Apr 2020 01:47:33 +0000 (UTC) Received: from localhost ([::1]:43736 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jKuNn-0001Uu-3Q for larch@yhetil.org; Sat, 04 Apr 2020 21:47:31 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:55669) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jKuNL-0001UP-5P for emacs-orgmode@gnu.org; Sat, 04 Apr 2020 21:47:04 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1jKuNK-0003hS-3e for emacs-orgmode@gnu.org; Sat, 04 Apr 2020 21:47:03 -0400 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 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 Subject: bug#35419: [O] [Proposal] Buffer Lenses and the Case of Org-Mode (also, Jupyter) 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 X-GNU-PR-Keywords: To: Dmitrii Korobeinikov , Ihor Radchenko Received: via spool by 35419-submit@debbugs.gnu.org id=B35419.15860511794459 (code B ref 35419); Sun, 05 Apr 2020 01:47:01 +0000 Received: (at 35419) by debbugs.gnu.org; 5 Apr 2020 01:46:19 +0000 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 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 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) 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) References: <87v9z2ojf8.fsf@yantar92-laptop.i-did-not-set--mail-host-address--so-tickle-me> From: Dmitry Gutov Message-ID: <4bb84e9a-7058-3deb-30f0-b4c8f337b116@yandex.ru> Date: Sun, 5 Apr 2020 04:46:08 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.4.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit 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: emacs-orgmode@gnu.org List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: 35419@debbugs.gnu.org Errors-To: emacs-orgmode-bounces+larch=yhetil.org@gnu.org Sender: "Emacs-orgmode" ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=default; t=1586051254; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding:resent-cc: resent-from:resent-sender:resent-message-id:in-reply-to:in-reply-to: references:references:list-id:list-help:list-unsubscribe: list-subscribe:list-post:dkim-signature; bh=Wj4hoQ++aIkijeQbTJKoFwP01RC2GK08HoB5D3/RkHw=; b=bRWS0+8cI+jkt0PRCME0A1/qb6Pjab9IzouKA0/7UEramsF0vZvKHR0tErYj+MKDy0Ehvl 5kuh4HKwWraFb/h6hdUUQxL1oWnmtOjlDOECitUqGqMbRQqpvWSl/gTzyYBwRF3CvQDSvH UIMHlfiT5nYOnMvYvcKQ2XcPLi18sHI= ARC-Seal: i=1; s=default; d=yhetil.org; t=1586051254; a=rsa-sha256; cv=none; b=Ki6WSds7IwAC5pxNqc0LEGh1qbueUvbrDxKwOVS5dNP+psZr4ELsiYSzGwxMy8UuxJoDeM 3AasgVIsN95zUkMqSmgxV3L6sCkz341R5npbXapVr+UyJLLrhvGAINoGKtxVls4s17/d5S TtQgmLuy/ynbbZ9ubbSQsnJoW6+/Jxc= ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail (rsa verify failed) header.d=gmail.com header.s=20161025 header.b=DEINpwY/; dmarc=fail reason="SPF not aligned (relaxed)" header.from=yandex.ru (policy=none); spf=pass (aspmx1.migadu.com: domain of emacs-orgmode-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=emacs-orgmode-bounces@gnu.org X-Scanner: scn0 X-Spam-Score: 0.09 Authentication-Results: aspmx1.migadu.com; dkim=fail (rsa verify failed) header.d=gmail.com header.s=20161025 header.b=DEINpwY/; dmarc=fail reason="SPF not aligned (relaxed)" header.from=yandex.ru (policy=none); spf=pass (aspmx1.migadu.com: domain of emacs-orgmode-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=emacs-orgmode-bounces@gnu.org X-Scan-Result: default: False [0.09 / 13.00]; RCVD_VIA_SMTP_AUTH(0.00)[]; GENERIC_REPUTATION(0.00)[-0.58645268137193]; TO_DN_SOME(0.00)[]; R_SPF_ALLOW(-0.20)[+ip4:209.51.188.0/24:c]; R_DKIM_REJECT(1.00)[gmail.com:s=20161025]; FREEMAIL_FROM(0.00)[yandex.ru]; ARC_SIGNED(0.00)[i=1]; IP_REPUTATION_HAM(0.00)[asn: 22989(0.33), country: US(-0.01), ip: 209.51.188.17(-0.59)]; DKIM_TRACE(0.00)[gmail.com:-]; MX_GOOD(-0.50)[cached: eggs.gnu.org]; MAILLIST(-0.20)[mailman]; FREEMAIL_TO(0.00)[gmail.com]; FORGED_RECIPIENTS_MAILLIST(0.00)[]; MIME_TRACE(0.00)[0:+]; RCVD_TLS_LAST(0.00)[]; ASN(0.00)[asn:22989, ipnet:209.51.188.0/24, country:US]; MID_RHS_MATCH_FROM(0.00)[]; TAGGED_FROM(0.00)[larch=yhetil.org]; ARC_NA(0.00)[]; FROM_NEQ_ENVFROM(0.00)[dgutov@yandex.ru,emacs-orgmode-bounces@gnu.org]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[3]; MIME_GOOD(-0.10)[text/plain]; PREVIOUSLY_DELIVERED(0.00)[35419@debbugs.gnu.org]; HAS_LIST_UNSUB(-0.01)[]; RCVD_COUNT_SEVEN(0.00)[10]; FORGED_SENDER_MAILLIST(0.00)[]; DMARC_POLICY_SOFTFAIL(0.10)[yandex.ru : SPF not aligned (relaxed),none] X-TUID: XOne9uxv+NT6 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.