WEBVTT 00:00:02.960 --> 00:00:04.644 "Far away in the heavenly abode 00:00:04.644 --> 00:00:06.560 of the great god Indra, 00:00:06.560 --> 00:00:07.688 there is a wonderful net 00:00:07.688 --> 00:00:10.160 which has been hung by some cunning artificer 00:00:10.160 --> 00:00:12.080 in such a manner that it stretches out 00:00:12.080 --> 00:00:14.320 infinitely in all directions. 00:00:14.320 --> 00:00:16.938 In accordance with the extravagant tastes of deities, 00:00:16.938 --> 00:00:18.240 the artificer has hung 00:00:18.240 --> 00:00:20.277 a single glittering jewel 00:00:20.277 --> 00:00:22.080 in each eye of the net, 00:00:22.080 --> 00:00:23.859 and since the net itself is infinite, 00:00:23.859 --> 00:00:26.480 the jewels are infinite in number. 00:00:26.480 --> 00:00:27.642 There hang the jewels, 00:00:27.642 --> 00:00:30.480 glittering like stars in the first magnitude, 00:00:30.480 --> 00:00:32.681 a wonderful sight to behold. 00:00:32.681 --> 00:00:35.680 Were we to select one of these jewels for inspection, 00:00:35.680 --> 00:00:38.216 we would discover that in its polished surface 00:00:38.216 --> 00:00:39.520 there are reflected 00:00:39.520 --> 00:00:41.451 all the other jewels in the net, 00:00:41.451 --> 00:00:43.360 infinite in number. 00:00:43.360 --> 00:00:45.140 If we look still more closely, 00:00:45.140 --> 00:00:48.960 we would see that each of the jewels reflected in this one jewel 00:00:48.960 --> 00:00:51.264 reflects all the others." 00:00:51.264 --> 00:00:54.000 This is the metaphor of Indra's Net, 00:00:54.000 --> 00:00:57.615 which is told in some schools of philosophy. 00:00:57.615 --> 00:01:00.160 Let's keep this metaphor in mind, 00:01:00.160 --> 00:01:01.773 because it'll help us understand 00:01:01.773 --> 00:01:06.960 the Emacs extension that we're about to discuss. 00:01:06.960 --> 00:01:12.810 In editing text, there's two main paradigms: 00:01:12.810 --> 00:01:16.880 one is editing at the ground level, 00:01:16.880 --> 00:01:19.439 where the characters that we type 00:01:19.439 --> 00:01:22.159 actually appear on the screen, 00:01:22.159 --> 00:01:25.960 the changes we make actually occur. 00:01:28.479 --> 00:01:30.126 The other editing paradigm 00:01:30.126 --> 00:01:33.439 is where we escape to a higher level 00:01:33.439 --> 00:01:36.479 and now the characters that we type are not... 00:01:36.479 --> 00:01:39.040 They don't actually appear on the screen 00:01:39.040 --> 00:01:42.748 because we're not at the ground level with the text, 00:01:42.748 --> 00:01:44.799 we are at a higher level 00:01:44.799 --> 00:01:48.479 looking down at the text 00:01:48.479 --> 00:01:50.773 and regarding the text, 00:01:50.773 --> 00:01:56.159 referring to this world of text in terms of a language. 00:01:56.159 --> 00:01:57.920 For instance, we could describe this 00:01:57.920 --> 00:02:03.404 world as having words and paragraphs and sentences and lines and so on. 00:02:03.404 --> 00:02:05.985 We could reason about this text 00:02:05.985 --> 00:02:13.120 in terms of these textual entities and this textual language. 00:02:13.120 --> 00:02:18.640 This is the second paradigm of text editing. 00:02:18.640 --> 00:02:22.800 When we're in the second paradigm, 00:02:22.800 --> 00:02:25.304 there is a way to go down to ground level. 00:02:25.304 --> 00:02:28.997 You hit Enter now--or we'll hit Enter to go down to the ground level, 00:02:28.997 --> 00:02:30.480 and you can hit Escape 00:02:30.480 --> 00:02:33.200 to go back out to the referential level. 00:02:33.200 --> 00:02:35.200 Enter to go down to ground level 00:02:35.200 --> 00:02:40.160 and Escape to go up to the referential level. 00:02:40.160 --> 00:02:47.565 Now, in Vim, the nouns in this world of text 00:02:47.565 --> 00:02:52.319 all share the same referential plane which we call normal mode. 00:02:52.319 --> 00:02:54.959 So in normal mode, all of the nouns 00:02:54.959 --> 00:02:57.360 of the world of text are available, 00:02:57.360 --> 00:03:00.959 whether it's words or sentences or paragraphs, 00:03:00.959 --> 00:03:08.319 and they all share this same referential plane. 00:03:08.319 --> 00:03:12.720 They compete for space on the keyboard. 00:03:12.720 --> 00:03:17.037 An alternative way to structure these modes is 00:03:17.037 --> 00:03:21.840 instead of having a single mode where all the nouns coexist, 00:03:21.840 --> 00:03:24.005 peacefully or otherwise, 00:03:24.005 --> 00:03:30.400 you instead have a dedicated mode for every noun. 00:03:30.400 --> 00:03:32.540 In that case, what happens is 00:03:32.540 --> 00:03:35.440 because your modal spaces are now much smaller, 00:03:35.440 --> 00:03:40.593 you're just talking about words or paragraphs or lines or something, 00:03:40.593 --> 00:03:42.560 the keys that you use 00:03:42.560 --> 00:03:45.760 can be much more targeted. 00:03:45.760 --> 00:03:48.560 You can use the same keystrokes 00:03:48.560 --> 00:03:50.400 in all of your modes and they would have 00:03:50.400 --> 00:03:51.845 the same ideas behind them, 00:03:51.845 --> 00:03:53.280 but they would have different effects 00:03:53.280 --> 00:03:55.519 depending on which context you're using. 00:03:55.519 --> 00:03:59.120 It's the same keystrokes, different contexts. 00:03:59.120 --> 00:04:04.244 The advantage of that is it's often easier to change context 00:04:04.244 --> 00:04:07.888 than it is to learn new key bindings. 00:04:07.888 --> 00:04:11.289 So let's see an example of how that works. 00:04:11.289 --> 00:04:14.039 We go into character mode, and if you look at the mode line 00:04:14.039 --> 00:04:15.439 at the bottom of the screen there, 00:04:15.439 --> 00:04:18.720 you'll see that we're in character mode. 00:04:18.720 --> 00:04:21.955 Now, when we move up, down, left, and right, 00:04:21.955 --> 00:04:23.919 we're moving by character. 00:04:23.919 --> 00:04:28.088 We can also transform the text, 00:04:28.088 --> 00:04:32.400 and the transformations occur in terms of character. 00:04:32.400 --> 00:04:34.207 You can also go into word mode. 00:04:34.207 --> 00:04:40.000 In word mode, the transformations that you do are on words. 00:04:40.000 --> 00:04:43.440 and you try... Your movement is also in terms of words. 00:04:43.440 --> 00:04:46.560 So that's the level of granularity that you have. 00:04:46.560 --> 00:04:49.191 You could also go to line mode. 00:04:49.191 --> 00:04:50.720 When you're in line mode, 00:04:50.720 --> 00:04:52.901 you go up and down by line, 00:04:52.901 --> 00:04:54.240 and you can move lines 00:04:54.240 --> 00:04:57.520 up and down left and right and so on. 00:04:59.120 --> 00:05:00.880 The transformations you do are in 00:05:00.880 --> 00:05:02.800 terms of lines. 00:05:02.800 --> 00:05:07.682 You could also go to window mode, 00:05:07.682 --> 00:05:11.695 where now the objects that you're referring to are windows. 00:05:11.695 --> 00:05:15.578 You can move spatially amongst the windows 00:05:15.578 --> 00:05:17.520 or do transformations on the windows 00:05:17.520 --> 00:05:20.850 using the same keystrokes. 00:05:25.360 --> 00:05:28.720 So let's go to... 00:05:28.720 --> 00:05:32.800 Right. One of the things, 00:05:32.800 --> 00:05:35.114 the principles at play here 00:05:35.114 --> 00:05:37.266 is something called the Rumpelstiltskin principle, 00:05:37.266 --> 00:05:40.720 which is something that's known in computer science. 00:05:40.720 --> 00:05:42.113 If you can name something, 00:05:42.113 --> 00:05:45.824 then you have power over it. 00:05:45.824 --> 00:05:48.560 This is kind of an adaptation of that principle 00:05:48.560 --> 00:05:51.123 which says that if you can name something 00:05:51.123 --> 00:05:52.572 and if you can talk about it, 00:05:52.572 --> 00:05:56.334 then it's a noun in your editing language. 00:05:56.334 --> 00:05:58.960 If it's a noun, then it has... 00:05:58.960 --> 00:06:02.319 It's a mode. So if we can talk about it, it's a noun. 00:06:02.319 --> 00:06:04.818 If it's a noun, then it's a mode. 00:06:04.818 --> 00:06:08.919 One of the things we've been talking a lot about is modes. 00:06:08.919 --> 00:06:12.699 In fact, by this principle, 00:06:12.699 --> 00:06:17.280 modes also should be a mode. 00:06:17.280 --> 00:06:19.039 You should have a mode that can reason 00:06:19.039 --> 00:06:20.639 in terms of modes as objects, 00:06:20.639 --> 00:06:22.300 just like you have modes 00:06:22.300 --> 00:06:23.759 where you can reason in terms of 00:06:23.759 --> 00:06:26.560 words or lines as objects. 00:06:26.560 --> 00:06:30.479 So let's do that. Let's go to mode mode. 00:06:30.479 --> 00:06:34.000 When you go to mode mode, you see that 00:06:34.000 --> 00:06:35.915 the objects that are depicted here 00:06:35.915 --> 00:06:40.960 are the modes that are present in the buffer, 00:06:40.960 --> 00:06:44.500 which we knew about because 00:06:44.500 --> 00:06:46.797 the style of editing that we had in this buffer 00:06:46.797 --> 00:06:48.720 was the Vim style of editing 00:06:48.720 --> 00:06:51.143 where there's an insert mode at the ground level 00:06:51.143 --> 00:06:53.039 and a normal mode that you can escape to. 00:06:53.039 --> 00:06:57.280 You insert, enter the ground level. 00:06:57.280 --> 00:07:01.352 Enter to the insert mode and escape to normal mode. 00:07:01.352 --> 00:07:04.647 When you look at the mode mode representation, 00:07:04.647 --> 00:07:06.160 you see that in fact that 00:07:06.160 --> 00:07:10.479 is the structure that's depicted. 00:07:10.479 --> 00:07:14.080 But in different situations, you might find 00:07:14.080 --> 00:07:16.080 that these modes are not the 00:07:16.080 --> 00:07:16.922 ones that you want. 00:07:16.922 --> 00:07:20.880 You want something more tailored for the specific application. 00:07:20.880 --> 00:07:25.065 For instance, if you're editing Lisp code 00:07:25.065 --> 00:07:27.360 (or code in general, but 00:07:27.360 --> 00:07:30.880 Lisp code is a particular example), 00:07:30.880 --> 00:07:32.640 you might want to take advantage 00:07:32.640 --> 00:07:34.852 of the structure of the code. 00:07:34.852 --> 00:07:37.599 For Lisp code in particular, 00:07:37.599 --> 00:07:40.960 we have a mode called symex-mode 00:07:40.960 --> 00:07:45.414 which is able to reason about your code 00:07:45.414 --> 00:07:47.919 in terms of its tree structure. 00:07:47.919 --> 00:07:52.397 So you can use the same keystrokes: hjkl goes left, right, up, and down, 00:07:52.397 --> 00:07:58.080 but you also have other keystrokes that are more specialized to the application. 00:07:58.080 --> 00:08:01.520 You can run the code. 00:08:01.520 --> 00:08:06.960 We'll see that happen here in a minute. 00:08:06.960 --> 00:08:12.240 You can make changes to it really quickly 00:08:12.240 --> 00:08:18.000 and see the effects of those changes. 00:08:18.000 --> 00:08:19.440 You're doing this all in a mode 00:08:19.440 --> 00:08:22.625 that's convenient for this particular application, 00:08:22.625 --> 00:08:25.039 which is editing Lisp code, 00:08:25.039 --> 00:08:28.960 and that is, in this case, symex-mode. 00:08:28.960 --> 00:08:31.631 Typically, when you're editing code like this, 00:08:31.631 --> 00:08:33.435 you'd want to be in insert mode 00:08:33.435 --> 00:08:36.640 actually typing out the code, 00:08:36.640 --> 00:08:40.959 and then you'd want to escape to symex mode rather than normal mode, 00:08:40.959 --> 00:08:42.021 and then you could escape again 00:08:42.021 --> 00:08:44.080 and you'd end up in normal mode. 00:08:44.080 --> 00:08:48.000 So this, if we go to mode mode, we see is depicted 00:08:48.000 --> 00:08:51.040 as this tower where insert is at the 00:08:51.040 --> 00:08:52.604 bottom and normal is at the top, 00:08:52.604 --> 00:08:55.305 but symex-mode is in between the two. 00:08:55.305 --> 00:08:57.551 You could also change that if you like. 00:08:57.551 --> 00:08:59.566 If you don't want symex-mode to be there, 00:08:59.566 --> 00:09:02.187 you could just move it to the top. 00:09:02.187 --> 00:09:04.392 Now you find symex is at the top 00:09:04.392 --> 00:09:06.160 and you enter down to normal. 00:09:06.160 --> 00:09:08.848 You can see it on the status bar at the bottom there. 00:09:08.848 --> 00:09:13.839 Enter to insert, escape to normal, escape to symex. 00:09:13.839 --> 00:09:16.344 In fact, you can even add more modes 00:09:16.344 --> 00:09:19.380 if you don't like the existing ones. 00:09:21.519 --> 00:09:23.839 Now we have an additional mode here. 00:09:23.839 --> 00:09:25.855 We have window mode. It goes down to symex, 00:09:25.855 --> 00:09:27.519 it goes down to normal. 00:09:27.519 --> 00:09:29.919 Enter the insert, escape to normal, 00:09:29.919 --> 00:09:33.600 escape to symex, escape to window. 00:09:33.600 --> 00:09:41.232 So we've talked... Okay, so another thing actually to note here 00:09:41.232 --> 00:09:45.360 is that in editing modes, 00:09:45.360 --> 00:09:46.486 if you look at the mode line 00:09:46.486 --> 00:09:48.399 at the bottom of the screen, 00:09:48.399 --> 00:09:50.257 you'll see that we are currently, 00:09:50.257 --> 00:09:51.519 in this buffer, 00:09:51.519 --> 00:09:54.560 we are currently in line mode. 00:09:54.560 --> 00:09:57.296 I'm going to hit Enter now 00:09:57.296 --> 00:09:59.119 and you'll see that when I hit Enter, 00:09:59.119 --> 00:10:00.627 nothing is happening. 00:10:00.627 --> 00:10:02.160 It's still in line mode. 00:10:02.160 --> 00:10:05.120 If you hit Escape, it's still in line mode. 00:10:05.120 --> 00:10:07.200 You can find out the reason for that 00:10:07.200 --> 00:10:10.640 by taking another meta jump out of this. 00:10:10.640 --> 00:10:12.800 You'll see that, in fact, the reason 00:10:12.800 --> 00:10:15.279 is that we're currently in line mode, 00:10:15.279 --> 00:10:17.360 and line mode is the only one available 00:10:17.360 --> 00:10:19.519 in this tower 00:10:19.519 --> 00:10:21.556 for editing the modes that are 00:10:21.556 --> 00:10:24.880 in operation in your ground level. 00:10:24.880 --> 00:10:26.898 In fact, line mode is all you need here, 00:10:26.898 --> 00:10:32.796 because this is just the nature of how these modes are laid out is in rows. 00:10:32.796 --> 00:10:36.399 So line mode is the most appropriate thing here. 00:10:36.399 --> 00:10:39.740 But you could change it to something else if you like. 00:10:40.959 --> 00:10:43.659 Now we've seen two towers. 00:10:43.659 --> 00:10:53.680 We've seen the Vim tower and we've seen also the symex tower, the Lisp tower. 00:10:53.680 --> 00:10:58.880 It turns out that, because we've been talking about towers now, 00:10:58.880 --> 00:11:06.399 by the Rumpelstiltskin principle, towers also can be talked about, 00:11:06.399 --> 00:11:09.127 and therefore they also are a mode. 00:11:09.127 --> 00:11:11.200 So how do we go to tower mode? 00:11:11.200 --> 00:11:14.640 The way we go to tower mode is 00:11:14.640 --> 00:11:19.200 we go in a slightly different direction, 00:11:19.200 --> 00:11:23.360 and we find that we are now in tower mode. 00:11:23.360 --> 00:11:29.279 We see that there are many towers available. We're now... 00:11:29.279 --> 00:11:33.440 We're seeing several possible towers 00:11:33.440 --> 00:11:40.344 that we have written to be available and for use in different buffers. 00:11:40.344 --> 00:11:42.110 You can edit them on the fly. 00:11:42.110 --> 00:11:46.630 For instance, let's enter this tower. 00:11:48.000 --> 00:11:50.180 Now you see that in the bottom of the... 00:11:50.180 --> 00:11:51.519 In the mode line, you see that we're 00:11:51.519 --> 00:11:53.944 going across all of these different modes 00:11:53.944 --> 00:11:56.480 that were in the tower. 00:11:56.480 --> 00:11:59.724 You could escape and you could even move things around. 00:11:59.724 --> 00:12:00.880 You could put window mode 00:12:00.880 --> 00:12:02.573 all the way at the bottom, 00:12:02.573 --> 00:12:04.079 right above insert mode. 00:12:04.079 --> 00:12:06.479 Let's see that happen. There it is, 00:12:06.479 --> 00:12:10.444 window is right above insert, and so on. 00:12:10.444 --> 00:12:14.240 The tower always reflects your current position, 00:12:14.240 --> 00:12:17.600 so if you're in buffer mode here and you go down to line mode, 00:12:17.600 --> 00:12:22.480 when you go back to mode mode, you see that we are in line mode. 00:12:22.480 --> 00:12:25.620 But in practice, you wouldn't have a tower this elaborate 00:12:25.620 --> 00:12:29.440 because you'd rather have several smaller towers you enter, 00:12:29.440 --> 00:12:33.360 that you alternate between. 00:12:33.360 --> 00:12:39.839 Okay. So one other thing of interest here is that 00:12:39.839 --> 00:12:42.240 when you're in tower mode, 00:12:42.240 --> 00:12:44.740 if you look at the status line at the bottom there, 00:12:44.740 --> 00:12:49.839 we are currently in buffer mode while we are in tower mode. 00:12:49.839 --> 00:12:53.151 Tower mode actually isn't a mode really. Neither is mode mode. 00:12:53.151 --> 00:12:58.000 They're really referential planes or meta planes. 00:12:58.000 --> 00:13:01.679 In any case, you can see that we're in buffer mode. 00:13:01.679 --> 00:13:03.840 We can take a meta jump out of this 00:13:03.840 --> 00:13:08.000 to confirm that buffer mode is the only mode available 00:13:08.000 --> 00:13:09.664 when we're editing towers 00:13:09.664 --> 00:13:11.915 because that's the one we need, 00:13:11.915 --> 00:13:23.200 given that our towers are represented in individual buffers. 00:13:23.200 --> 00:13:26.320 Right. So let's see where we're at. 00:13:26.320 --> 00:13:27.785 Rumpelstiltskin principle... 00:13:27.785 --> 00:13:30.160 We talked about mode mode. 00:13:30.160 --> 00:13:32.240 We talked about the strange loop 00:13:32.240 --> 00:13:37.820 application of ground level modes in meta levels. 00:13:39.600 --> 00:13:41.992 We saw the different towers, 00:13:41.992 --> 00:13:50.720 and in fact, we're currently in Vim tower, 00:13:50.720 --> 00:13:52.860 where you can go to Emacs tower. 00:13:52.860 --> 00:13:54.720 Now, with a single keystroke, you can 00:13:54.720 --> 00:13:59.695 alternate between Emacs and Vim, 00:13:59.695 --> 00:14:01.638 which are represented-- 00:14:01.638 --> 00:14:05.519 which are modeled as towers. 00:14:13.360 --> 00:14:14.760 So there's... One thing 00:14:14.760 --> 00:14:18.160 that we've sort of alluded to is that there are two directions 00:14:18.160 --> 00:14:19.494 that you can travel in 00:14:19.494 --> 00:14:22.399 when you're going through this framework. 00:14:22.399 --> 00:14:33.760 One direction is--and we'll visualize it like so... 00:14:33.760 --> 00:14:35.120 There's two directions you can travel, 00:14:35.120 --> 00:14:37.040 and you can either go sideways or you 00:14:37.040 --> 00:14:38.399 can go up and down. 00:14:38.399 --> 00:14:41.680 If you go sideways, you're changing your perspective. 00:14:41.680 --> 00:14:45.440 So normal mode, word mode, line mode, 00:14:45.440 --> 00:14:46.544 window mode, and so on 00:14:46.544 --> 00:14:51.680 are all different perspectives on your ground editing experience. 00:14:51.680 --> 00:14:53.265 The other direction you can travel in 00:14:53.265 --> 00:14:56.811 is up or down, which takes you through meta levels. 00:14:56.811 --> 00:14:59.600 So you go from the ground level editing experience, 00:14:59.600 --> 00:15:07.040 up to mode mode, and then up to the tower plane, and so on, and so on. 00:15:07.040 --> 00:15:12.568 So this all sounds very complex, 00:15:12.568 --> 00:15:18.160 but the truth is it's not really that complicated, 00:15:18.160 --> 00:15:20.699 even though it feels that way. 00:15:20.699 --> 00:15:22.959 The reason it isn't that complicated 00:15:22.959 --> 00:15:26.480 is because no matter how many levels 00:15:26.480 --> 00:15:30.160 up or down you go and no matter where you are, 00:15:30.160 --> 00:15:32.399 whether you're in at the ground level 00:15:32.399 --> 00:15:34.079 editing the actual text 00:15:34.079 --> 00:15:35.802 or whether you're at a meta level, 00:15:35.802 --> 00:15:39.279 some unknown meta level and you don't know where you are, 00:15:39.279 --> 00:15:41.133 no matter where you are, 00:15:41.133 --> 00:15:44.399 the way in which you interact with it 00:15:44.399 --> 00:15:47.519 is the same at every level. 00:15:47.519 --> 00:15:54.751 That is the great power of this approach: 00:15:54.751 --> 00:16:00.880 that all of the different levels are the same. 00:16:00.880 --> 00:16:03.839 In fact, the complexity of the whole 00:16:03.839 --> 00:16:05.545 is exactly identical to 00:16:05.545 --> 00:16:07.657 the complexity of each part, 00:16:07.657 --> 00:16:10.000 so if you know how to edit words 00:16:10.000 --> 00:16:12.048 in the ground level buffer 00:16:12.048 --> 00:16:15.378 and you know how to move lines around using line mode, 00:16:15.378 --> 00:16:22.800 then you know how to edit any aspect of your editing experience at any level. 00:16:30.079 --> 00:16:31.780 So this is a pre-release demo. 00:16:31.780 --> 00:16:40.079 This doesn't exist on MELPA yet, but you can follow updates at this repo on github. 00:16:40.079 --> 00:16:43.850 If you can also be a beta tester 00:16:43.850 --> 00:16:46.775 or something like that, if you like, that would be very helpful. 00:16:46.775 --> 00:16:50.560 You can learn more about this at 00:16:50.560 --> 00:16:53.920 drym.org, which is where I house 00:16:53.920 --> 00:16:55.726 the research that I work on. 00:16:55.726 --> 00:17:00.154 In particular, the research on epistemic levels 00:17:00.154 --> 00:17:03.600 is what inspired this particular Emacs extension. 00:17:03.600 --> 00:17:05.600 You can also learn about 00:17:05.600 --> 00:17:10.880 dialectical inheritance attribution, which is the basis of 00:17:10.880 --> 00:17:14.559 a new economic system that could be fair 00:17:14.559 --> 00:17:19.439 and could lead to a prosperous and happy world. 00:17:19.439 --> 00:17:26.319 You can follow me on Twitter at @countvajhula. 00:17:26.319 --> 00:17:31.919 That's it! Thank you.