far away in the heavenly abode of the
great god indra
there is a wonderful net which has been
hung by some cunning artificer
in such a manner that it stretches out
infinitely in all directions
in accordance with the extravagant
tastes of deities the artificer has hung
a single glittering jewel in each eye of
the net
and since the net itself is infinite the
jewels are infinite in number
there hang the jewels glittering like
stars in the first magnitude
a wonderful sight to behold were we to
select one of these jewels for
inspection
we would discover that in its polished
surface there are reflected
all the other jewels in the net infinite
in number
if we look still more closely we would
see that each of the jewels reflected in
this one jewel
reflects all the others this is the
metaphor of indra's net
which is told in some schools of
philosophy let's keep this metaphor in
mind
because it'll help us understand the
Emacs extension that we're about to
discuss
so in editing text there's two
main paradigms one
is um editing at the ground level
where the characters that we type
actually appear on the screen
the changes we make actually occur
[Music]
the other editing paradigm is where we
escape to a higher level
and now the characters that we type are
not
they don't actually appear on the screen
because we're not at the ground level
with the text we are at a higher level
looking down at the text
and regarding the text referring to
this world of text in terms of a
language
for instance we could describe this
world as having words and paragraphs and
sentences and
lines and so on and we could reason
about this
text in terms of these
textual entities and this textual
language
this is the second paradigm of text
editing
and when we're in the second paradigm
there is a way to go down to ground
level you hit enter
now or we'll hit enter to go down to the
ground level and you can hit escape
to go back out to the referential level
enter to go down to ground level
and escape to go up to the referential
level
now in vim the nouns
in this world of text all
share the same referential plane which
we call
normal mode so in normal mode all of the
nouns
of the world of text are available
whether it's words or sentences or
paragraphs
and they all share this same
referential plane and there's uh
they sort of compete for space on the
keyboard
um so an alternative uh
way to structure these modes is instead
of having a single mode where all the
nouns coexist
peacefully or otherwise you instead
have a dedicated mode for every noun
so in that case what happens is because
your modal spaces are now much smaller
you're just talking about words or
paragraphs or
lines or something the keys that you use
can be much more targeted
and you can use the same keystrokes in
in all of your modes and they would have
the same ideas behind them but
they would have different effects
depending on which context you're using
so it's the same keystrokes different
contexts
and the advantage of that is it's often
easier
to change context than it is to
learn new key bindings so let's see
an example of how that works we go into
character mode and if you look at the
mode
line at the bottom of the screen there
you'll see that we're in character mode
and now when we move up down left and
right we're moving by character
we can also transform the text and
the transformations occur in terms of
character
you can also go into word mode and in
word mode
the transformations that you do are on
words
and you try you your movement is also in
terms of words
so that's the level of granularity that
you have
you could also go to line mode and when
you're in line mode
you go up and down by line and you can
move
lines up and down left and right and so
on
and the transformations you do are in
terms of lines
you could also go to window mode where
now the objects that you're referring to
are windows and you can
move spatially amongst the windows or
make do transformations on the windows
using the same keystrokes
[Music]
um
so let's go to
um right and so um the one of the things
the the principles that play here is
something called the rumpelstiltskin
principle which is something
that's known in computer science which
is that if you can name something then
you have that you have power
then you have power over it so this is
kind of an adaptation of that principle
which says that if you can
name something and if you can talk about
it then it's a noun
[Music]
in your editing language and if it's a
noun then it has
it's a mode so if we can talk about it
it's a noun
if it's a noun then it's a mode and one
of the things we've been talking a lot
about
is modes so in fact
uh by this principle modes also
should be a mode
you should have a mode that can reason
in terms of modes as objects just like
you have
modes where you can reason in terms of
words or lines as objects
and so let's do that let's go to mode
mode
when you go to mode mode you see that uh
the objects that are depicted here are
the modes that are
that are present in the buffer
which we knew about um because the
style of editing that we had in this
buffer was the vim style of editing
where there's an insert mode at the
ground level and a normal mode that you
can escape
to you insert enter the ground level
enter to the insert mode and escape to
normal mode and when you look at the
mode mode
representation you see that in fact that
is the structure that's depicted
but in different situations you might
find
that you that these modes are not the
ones that you want you want something
more tailored for the specific
application
for instance if you're editing
[Music]
lisp code uh or or code in general but
list code is a particular example
you might want to take advantage of the
structure of
the code and for lisp code in particular
we have a mode called symax mode
which is able to reason
about your code in terms of its tree
structure
so you can use the same keystrokes hkl
goes
left right up and down but you also have
other keystrokes that are more
specialized to the application
and you can run the code and
we'll see that happen here in a minute
and you can make changes to it really
quickly
and see the effects of those changes
and you're doing this all in a mode
that's convenient for
this particular application which is
editing lisp code
and that is in this case symmex mode
so typically when you're editing code
like this you'd want to be
in insert mode actually typing out the
code
and then you'd want to escape to simex
mode rather than normal mode
and then you could escape again and
you'd end up in normal mode
so this if we go to mode mode we see is
depicted
as this tower where insert is at the
bottom and normal is at the top but
symmex mode is in between
the two you could also change that if
you like if you don't want cmx mode to
be there you could just
move it to the top and now you find some
mixes at the top and you enter down to
normal
you can see it on the status bar at the
bottom there enter to insert
escape to normal escape to symmex and
in fact you can even add more modes if
you don't like the existing ones
[Music]
and now we have an additional mode here
we have window mode it goes down to
symmex goes down to normal
enter the insert escape to normal escape
to smx escape the window
um so we've talked okay so another thing
actually to note here is that in editing
modes um
if you look at the mode line at the
bottom of the screen
you'll see that we are currently in this
buffer
we are currently in line mode
and I'm going to hit enter now and
you'll see that when I hit
enter nothing is happening it's still in
line mode
if you'd escape it's still in line mode
and you can find out the reason for that
by taking another meta jump out of this
and you'll see that in fact the reason
is that we're currently in line mode
and line mode is the only one available
in this tower
for editing the modes that are in
operation in your ground level
and in fact line mode is all you need
here because this is just
uh the nature of how these modes are
laid out is
in in rows and so line mode is the most
appropriate thing here
but you could change it to something
else if you like
[Music]
and then now we've seen two towers we've
seen
the vim tower and we've seen
also the symex tower the the lisp tower
and it turns out that because we've been
talking about towers now
by the rumpelstiltskin principle towers
also
um can be talked about
and therefore they also are a mode so
how do we go to tower mode
and the way we go tower mode is we do
we go in a slightly different direction
and we find that we are now in tower
mode
and we see that there are many towers
available so we're now
we're we're seeing several possible
towers that we have written
um to be available and for use in
different buffers and you can edit them
on the fly for instance let's enter this
tower
[Music]
and now you see that in the bottom of
the in the mode line you see that we're
going
across all of these different modes that
were in the tower
and you could escape and you could even
move things around you could put window
mode
all the way at the bottom right above
insert mode
let's see that happen there it is window
is right above insert
so on and the tower always reflects your
current position
so if you're in buffer mode here and you
go down to line mode
when you go back to mode mode you see
that we are in line mode
but in practice you wouldn't have a
tower this elaborate because
you'd rather have several smaller towers
you
enter that you alternate between
um okay so one
other thing of interest here is that
when you're in tower mode
if you look at the status line at the
bottom there we are currently
in buffer mode while we are in tower
mode
and tower mode actually isn't a mode
really neither is mode mode they're
really
referential planes or meta planes
um in any case you can see that we're in
buffer mode and we can take a meta jump
out of this to confirm
that buffer mode is the only mode
available
when we're editing towers because that's
the one
we need given that our towers are
represented
in individual buffers
right so let's uh let's see where we're
at
trump's still skin principle we talked
about mode mode
um we talked about the strange loop
application of
ground level modes in meta levels
[Music]
and yeah we saw the different towers and
in fact
you can we're currently in
vim tower
where you can go to Emacs tower and now
with a single keystroke you can
alternate
between e-max
and vim which are represented which are
modeled as towers
um
okay so
so there's uh the one thing that we've
sort of alluded to is that there are two
directions
that you can travel in when you're going
through this framework
one lev one direction is uh and we'll
visualize it with uh like so
there's two directions you can travel
and you can either go sideways or you
can go up and down
if you go sideways you're changing your
perspective
so normal mode word mode line mode
window mode and so on are all different
perspectives on your under on your
ground editing experience
and the other direction you can travel
in is up or down which takes you
through meta levels so you go from the
ground level editing experience
up to mode mode and then up to the tower
plane and so on
or uh yeah and so on
um yeah so this all sounds
very complex but the truth is
it's not really that complicated
even though it feels that way the reason
it isn't that complicated
is because no matter how many levels
up or down you go and no matter where
you are
whether you're in at the ground level
editing the actual text
or whether you're at a meta level some
unknown meta level and you don't know
where you are
no matter where you are the way in which
you interact with it
is the same at every level
and that is the great power of um
this approach is that
all of the different levels um are the
same
and in fact the complexity of the whole
is exactly identical to the
complexity of each part so if you know
how to edit words
in the ground level buffer and you know
how to move
lines around using line mode then you
know how to edit
any aspect of your editing experience at
any level
so
[Music]
um
so this is a pre-release demo this
doesn't exist on melpa
yet but you can follow updates um
at this repo on github
and if you can also be a beta tester or
something like that if you like that
would be very
uh helpful and you can learn more about
this at
dream.org which is where I house
the research that I work on and in
particular
the research on epistemic levels is what
inspired this particular Emacs extension
you can also learn about dialectical
inheritance attribution which is the
basis of
a new economic system that could be fair
and could lead to a prosperous and happy
world
and um yeah you can follow me on
twitter at countwajoula and
that's it thank you