From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp2 ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms1 with LMTPS id qMPREoiuiV6rHAAAk0OIDg (envelope-from ) for ; Sun, 05 Apr 2020 10:10:16 +0000 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp2 with LMTPS id mKp6LoauiV6FJgAAB5/wlQ (envelope-from ) for ; Sun, 05 Apr 2020 10:10:14 +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 30BCC942684 for ; Sun, 5 Apr 2020 10:06:47 +0000 (UTC) Received: from localhost ([::1]:46458 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jL2Aw-0001fC-0m for larch@yhetil.org; Sun, 05 Apr 2020 06:06:46 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:37197) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jL2AI-0001dI-2n for emacs-orgmode@gnu.org; Sun, 05 Apr 2020 06:06:08 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1jL2AE-0001I7-98 for emacs-orgmode@gnu.org; Sun, 05 Apr 2020 06:06:06 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:33670) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1jL2AE-0001Hq-6G; Sun, 05 Apr 2020 06:06:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1jL2AD-0007rC-Vp; Sun, 05 Apr 2020 06:06:02 -0400 X-Loop: help-debbugs@gnu.org Subject: bug#35419: [O] [Proposal] Buffer Lenses and the Case of Org-Mode (also, Jupyter) Resent-From: Dmitrii Korobeinikov Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org, emacs-orgmode@gnu.org Resent-Date: Sun, 05 Apr 2020 10:06: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: Dmitry Gutov Received: via spool by 35419-submit@debbugs.gnu.org id=B35419.158608112730096 (code B ref 35419); Sun, 05 Apr 2020 10:06:01 +0000 Received: (at 35419) by debbugs.gnu.org; 5 Apr 2020 10:05:27 +0000 Received: from localhost ([127.0.0.1]:45216 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jL29f-0007pL-3K for submit@debbugs.gnu.org; Sun, 05 Apr 2020 06:05:27 -0400 Received: from mail-wm1-f48.google.com ([209.85.128.48]:35559) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jL29d-0007ov-Sk for 35419@debbugs.gnu.org; Sun, 05 Apr 2020 06:05:26 -0400 Received: by mail-wm1-f48.google.com with SMTP id i19so12596906wmb.0 for <35419@debbugs.gnu.org>; Sun, 05 Apr 2020 03:05:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=LgYS1j8Jy35QSeYIOi29s1pGROb3CIAI/he3OBpiFHM=; b=kf6gmJE06Xu6pX0YUfZKKlOmjFC0U+qkcqmmwJVgxQPTRweriSUCEpJsy4tMKjj7E2 /WZeMGUE0C6g3hNicTmSZOfHuR9JW3WkfXGk0wSYeLZ+NbaJDnKu4w7FYtd2ek2MTVM3 MwrarA4X//mF5vNupa5ztWP7gNOXY+OTDOLiSk8EQlorVsY1hnuqPLftbQkG9WrgDQ57 O8BGx3FofgiB/ASubPs9PUwYqw8oYQ+oIZtz42Bal4ZtO/xVWDpA+sk3ouajKlWkuvPs YjowK1Fa+RUi1yHFJxEYylBwcTiaUwa3+gkaUNm93OEHlr2sr0W+PRRpi7MOixBSTR9G y7ww== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=LgYS1j8Jy35QSeYIOi29s1pGROb3CIAI/he3OBpiFHM=; b=LA9Ccmzc2bnB4kJXh8eYxTGN1ImcGF8TbyAeHPhHASp5in4uoeD+gO9BWG3wK7wf/w lRNuFtA0UKNMr/o5IhHyURBeuXgKbKsaOlHjt9jOcs5wOB3YGJN6q7Jx6+Vy3KbW5vdz OnP7yDlESYTQsL8g8MaHGEsM9QWsq3gF2OPyFA33ZUTg4h90Oh4EcyndXp6v0dMcYg9O f1MFly8IpTHih77/BLylWbRatJF8IFmXaGvKhSjt1tEkygILs3JR9yxHMcep3n/63Ty9 Ht/nUmiKJB3Z96bWPR8JnH2nUu54x9wT4/GzUZP9YYDmeLOGSustF9u4rTLBtcbPUu0O y3kA== X-Gm-Message-State: AGi0PuZwQKPJjDo0ZqHXoJ21qfwfbCT+uPCjeIxqOj5V1NqsNyQTGDw5 u7eLpRkwDeZCnapkdrROqvtEEjHQ4/NLIjJv8+M= X-Google-Smtp-Source: APiQypLx9bjUiwsVvMqOMCNxyUu9QWcswX+Cj8LJ1ckEGP4DwfYuDAHfJ4Kh4BaRrCUG726Kk77XWfehGBIBEPjOg8E= X-Received: by 2002:a1c:6503:: with SMTP id z3mr7152239wmb.92.1586081120061; Sun, 05 Apr 2020 03:05:20 -0700 (PDT) MIME-Version: 1.0 References: <87v9z2ojf8.fsf@yantar92-laptop.i-did-not-set--mail-host-address--so-tickle-me> <4bb84e9a-7058-3deb-30f0-b4c8f337b116@yandex.ru> In-Reply-To: <4bb84e9a-7058-3deb-30f0-b4c8f337b116@yandex.ru> From: Dmitrii Korobeinikov Date: Sun, 5 Apr 2020 16:05:08 +0600 Message-ID: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable 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: Ihor Radchenko , 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=1586081207; 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=LgYS1j8Jy35QSeYIOi29s1pGROb3CIAI/he3OBpiFHM=; b=ZjgqazCtYGe6o9aSqHBp8N8bw/J0AjKbBAiNJTntL+/6fLswcOPgiCwG3Rc2g0GIwp5PbF SXfhDRnIODeKcT7M7mVyE48mKX4wzLKpbrKN18KSGLdPlRaSmjYzSrIzA0mP1p8e6/7Lst Hy5QK0nu693QU2pRa4B/bX1eAPoLS+I= ARC-Seal: i=1; s=default; d=yhetil.org; t=1586081207; a=rsa-sha256; cv=none; b=TK2slYwZhsCtr78GYUFc3qWg+s0W8i8jgzl0T/gqDOfTYgv95Ffus4DNlrmkOn0M8dUo6T fNsi3vWm+E4evq0QWVd2E/hkE6NuKUzR+GWBkNfZeRODwNaO/Hwtn41qoxgCeXP46PENtl 76n+ULZU0s1mr8NqnKTg1U5vBNa44Vg= ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail (rsa verify failed) header.d=gmail.com header.s=20161025 header.b=kf6gmJE0; 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=kf6gmJE0; dmarc=fail reason="SPF not aligned (relaxed)" header.from=gmail.com (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]; GENERIC_REPUTATION(0.00)[-0.58579847071069]; 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)[gmail.com]; 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)[yandex.ru]; 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]; FROM_NEQ_ENVFROM(0.00)[dim1212k@gmail.com,emacs-orgmode-bounces@gnu.org]; TAGGED_FROM(0.00)[larch=yhetil.org]; ARC_NA(0.00)[]; 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)[]; FREEMAIL_CC(0.00)[gmail.com,debbugs.gnu.org]; RCVD_COUNT_SEVEN(0.00)[9]; FORGED_SENDER_MAILLIST(0.00)[]; DMARC_POLICY_SOFTFAIL(0.10)[gmail.com : SPF not aligned (relaxed),none] X-TUID: C7W3wkeW4GBj Thank you for the insight and the references! Quite useful to learn about this stuff. =D0=B2=D1=81, 5 =D0=B0=D0=BF=D1=80. 2020 =D0=B3. =D0=B2 07:46, Dmitry Gutov= : > > 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 an= d > > 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, thoug= h.