unofficial mirror of emacs-tangents@gnu.org
 help / color / mirror / Atom feed
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: Fri, 23 Apr 2021 22:04:36 +0000	[thread overview]
Message-ID: <79668953-FBBB-4843-A5FD-C39E08B50CCC@mit.edu> (raw)
In-Reply-To: <YIM3+PID3VX81Mla@protected.localdomain>

> Is it editor or OS?
> 
> From Emacs user viewpoint that abbreviation "editor/OS" actually makes
> sense as Emacs could be, almost could be the OS itself. 
Yes, and my understanding is that as long as some software commit to
a statement of the form “everything is X” (I call it ontology),
it will become an OS (because people will do everything with X).

- UNIX commit to “everything is file, aka big bagged of unstructured bits”

- Emacs (maybe unintentionally) makes everything text (with some attached 
text-properties). Alas now people are using text (w/ properties) 
to make outlines, tables, images…

- Browsers makes every data XML and every code JavaScript (line between
code and data is a little blurred, but definitely not like Lisp). You get what you 
get.

- Smalltalk commit to “everything is object”. And you get OS also.

This understanding is exactly what motivate me to start designing my
own editor/OS/computing environment. Now when you spell out the “X”
in “everything is X”, IMO it become apparent that the above examples
don’t make particularly good choices.

Everyone knows UNIX sucks (unstructured bits err), browser sucks
(no homoiconicity). Smalltalk lack a good editing protocol for
standard objects (you can’t forward-sexp backward-sexp to roam
in the object graph), while Emacs isn’t that structured. In fact, Emacs
is just a little bit better than UNIX in terms of ontology.

That makes me wonder if we can make a better environment by
committing to “everything *visual* is s-expr” (I don’t want to make
everything in the system s-expr, because sometimes hash tables and
vectors are fast. There’s a present/recognize system to map them
to visual s-expr when user want to see them). 
And then one can use the standard structured s-expr editing commands
to edit the whole live system.
The model is kind of like CLIM, except that it’s much more, because
CLIM doesn’t touch editing of presentations (the original AITR 794 did).

>> And finally, let me give the context that all those question arises:
>> I want to clean up the Emacs model, and apply it to a S-exp (tree)
>> based editor. So the practical question is: Can we find a
>> cleaner/more elegant version of the Emacs model, and generalize it
>> to tree document structure? Will we have node-local variables,
>> node-local modes, etc? If so, how will all those "attachments"
>> interact between, say, parents and children nodes?
> 
> I do understand the intention. Not that it is clearly explained.
> 
> Can you tell more about storing things in the tree?

As I said above, I’m going to use s-expr as the primary data structure,
a document is just an s-expr. That opens up some new possibilities 
but also associated problems:

(I just realized I think I answered most of them myself, but I’m not confident
with my answers)

1. Do we want node-local modes? 
    That looks very natural to have. We may edit our code using sexp-mode,
    but inside docstring, we could use doc-mode locally.
    This also covers lots of thing in Emacs that were done using text-properties.
    E.g. bold-mode and background-color-mode (not sure if they’re good idea though).

2. If we have node-local modes, what about node-local variables?
    Virtually all modes use buffer local variables. If we have node-local modes,
    do they all share the buffer-local environment? That sounds like a mess.
    This is one point where I can’t decide between introducing node-local variables,
    or try to figure out a “cleaner” version of modes that don’t need *-local variables.

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?

If we assume yes, then we arrives at node-local first-class environment.
Each node may have an environment, chained to the environment of its parent.
It turns out that we don’t seem to need seperate window management as well,
each frame can just display a *frame-root-sexp* in window-mode, and some of it
child turns on buffer-mode, which essentially becomes buffers.

This raises another questions though. Apparently window-mode and buffer-mode
need to be exclusive. In emacs, there is one and only one exclusive set of modes,
managed by the major-mode variable. Are we sure there only need to be one exclusive set?

  reply	other threads:[~2021-04-23 22:04 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 [this message]
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
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=79668953-FBBB-4843-A5FD-C39E08B50CCC@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).