From: Qiantan Hong <qhong@mit.edu>
To: Jean Louis <bugs@gnu.support>
Cc: "emacs-tangents@gnu.org" <emacs-tangents@gnu.org>
Subject: Re: Question: what is Emacs mode?
Date: Thu, 29 Apr 2021 03:39:34 +0000 [thread overview]
Message-ID: <4999D56A-85C0-4423-A23D-EDBAB4B538C4@mit.edu> (raw)
In-Reply-To: <YIPjZrX7F2dE+htj@protected.localdomain>
Thanks for Jean’s input!
Now I’m stuck on one particular design choice
> 3. Suppose we now have node-local variables and node-local modes, what’s the relation
> between those of parent nodes and child nodes?
> It seems natural to let child node inherit modes and variables from parent nodes.
> E.g., I might just turn on outline-mode on the ‘((Section title-A …)) node in
> (defun very-complex-function-that-require-a-paper ()
> ‘((Section title-A
> (Paragraph lorem ipsum)
> (Section subtitle-B
> (Paragraph lorem ipsum))))
> *code*)
> And it affects the whole sub-tree.
> However, are there cases that one don’t want a whole subtree to inherit a mode/variable?
> Can we safely assume they all get inherited?
I’m hitting an implementation problem when trying to implement the “inherit” model.
Because modes are stored as node-local variables (or, node-local environment),
it makes functions that have mode-specific advices/hooks installed searching up
through the document tree multiple time on every invocation.
One alternative is don’t implement “inherited” variables, but instead copy the surrounding
bindings when making new nodes, to fake “inherit”. This will cost lots of space however.
I have one way to improve the hopeless naive implementation of “inherited” model in mind.
The naive environment implementation is a deep-binding implementation. One can switch
to shallow-binding, maintaining the effective environment at selected node,
making variable accesses O(1). However, this is complicated by the fact that the structure
of our document tree is frequently changing, and getting it correct might be very difficult.
Any thoughts?
next prev parent reply other threads:[~2021-04-29 3:39 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-04-23 20:43 Question: what is Emacs mode? Qiantan Hong
2021-04-23 21:11 ` Jean Louis
2021-04-23 22:04 ` Qiantan Hong
2021-04-24 4:22 ` Jean Louis
2021-04-24 5:00 ` Qiantan Hong
2021-04-24 9:22 ` Jean Louis
2021-04-29 3:39 ` Qiantan Hong [this message]
2021-04-29 5:02 ` Jean Louis
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:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4999D56A-85C0-4423-A23D-EDBAB4B538C4@mit.edu \
--to=qhong@mit.edu \
--cc=bugs@gnu.support \
--cc=emacs-tangents@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* 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.
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).