diff options
Diffstat (limited to '2022/captions')
13 files changed, 9687 insertions, 0 deletions
diff --git a/2022/captions/emacsconf-2022-asmblox--asmblox-a-game-based-on-webassembly-that-no-one-asked-for--zachary-romero--main.vtt b/2022/captions/emacsconf-2022-asmblox--asmblox-a-game-based-on-webassembly-that-no-one-asked-for--zachary-romero--main.vtt new file mode 100644 index 00000000..ef640bf3 --- /dev/null +++ b/2022/captions/emacsconf-2022-asmblox--asmblox-a-game-based-on-webassembly-that-no-one-asked-for--zachary-romero--main.vtt @@ -0,0 +1,874 @@ +WEBVTT captioned by sachac + +00:00:00.000 --> 00:00:03.800 +Hi, I'm Zach and today I'll be giving + +00:00:03.800 --> 00:00:05.320 +a presentation on asm-blox, + +00:00:05.320 --> 00:00:08.960 +a programming game inspired by WebAssembly. + +00:00:08.960 --> 00:00:10.840 +So programming games came into prominence + +00:00:10.840 --> 00:00:13.160 +about a decade ago and are loved for providing + +00:00:13.160 --> 00:00:14.760 +interesting programming challenges + +00:00:14.760 --> 00:00:17.160 +without all the messiness of real world programming. + +00:00:17.160 --> 00:00:19.960 +I wanted to make a programming game + +00:00:19.960 --> 00:00:24.880 +and I decided to base it off of TIS-100, + +00:00:24.880 --> 00:00:28.240 +having a pretty basic UI. + +00:00:28.240 --> 00:00:30.680 +It seemed pretty doable in Emacs. + +00:00:30.680 --> 00:00:33.160 +TIS 100 is a programming game + +00:00:33.160 --> 00:00:35.760 +where you write a fictional assembly language + +00:00:35.760 --> 00:00:37.280 +into a grid of cells which can each + +00:00:37.280 --> 00:00:39.480 +communicate with one another, + +00:00:39.480 --> 00:00:41.200 +you're tasked with solving + +00:00:41.200 --> 00:00:44.960 +fairly simple CS 101 like problems. + +00:00:44.960 --> 00:00:48.440 +To mix things up a bit I decided to base + +00:00:48.440 --> 00:00:49.800 +the language of asm-blox off of + +00:00:49.800 --> 00:00:52.520 +WebAssembly, which is stack based, + +00:00:52.520 --> 00:00:55.360 +as opposed to TIS-100 which is registered based. + +00:00:55.360 --> 00:00:59.200 +Here you can see the same program + +00:00:59.200 --> 00:01:01.680 +written in the game TIS-100, + +00:01:01.680 --> 00:01:03.960 +what it looks like in asm-blox, + +00:01:03.960 --> 00:01:08.040 +and the original WebAssembly that it's based off of. + +00:01:08.040 --> 00:01:10.640 +With that said, let's get into a demo. + +00:01:10.640 --> 00:01:12.240 +This is the game board. + +00:01:12.240 --> 00:01:14.120 +It's a 4 by 3 grid. + +00:01:14.120 --> 00:01:16.840 +Each cell has a stack of size 4. + +00:01:16.840 --> 00:01:20.280 +First off, I'll show some of the stack editing commands. + +00:01:20.280 --> 00:01:23.760 +We can add a value with the const function. + +00:01:23.760 --> 00:01:27.480 +Here we're adding two values to this stack + +00:01:27.480 --> 00:01:33.400 +to get added, and eventually the stack gets overflowed. + +00:01:33.400 --> 00:01:37.360 +We can fix that as follows with the clear command, + +00:01:37.360 --> 00:01:40.720 +so that clears the stack. + +00:01:40.720 --> 00:01:43.200 +We can duplicate values on the stack. + +00:01:43.200 --> 00:01:45.600 +This duplicates the item at the bottom of the stack. + +00:01:45.600 --> 00:01:48.880 +10 gets put on, 20 gets put on, + +00:01:48.880 --> 00:01:50.200 +then 10 will get duplicated + +00:01:50.200 --> 00:01:52.680 +and put on the top of the stack. + +00:01:52.680 --> 00:01:55.920 +We can increment. For example, this increments + +00:01:55.920 --> 00:01:58.760 +the second to bottom, the second to bottom + +00:01:58.760 --> 00:01:59.920 +from the stack. + +00:01:59.920 --> 00:02:04.400 +So 10, 20, increment that, clear. + +00:02:04.400 --> 00:02:07.640 +That's basic stack operations. + +00:02:07.640 --> 00:02:11.000 +Next up, we have numeric commands. + +00:02:11.000 --> 00:02:12.560 +For example, here, if we add "add", + +00:02:12.560 --> 00:02:14.680 +it pops two values off the stack, + +00:02:14.680 --> 00:02:17.080 +adds them, and pushes the result on. + +00:02:17.080 --> 00:02:20.680 +Another way we can write this is as follows. + +00:02:20.680 --> 00:02:22.480 +We can have the add here + +00:02:22.480 --> 00:02:26.400 +and then nest the two constants, + +00:02:26.400 --> 00:02:28.520 +and then this does the same thing. + +00:02:28.520 --> 00:02:31.720 +First, the inner constant operations run, + +00:02:31.720 --> 00:02:35.520 +and then the outer add operation runs. + +00:02:35.520 --> 00:02:40.280 +We can nest as deeply as we want. + +00:02:40.280 --> 00:02:44.680 +There's also subtraction, multiplication, and whatnot. + +00:02:44.680 --> 00:02:46.480 +Next up are Boolean operations. + +00:02:46.480 --> 00:02:49.080 +Zero counts as true. + +00:02:49.080 --> 00:02:51.720 +Anything else--sorry, zero counts as false. + +00:02:51.720 --> 00:02:52.760 +Anything else is true. + +00:02:52.760 --> 00:03:01.840 +For example, this would give us false and true, + +00:03:01.840 --> 00:03:04.040 +so that result should be false. + +00:03:04.040 --> 00:03:06.120 +Zero gets put on the stack, + +00:03:06.120 --> 00:03:08.160 +one gets put on, and then the "and" operation. + +00:03:08.160 --> 00:03:12.840 +So there's also or, not, + +00:03:12.840 --> 00:03:17.760 +and various numerical comparison operations + +00:03:17.760 --> 00:03:21.400 +like greater than and less than. + +00:03:21.400 --> 00:03:22.880 +Next up are the port operations. + +00:03:22.880 --> 00:03:27.320 +We can send values to other cells as follows. + +00:03:27.320 --> 00:03:29.600 +Here we create a value + +00:03:29.600 --> 00:03:33.640 +and then send it right. + +00:03:33.640 --> 00:03:35.040 +Let's run this. + +00:03:35.040 --> 00:03:37.480 +The 10 goes on the stack, + +00:03:37.480 --> 00:03:38.480 +and then it gets sent to the right. + +00:03:38.480 --> 00:03:41.360 +Here it's waiting for this cell to pick it up. + +00:03:41.360 --> 00:03:44.360 +It can pick it up just as follows. + +00:03:44.360 --> 00:03:47.480 +So left... and then why don't we have it + +00:03:47.480 --> 00:03:49.520 +drop that value after it gets it. + +00:03:49.520 --> 00:03:53.920 +So the 10 gets sent to the right. + +00:03:53.920 --> 00:04:00.240 +This one picks it up and drops it. + +00:04:00.240 --> 00:04:03.200 +Lastly, we have control flow, + +00:04:03.200 --> 00:04:04.280 +which is a bit tricky, + +00:04:04.280 --> 00:04:06.880 +but with this visual, + +00:04:06.880 --> 00:04:08.440 +it helps explain it. + +00:04:08.440 --> 00:04:12.280 +There are two block constructs, "block" and "loop", + +00:04:12.280 --> 00:04:16.880 +and there's two jumping constructs, "br" and "brif". + +00:04:16.880 --> 00:04:23.120 +So if "loop" is jumped to, + +00:04:23.120 --> 00:04:25.360 +the control flow goes to the beginning, + +00:04:25.360 --> 00:04:26.520 +the top of the loop. + +00:04:26.520 --> 00:04:28.640 +If a block is jumped to, + +00:04:28.640 --> 00:04:31.520 +it goes to the end of the block, + +00:04:31.520 --> 00:04:33.640 +and these various blocks + +00:04:33.640 --> 00:04:36.520 +are identified by their level of nestedness. + +00:04:36.520 --> 00:04:40.640 +From the point of view of this jump statement, + +00:04:40.640 --> 00:04:45.160 +this "br" statement, this is block level 0, + +00:04:45.160 --> 00:04:46.440 +this is 1, this is 2. + +00:04:46.440 --> 00:04:49.560 +So here, "br 1" would be referring to this loop. + +00:04:49.560 --> 00:04:51.080 +What this [br 1] would do is, + +00:04:51.080 --> 00:04:54.000 +it would jump to this loop right here. + +00:04:54.000 --> 00:04:57.360 +If we were to do this [br 2], what this would do is, + +00:04:57.360 --> 00:05:02.680 +this would jump past this block right here. + +00:05:02.680 --> 00:05:09.880 +So as another example, this right here, + +00:05:09.880 --> 00:05:15.720 +this is a loop that generates increasing numbers. + +00:05:15.720 --> 00:05:22.640 +Let's see. Next up, we have modules. + +00:05:22.640 --> 00:05:26.280 +This is an example of a stack module. + +00:05:26.280 --> 00:05:28.760 +In addition to stack, there's also heaps. + +00:05:28.760 --> 00:05:34.560 +What this does is it allows us to create + +00:05:34.560 --> 00:05:38.080 +an extra stack that we can push and pop items onto. + +00:05:38.080 --> 00:05:41.240 +This one can have as large size as we need. + +00:05:41.240 --> 00:05:43.800 +Here it has a size of 20. + +00:05:43.800 --> 00:05:46.400 +It's taking values from up + +00:05:46.400 --> 00:05:51.080 +and exposing those values on the left. + +00:05:51.080 --> 00:05:57.080 +This loop right here, it generates numbers, + +00:05:57.080 --> 00:05:59.160 +and it's putting them onto the stack. + +00:05:59.160 --> 00:06:00.920 +We can see here that those numbers + +00:06:00.920 --> 00:06:03.200 +are being exposed to this cell right here. + +00:06:03.200 --> 00:06:07.040 +It's just taking values, and eventually, + +00:06:07.040 --> 00:06:11.200 +it's going to overflow and cause an error. + +00:06:11.200 --> 00:06:14.480 +That finishes the basic commands. + +00:06:14.480 --> 00:06:16.480 +Why don't we try solving this puzzle. + +00:06:16.480 --> 00:06:21.320 +The puzzle description is right here. + +00:06:21.320 --> 00:06:23.280 +We want to read a value from I. + +00:06:23.280 --> 00:06:28.480 +Send 1 to G if I is greater than 0. + +00:06:28.480 --> 00:06:30.800 +Send 1 to E if it's equal to 0. + +00:06:30.800 --> 00:06:32.440 +Send 1 to L if it's less than 0. + +00:06:32.440 --> 00:06:35.360 +And then all the other ones, we send 0 to. + +00:06:35.360 --> 00:06:40.920 +First things first, let's send the value we get + +00:06:40.920 --> 00:06:44.400 +from the input down as follows. + +00:06:44.400 --> 00:06:49.680 +Let's send that value right. + +00:06:49.680 --> 00:06:51.240 +You get from up. + +00:06:51.240 --> 00:06:54.320 +Okay. So next, we're getting a value on the left. + +00:06:54.320 --> 00:06:58.040 +Now we want to compare if this number is greater than 0. + +00:06:58.040 --> 00:06:59.800 +If it's greater than 0, we send 1 to G. + +00:06:59.800 --> 00:07:03.280 +Let's perform the greater than operation + +00:07:03.280 --> 00:07:08.080 +on that item we just got, and we're comparing it to 0. + +00:07:08.080 --> 00:07:11.680 +Now that result, we're going to send down, + +00:07:11.680 --> 00:07:13.880 +and we're going to send this original value + +00:07:13.880 --> 00:07:16.880 +we got from here to the right. + +00:07:16.880 --> 00:07:19.000 +Here, we do a similar step. + +00:07:19.000 --> 00:07:20.240 +We get the value from the left, + +00:07:20.240 --> 00:07:22.920 +but this time, we have to do an equal operation. + +00:07:22.920 --> 00:07:25.760 +Is that number we got equal to 0? + +00:07:25.760 --> 00:07:28.960 +We send that result down, + +00:07:28.960 --> 00:07:32.880 +and then send this number to the right. + +00:07:32.880 --> 00:07:38.040 +Lastly, we get this number from the left. + +00:07:38.040 --> 00:07:42.400 +Here, we need to compare if it's less than 0. + +00:07:42.400 --> 00:07:45.640 +We send that result down, + +00:07:45.640 --> 00:07:50.280 +and now lastly, we drop that remaining value. + +00:07:50.280 --> 00:07:53.080 +Okay, let's--oh, and then lastly, + +00:07:53.080 --> 00:07:56.040 +we need to send down the value we get up. + +00:07:56.040 --> 00:08:02.560 +Send down, up, send down, up. + +00:08:02.560 --> 00:08:04.760 +Okay, so let's try running this. + +00:08:04.760 --> 00:08:08.920 +Let's see. We notice that + +00:08:08.920 --> 00:08:10.360 +the numbers are coming in from I. + +00:08:10.360 --> 00:08:14.200 +They're going through our various conditions + +00:08:14.200 --> 00:08:18.160 +and should be sending all the correct values. + +00:08:18.160 --> 00:08:23.560 +It looks like we're not getting any errors so far. + +00:08:23.560 --> 00:08:26.680 +Let's speed this up. + +00:08:26.680 --> 00:08:33.040 +That completes the puzzle. + +00:08:33.040 --> 00:08:42.000 +Now let's get into some of the implementation details. + +00:08:42.000 --> 00:08:46.320 +The first thing is the game loop. + +00:08:46.320 --> 00:08:50.560 +The game loop is... So this is actually extremely simple. + +00:08:50.560 --> 00:08:52.320 +All the state for the entire game + +00:08:52.320 --> 00:08:54.400 +is stored in just a few variables. + +00:08:54.400 --> 00:08:56.480 +There's one variable storing + +00:08:56.480 --> 00:09:01.400 +the text of each cell as a vector of strings. + +00:09:01.400 --> 00:09:06.280 +There's a single function + +00:09:06.280 --> 00:09:09.080 +that renders the entire game, the entire board. + +00:09:09.080 --> 00:09:11.120 +There's a single function that would render + +00:09:11.120 --> 00:09:13.920 +this entire screen based off of the state, + +00:09:13.920 --> 00:09:19.240 +and then the game waits for you to press a key. + +00:09:19.240 --> 00:09:24.120 +The key usually, depending on what action you perform, + +00:09:24.120 --> 00:09:27.040 +updates the state and causes a re-render. + +00:09:27.040 --> 00:09:29.360 +It's an extremely simple game loop, + +00:09:29.360 --> 00:09:32.800 +but it makes implementing it pretty easy. + +00:09:32.800 --> 00:09:35.200 +To demonstrate how this game loop works, + +00:09:35.200 --> 00:09:38.400 +I have a simple demo prepared. + +00:09:38.400 --> 00:09:41.880 +This is a game of tic-tac-toe. + +00:09:41.880 --> 00:09:44.800 +Let me show this real fast. + +00:09:44.800 --> 00:09:49.200 +It's an extremely simple implementation, + +00:09:49.200 --> 00:09:51.465 +but it follows the same principles + +00:09:51.466 --> 00:09:53.600 +that I used in asm-blox. + +00:09:53.600 --> 00:09:57.680 +First, we have the state defined in variables. + +00:09:57.680 --> 00:09:59.560 +Here we have two pieces of state. + +00:09:59.560 --> 00:10:01.600 +We have which player's turn it is + +00:10:01.600 --> 00:10:03.120 +and the state of the game board. + +00:10:03.120 --> 00:10:06.640 +The player turn can be nil if it's empty, + +00:10:06.640 --> 00:10:08.760 +the string "x" or the string "o". + +00:10:08.760 --> 00:10:14.240 +Then the game board is a list of nine board elements. + +00:10:14.240 --> 00:10:16.960 +So that's the state. + +00:10:16.960 --> 00:10:18.120 +Then we have a helper function. + +00:10:18.120 --> 00:10:19.440 +You can go into the details, + +00:10:19.440 --> 00:10:21.000 +but it just returns true + +00:10:21.000 --> 00:10:25.600 +if the board has a winning player. + +00:10:25.600 --> 00:10:30.040 +Part two is the rendering function. + +00:10:30.040 --> 00:10:32.800 +Only based off of the game state, + +00:10:32.800 --> 00:10:36.720 +we have a function that erases the buffer + +00:10:36.720 --> 00:10:40.280 +and draws this from scratch. + +00:10:40.280 --> 00:10:45.320 +That's this part right here. + +00:10:45.320 --> 00:10:46.720 +Lastly, we have the action. + +00:10:46.720 --> 00:10:51.920 +We have one action which is bound to RET, + +00:10:51.920 --> 00:10:55.840 +and it places a player token. + +00:10:55.840 --> 00:10:59.920 +Once it places a player token, + +00:10:59.920 --> 00:11:03.120 +it rerenders the board, + +00:11:03.120 --> 00:11:06.880 +and all the rerendering is handled by this function. + +00:11:06.880 --> 00:11:12.480 +Then we have just creating of the mode + +00:11:12.480 --> 00:11:14.680 +and initialization function. + +00:11:14.680 --> 00:11:16.680 +With these three steps + +00:11:16.680 --> 00:11:20.640 +it clearly separates out all of the state, + +00:11:20.640 --> 00:11:22.960 +the rendering, and the actions, + +00:11:22.960 --> 00:11:25.880 +and it makes implementing it very simple. + +00:11:25.880 --> 00:11:29.640 +One trick that's used here and that I use + +00:11:29.640 --> 00:11:32.382 +in my asm-blox game is that + +00:11:32.383 --> 00:11:33.316 +when I render the board, + +00:11:33.317 --> 00:11:40.800 +I propertize the text to contain extra information. + +00:11:40.800 --> 00:11:45.080 +For example, here, each cell has + +00:11:45.080 --> 00:11:49.400 +a tic-tac-toe index to indicate which number cell it is. + +00:11:49.400 --> 00:11:53.640 +This has index 0, 1, 2, all the way up to 8. + +00:11:53.640 --> 00:11:58.640 +That way, for placing, the only thing it has to do + +00:11:58.640 --> 00:12:01.200 +is just look at its position + +00:12:01.200 --> 00:12:04.960 +based off of the text property. + +00:12:04.960 --> 00:12:07.800 +It makes implementation extremely simple. + +00:12:07.800 --> 00:12:14.360 +Next up, we have the implementation of the code cells. + +00:12:14.360 --> 00:12:16.960 +If you notice, here it's kind of weird + +00:12:16.960 --> 00:12:21.000 +how it's like a buffer, but each cell kind of acts + +00:12:21.000 --> 00:12:25.760 +like its own buffer, and it has its own limits. + +00:12:25.760 --> 00:12:27.600 +All of the Emacs editing-- + +00:12:27.600 --> 00:12:30.760 +well, some of the Emacs editing commands kind of work, + +00:12:30.760 --> 00:12:35.360 +like beginning-of-line, end-of-line, end-of-buffer. + +00:12:35.360 --> 00:12:38.240 +How is that done? + +00:12:38.240 --> 00:12:41.760 +Well, it's all just a trick, actually. + +00:12:41.760 --> 00:12:47.280 +Each cell has text properties of which line it's at + +00:12:47.280 --> 00:12:48.800 +and its cell coordinates. + +00:12:48.800 --> 00:12:54.360 +Whenever a key is pressed for editing, moving lines-- + +00:12:54.360 --> 00:12:58.360 +there's even kind of more complicated things + +00:12:58.360 --> 00:13:00.600 +like switching cells around-- + +00:13:00.600 --> 00:13:03.360 +so all of that, + +00:13:03.360 --> 00:13:05.200 +it knows which position it's in, + +00:13:05.200 --> 00:13:08.080 +it knows what cell it's in, + +00:13:08.080 --> 00:13:12.880 +and then it copies the text of the cell, + +00:13:12.880 --> 00:13:16.320 +because remember, the contents of the cell + +00:13:16.320 --> 00:13:18.360 +are stored in internal state. + +00:13:18.360 --> 00:13:23.000 +It copies that cell contents into a temporary buffer. + +00:13:23.000 --> 00:13:27.960 +It then moves the point to whichever line it was + +00:13:27.960 --> 00:13:31.160 +in the game board. + +00:13:31.160 --> 00:13:33.000 +It performs the action. + +00:13:33.000 --> 00:13:36.200 +It makes sure that the resulting text isn't + +00:13:36.200 --> 00:13:40.160 +longer than the cell width or the cell height. + +00:13:40.160 --> 00:13:42.040 +If everything checks out, + +00:13:42.040 --> 00:13:45.120 +it updates the state and calls a re-render. + +00:13:45.120 --> 00:13:48.440 +So there's nothing going on in here + +00:13:48.440 --> 00:13:51.080 +that's, like, actually inserting a letter A. + +00:13:51.080 --> 00:14:00.920 +It's all updating the state and causing a re-render. + +00:14:00.920 --> 00:14:03.640 +So this makes things like certain + +00:14:03.640 --> 00:14:06.480 +internal Emacs editing constructs + +00:14:06.480 --> 00:14:09.120 +pretty hard to use, like undoing. + +00:14:09.120 --> 00:14:12.200 +Normally the undoing construct + +00:14:12.200 --> 00:14:15.120 +works off the contents of the buffer. + +00:14:15.120 --> 00:14:17.840 +But if your buffer is actually just + +00:14:17.840 --> 00:14:20.080 +a reflection of the internal state, + +00:14:20.080 --> 00:14:21.440 +then how does undoing work? + +00:14:21.440 --> 00:14:24.880 +Well, it pretty much is kind of a hack. + +00:14:24.880 --> 00:14:27.040 +I mean, undoing is here, + +00:14:27.040 --> 00:14:32.680 +but it's pretty much redone + +00:14:32.680 --> 00:14:37.560 +in a not so configurable, not so modifiable way. + +00:14:37.560 --> 00:14:40.080 +Pretty much everything is like that, + +00:14:40.080 --> 00:14:42.440 +from these parentheses highlighting... + +00:14:42.440 --> 00:14:46.320 +Normally, parentheses highlighting + +00:14:46.320 --> 00:14:47.243 +would be kind of weird, + +00:14:47.244 --> 00:14:49.840 +with cross-line parentheses and everything. + +00:14:49.840 --> 00:14:52.360 +All of that had to be redone. + +00:14:52.360 --> 00:14:58.160 +Another point about how this is implemented + +00:14:58.160 --> 00:15:02.360 +is the assembly text to executable code. + +00:15:02.360 --> 00:15:05.800 +If you're familiar with WebAssembly + +00:15:05.800 --> 00:15:10.720 +you might have encountered a tool wat-wasm. + +00:15:10.720 --> 00:15:16.440 +It basically converts the WebAssembly text format + +00:15:16.440 --> 00:15:18.280 +to byte code. + +00:15:18.280 --> 00:15:22.440 +And what I do here... It goes through a similar process. + +00:15:22.440 --> 00:15:28.000 +Normally, when you're writing this text format, + +00:15:28.000 --> 00:15:30.360 +you can nest things as deeply as you want. + +00:15:30.360 --> 00:15:33.800 +Basically, what happens is it flattens out everything. + +00:15:33.800 --> 00:15:35.920 +It kind of knows the order + +00:15:35.920 --> 00:15:38.160 +that all these things are going to get executed, + +00:15:38.160 --> 00:15:40.680 +and then it puts it into one single line + +00:15:40.680 --> 00:15:44.120 +that it can just run through and execute. + +00:15:44.120 --> 00:15:48.360 +The same thing for the loops and blocks. + +00:15:48.360 --> 00:15:52.240 +It internally generates labels and jump statements. + +00:15:52.240 --> 00:15:58.640 +So that concludes this presentation. + +00:15:58.640 --> 00:15:59.666 +Thank you for listening, + +00:15:59.667 --> 00:16:07.440 +and I hope you enjoy the rest of the conference. diff --git a/2022/captions/emacsconf-2022-async--emacs-was-async-before-async-was-cool--michael-herstine--main.vtt b/2022/captions/emacsconf-2022-async--emacs-was-async-before-async-was-cool--michael-herstine--main.vtt new file mode 100644 index 00000000..eb25844e --- /dev/null +++ b/2022/captions/emacsconf-2022-async--emacs-was-async-before-async-was-cool--michael-herstine--main.vtt @@ -0,0 +1,1505 @@ +WEBVTT + +1 +00:00:00.000 --> 00:00:02.720 +Hey everyone, I'm Michael + +2 +00:00:02.720 --> 00:00:04.480 +and I'm going to be talking to you today + +3 +00:00:04.480 --> 00:00:07.640 +about asynchronous programming in Emacs Lisp. + +4 +00:00:07.640 --> 00:00:10.360 +I'm located in the San Francisco Bay Area + +5 +00:00:10.360 --> 00:00:12.040 +where I'm a developer as well as + +6 +00:00:12.040 --> 00:00:14.160 +a long time Emacs user. + +7 +00:00:14.160 --> 00:00:18.760 +You may have heard of async or asynchronous programming. + +8 +00:00:18.760 --> 00:00:21.360 +The idea has been around for decades + +9 +00:00:21.360 --> 00:00:24.400 +but it first gained widespread attention in JavaScript + +10 +00:00:24.400 --> 00:00:26.720 +back in the aughts. + +11 +00:00:26.720 --> 00:00:29.680 +Then in the teens it gained tremendous popularity + +12 +00:00:29.680 --> 00:00:31.720 +in the DevOps world with Golang. + +13 +00:00:31.720 --> 00:00:33.800 +And just in the last few years + +14 +00:00:33.800 --> 00:00:37.880 +support for async programming has landed in Rust. + +15 +00:00:37.880 --> 00:00:40.080 +Well it can be done in Emacs as well + +16 +00:00:40.080 --> 00:00:42.040 +and this talk will demonstrate that + +17 +00:00:42.040 --> 00:00:44.600 +by walking you through a little problem + +18 +00:00:44.600 --> 00:00:47.200 +that I actually solved for myself. + +19 +00:00:47.200 --> 00:00:49.040 +Like a lot of these stories + +20 +00:00:49.040 --> 00:00:51.920 +it begins with scratching a personal itch. + +21 +00:00:51.920 --> 00:00:55.320 +In my case automating my music server. + +22 +00:00:55.320 --> 00:00:58.240 +I use something called the music player daemon locally + +23 +00:00:58.240 --> 00:01:00.240 +and as the name suggests + +24 +00:01:00.240 --> 00:01:03.560 +it just kind of hangs out in the background. + +25 +00:01:03.560 --> 00:01:08.040 +Reads music files and talks to assorted sound drivers. + +26 +00:01:08.040 --> 00:01:09.640 +In fact it is so focused on + +27 +00:01:09.640 --> 00:01:12.440 +that mission that it doesn't even offer a user interface. + +28 +00:01:12.440 --> 00:01:14.400 +Instead it serves an API + +29 +00:01:14.400 --> 00:01:16.120 +and invites application developers + +30 +00:01:16.120 --> 00:01:19.360 +to build clients on top of that API. + +31 +00:01:19.360 --> 00:01:22.200 +Okay so let's hop into a vterm + +32 +00:01:22.200 --> 00:01:25.080 +and I'd like to show you the MPD client I use + +33 +00:01:25.080 --> 00:01:26.600 +for my daily driver. + +34 +00:01:26.600 --> 00:01:29.520 +Something called ncmpcpp. + +35 +00:01:29.520 --> 00:01:31.800 +Doesn't exactly roll off the tongue + +36 +00:01:31.800 --> 00:01:33.720 +but I've got a playlist. + +37 +00:01:33.720 --> 00:01:36.560 +I can browse the file system. + +38 +00:01:36.560 --> 00:01:39.240 +Looks like I can search my music library. + +39 +00:01:39.240 --> 00:01:40.000 +Yada yada yada. + +40 +00:01:40.000 --> 00:01:42.600 +It's got all the basic features. + +41 +00:01:42.600 --> 00:01:44.640 +The point that I want to make is that + +42 +00:01:44.640 --> 00:01:51.920 +ncmpcpp is a completely independent project of MPD. + +43 +00:01:51.920 --> 00:01:53.720 +Separate and distinct. + +44 +00:01:53.720 --> 00:01:55.680 +It does all of its work + +45 +00:01:55.680 --> 00:01:57.200 +by simply communicating with + +46 +00:01:57.200 --> 00:02:01.400 +the music player daemon over the API. + +47 +00:02:01.400 --> 00:02:03.440 +Well I wanted to program to that API + +48 +00:02:03.440 --> 00:02:05.840 +only from within Emacs. + +49 +00:02:05.840 --> 00:02:09.520 +Now there are already Emacs MPD clients out there + +50 +00:02:09.520 --> 00:02:11.560 +but I didn't really want a full blown client. + +51 +00:02:11.560 --> 00:02:14.320 +I just wanted a few small tweaks + +52 +00:02:14.320 --> 00:02:16.320 +over my current configuration. + +53 +00:02:16.320 --> 00:02:19.280 +A command to skip to the next song. + +54 +00:02:19.280 --> 00:02:22.360 +Maybe shove the current track into the mode line. + +55 +00:02:22.360 --> 00:02:24.160 +Things like this. + +56 +00:02:24.160 --> 00:02:28.560 +I needed an elisp API that would let me do this. + +57 +00:02:28.560 --> 00:02:32.000 +Okay well let's get out of ncmpcpp + +58 +00:02:32.000 --> 00:02:37.560 +and let's get into a netcat session + +59 +00:02:37.560 --> 00:02:39.400 +with my local MPD server. + +60 +00:02:39.400 --> 00:02:43.840 +As you can see we get a welcome string. + +61 +00:02:43.840 --> 00:02:46.800 +So it is a server goes first protocol. + +62 +00:02:46.800 --> 00:02:49.640 +But after that it's a very familiar + +63 +00:02:49.640 --> 00:02:53.960 +text based request response oriented protocol. + +64 +00:02:53.960 --> 00:02:56.240 +I can ask for the volume. + +65 +00:02:56.240 --> 00:02:58.160 +I can ask for the status. + +66 +00:02:58.160 --> 00:03:06.000 +But in particular I wanted an asynchronous API. + +67 +00:03:06.000 --> 00:03:07.800 +If I issue a command like + +68 +00:03:07.800 --> 00:03:11.840 +find every track in my library + +69 +00:03:11.840 --> 00:03:15.360 +that's going to produce a lot of data + +70 +00:03:15.360 --> 00:03:18.920 +that's a human perceptible pause + +71 +00:03:18.920 --> 00:03:22.080 +as Emacs processes all the input. + +72 +00:03:22.080 --> 00:03:25.560 +What I wanted was a style of programming + +73 +00:03:25.560 --> 00:03:28.080 +where I could fire off my command + +74 +00:03:28.080 --> 00:03:31.560 +have the Emacs command loop keep working + +75 +00:03:31.560 --> 00:03:33.440 +and only invoke some callback + +76 +00:03:33.440 --> 00:03:35.280 +when there was data available. + +77 +00:03:35.280 --> 00:03:39.560 +Well Emacs is famously single threaded + +78 +00:03:39.560 --> 00:03:41.840 +so it shouldn't come as a surprise + +79 +00:03:41.840 --> 00:03:44.080 +that it offers a rich set of primitives + +80 +00:03:44.080 --> 00:03:46.720 +that enable the sort of network programming + +81 +00:03:46.720 --> 00:03:49.320 +that I wanted to do. + +82 +00:03:49.320 --> 00:03:50.760 +In particular it offers + +83 +00:03:50.760 --> 00:03:53.280 +a function called make network process. + +84 +00:03:53.280 --> 00:03:57.800 +Now this method offers a bewildering variety of options. + +85 +00:03:57.800 --> 00:03:59.320 +But at the heart of the matter + +86 +00:03:59.320 --> 00:04:01.040 +it opens a network connection + +87 +00:04:01.040 --> 00:04:03.120 +to some endpoint out there + +88 +00:04:03.120 --> 00:04:06.640 +and we can configure it to be non blocking. + +89 +00:04:06.640 --> 00:04:09.840 +It returns a handle that you can use to refer to + +90 +00:04:09.840 --> 00:04:14.880 +this network connection with other methods. + +91 +00:04:14.880 --> 00:04:17.760 +Other methods such as process and string + +92 +00:04:17.760 --> 00:04:19.600 +which as the name suggests + +93 +00:04:19.600 --> 00:04:21.960 +allows you to send textual data + +94 +00:04:21.960 --> 00:04:26.320 +to the remote endpoint of your network connection. + +95 +00:04:26.320 --> 00:04:29.400 +You can also use it with set process filter + +96 +00:04:29.400 --> 00:04:32.160 +which allows you to associate a callback + +97 +00:04:32.160 --> 00:04:33.240 +with your network connection. + +98 +00:04:33.240 --> 00:04:35.920 +That callback will be invoked + +99 +00:04:35.920 --> 00:04:40.480 +when there is data available + +100 +00:04:40.480 --> 00:04:41.960 +in the processes read buffer. + +101 +00:04:41.960 --> 00:04:44.960 +In other words in a request response oriented protocol + +102 +00:04:44.960 --> 00:04:47.800 +like that of MPD you open your socket + +103 +00:04:47.800 --> 00:04:50.960 +with make network process + +104 +00:04:50.960 --> 00:04:53.760 +send your request via process send string + +105 +00:04:53.760 --> 00:04:56.360 +and life will just continue in emacs + +106 +00:04:56.360 --> 00:04:57.560 +until some data shows up + +107 +00:04:57.560 --> 00:05:00.720 +in the processes read buffer + +108 +00:05:00.720 --> 00:05:05.200 +at which point your callback will be invoked. + +109 +00:05:05.200 --> 00:05:07.560 +It turns out this was enough + +110 +00:05:07.560 --> 00:05:12.280 +for a purpose built async runtime. + +111 +00:05:12.280 --> 00:05:14.800 +Let's work through the sequence of events + +112 +00:05:14.800 --> 00:05:16.480 +when opening a connection + +113 +00:05:16.480 --> 00:05:18.720 +and firing off a few commands in this style. + +114 +00:05:18.720 --> 00:05:22.120 +So let's imagine a library + +115 +00:05:22.120 --> 00:05:25.520 +that offers a connection object of some sort + +116 +00:05:25.520 --> 00:05:28.720 +a caller and an MPD server out on the network. + +117 +00:05:28.720 --> 00:05:31.880 +The caller will presumably get themselves + +118 +00:05:31.880 --> 00:05:34.760 +a connection object by invoking some sort of + +119 +00:05:34.760 --> 00:05:38.080 +connect method on our library. + +120 +00:05:38.080 --> 00:05:41.160 +We can handle this through make network process + +121 +00:05:41.160 --> 00:05:45.360 +but we're going to invoke make network process + +122 +00:05:45.360 --> 00:05:47.200 +with no weight equal to true + +123 +00:05:47.200 --> 00:05:48.520 +in other words asynchronously. + +124 +00:05:48.520 --> 00:05:52.240 +That means the method is going to return immediately. + +125 +00:05:52.240 --> 00:05:56.320 +We won't even know if the connection is up + +126 +00:05:56.320 --> 00:05:57.920 +let alone what the response would be. + +127 +00:05:57.920 --> 00:06:01.560 +This has some implications. + +128 +00:06:01.560 --> 00:06:05.280 +At this point we've returned control to the caller + +129 +00:06:05.280 --> 00:06:09.400 +the emacs event loop is proceeding quite happily + +130 +00:06:09.400 --> 00:06:11.320 +and so the caller is free + +131 +00:06:11.320 --> 00:06:14.920 +to start using our connection object. + +132 +00:06:14.920 --> 00:06:17.640 +They might say issue a status command. + +133 +00:06:17.640 --> 00:06:20.600 +Okay well in our library + +134 +00:06:20.600 --> 00:06:22.680 +we don't have a connection yet. + +135 +00:06:22.680 --> 00:06:25.920 +How on earth are we going to service this? + +136 +00:06:25.920 --> 00:06:29.440 +Well we can simply give ourselves a queue + +137 +00:06:29.440 --> 00:06:33.360 +and note down the fact that we owe a status command. + +138 +00:06:33.360 --> 00:06:35.560 +That's pretty quick. + +139 +00:06:35.560 --> 00:06:38.120 +We've now returned control back to our caller + +140 +00:06:38.120 --> 00:06:40.640 +and they are again free to issue more commands. + +141 +00:06:40.640 --> 00:06:41.840 +Maybe they issue a play command. + +142 +00:06:41.840 --> 00:06:45.160 +Okay well we're going to go deeper into debt + +143 +00:06:45.160 --> 00:06:48.160 +and note that we also owe a play command. + +144 +00:06:48.160 --> 00:06:56.160 +At some point in the indeterminate future MPDU + +145 +00:06:56.160 --> 00:06:57.320 +is the connection will get up + +146 +00:06:57.320 --> 00:07:03.000 +MPDU will allocate resources to track a new client. + +147 +00:07:03.000 --> 00:07:06.160 +They will write the welcome string into the socket + +148 +00:07:06.160 --> 00:07:07.920 +and those bytes are going to show up + +149 +00:07:07.920 --> 00:07:10.360 +in the emacs process read buffer + +150 +00:07:10.360 --> 00:07:13.160 +at which point our callback will be invoked. + +151 +00:07:13.160 --> 00:07:17.440 +We can parse the welcome string maybe + +152 +00:07:17.440 --> 00:07:19.240 +note the version that connection object + +153 +00:07:19.240 --> 00:07:20.400 +that might come in handy + +154 +00:07:20.400 --> 00:07:21.720 +but the key point is + +155 +00:07:21.720 --> 00:07:24.080 +our callback needs to take a look at the queue + +156 +00:07:24.080 --> 00:07:25.240 +and notice + +157 +00:07:25.240 --> 00:07:27.200 +oh we owe a status command + +158 +00:07:27.200 --> 00:07:29.880 +and so we'll invoke process and string + +159 +00:07:29.880 --> 00:07:32.280 +and send the status command down the pipe. + +160 +00:07:32.280 --> 00:07:36.760 +Again at some indeterminate time in the future + +161 +00:07:36.760 --> 00:07:38.600 +some bytes are going to show up + +162 +00:07:38.600 --> 00:07:41.200 +in our processes read buffer + +163 +00:07:41.200 --> 00:07:43.160 +and our callback will again be invoked. + +164 +00:07:43.160 --> 00:07:48.560 +We've got volume is 75 plus a lot of other stuff + +165 +00:07:48.560 --> 00:07:50.480 +and here we come to the next problem. + +166 +00:07:50.480 --> 00:07:54.440 +If our caller invoked status + +167 +00:07:54.440 --> 00:07:56.960 +they probably wanted to know about the status + +168 +00:07:56.960 --> 00:07:59.880 +so how shall we get them to them? + +169 +00:07:59.880 --> 00:08:03.040 +Well there's really not a lot of options at this point + +170 +00:08:03.040 --> 00:08:04.280 +except the callback. + +171 +00:08:04.280 --> 00:08:09.000 +Okay so change of plan our queue + +172 +00:08:09.000 --> 00:08:11.720 +is no longer a queue of commands + +173 +00:08:11.720 --> 00:08:13.840 +it's going to be a queue of commands + +174 +00:08:13.840 --> 00:08:15.880 +with associated callbacks. + +175 +00:08:15.880 --> 00:08:20.280 +We read the response off the socket + +176 +00:08:20.280 --> 00:08:23.440 +invoke our caller supplied callback + +177 +00:08:23.440 --> 00:08:26.080 +and then pop the queue. + +178 +00:08:26.080 --> 00:08:28.920 +At this point our callback + +179 +00:08:28.920 --> 00:08:32.160 +the library callback needs to know + +180 +00:08:32.160 --> 00:08:34.040 +that we still have a pending command + +181 +00:08:34.040 --> 00:08:35.720 +we fire that off down the pipe + +182 +00:08:35.720 --> 00:08:38.520 +at some indeterminate time in the future + +183 +00:08:38.520 --> 00:08:40.360 +we get a call we get a response + +184 +00:08:40.360 --> 00:08:42.640 +our callback is invoked + +185 +00:08:42.640 --> 00:08:45.720 +we invoke the caller supplied callback + +186 +00:08:45.720 --> 00:08:47.240 +and we pop the queue. + +187 +00:08:47.240 --> 00:08:53.760 +The structure of such a program + +188 +00:08:53.760 --> 00:08:55.800 +is best viewed as a finite state machine + +189 +00:08:55.800 --> 00:08:57.640 +and this is typically where you end up + +190 +00:08:57.640 --> 00:08:59.200 +in asynchronous programming at least + +191 +00:08:59.200 --> 00:09:03.360 +when you don't have a runtime grafted onto your program + +192 +00:09:03.360 --> 00:09:04.960 +the way you do with Golang + +193 +00:09:04.960 --> 00:09:08.240 +or when you don't have sort of extensive library support + +194 +00:09:08.240 --> 00:09:09.680 +the way you do with Rust. + +195 +00:09:09.680 --> 00:09:14.480 +Your data structure exists in one of these states + +196 +00:09:14.480 --> 00:09:15.440 +at any given time + +197 +00:09:15.440 --> 00:09:18.960 +and when input shows up on your file descriptor + +198 +00:09:18.960 --> 00:09:24.240 +you transition along one of these edges to a new state. + +199 +00:09:24.240 --> 00:09:28.160 +Cool so let's take a look at some of the code + +200 +00:09:28.160 --> 00:09:29.480 +that flows from this. + +201 +00:09:29.480 --> 00:09:32.240 +Okay let's hop over to an Emacs + +202 +00:09:32.240 --> 00:09:33.920 +and take a look at how we might code this up. + +203 +00:09:33.920 --> 00:09:38.360 +If you recall the sequence diagrams I shared + +204 +00:09:38.360 --> 00:09:40.120 +we're going to be scribbling down the command + +205 +00:09:40.120 --> 00:09:42.160 +and the callback that will be invoking + +206 +00:09:42.160 --> 00:09:43.240 +upon its completion. + +207 +00:09:43.240 --> 00:09:45.440 +So the first thing I did was give myself + +208 +00:09:45.440 --> 00:09:47.400 +a little command struct + +209 +00:09:47.400 --> 00:09:52.280 +with that I was able to define the connection object. + +210 +00:09:52.280 --> 00:09:56.280 +We're going to be storing the handle to the connection. + +211 +00:09:56.280 --> 00:09:59.400 +We're going to write down the protocol version + +212 +00:09:59.400 --> 00:10:02.000 +that we harvest from the welcome message + +213 +00:10:02.000 --> 00:10:03.560 +and of course we'll be recording + +214 +00:10:03.560 --> 00:10:05.760 +the command queue as well. + +215 +00:10:05.760 --> 00:10:08.640 +And so I gave myself a little connection object + +216 +00:10:08.640 --> 00:10:10.960 +with a connection struct + +217 +00:10:10.960 --> 00:10:12.240 +with those three attributes. + +218 +00:10:12.240 --> 00:10:15.000 +With the data model squared away + +219 +00:10:15.000 --> 00:10:17.840 +it was really pretty easy to code up + +220 +00:10:17.840 --> 00:10:21.160 +the connect implementation. + +221 +00:10:21.160 --> 00:10:24.880 +I'm deleting some details for exposition purposes + +222 +00:10:24.880 --> 00:10:29.520 +but in the event it's really not that more complex + +223 +00:10:29.520 --> 00:10:30.520 +than what you see here. + +224 +00:10:30.520 --> 00:10:32.840 +We're going to unpack the arguments, + +225 +00:10:32.840 --> 00:10:35.040 +figure out where the MPD server is + +226 +00:10:35.040 --> 00:10:37.280 +to which you would like us to connect. + +227 +00:10:37.280 --> 00:10:39.920 +We'll connect via make network process. + +228 +00:10:39.920 --> 00:10:42.640 +We'll associate a library defined callback + +229 +00:10:42.640 --> 00:10:45.920 +with that connection via set process filter. + +230 +00:10:45.920 --> 00:10:48.440 +Then we'll instantiate the connection object + +231 +00:10:48.440 --> 00:10:50.120 +and return it to the caller. + +232 +00:10:50.120 --> 00:10:53.800 +Once the caller has a connection object + +233 +00:10:53.800 --> 00:10:56.880 +they're free to send commands down that connection. + +234 +00:10:56.880 --> 00:10:59.120 +So what we're doing here + +235 +00:10:59.120 --> 00:11:02.320 +is simply instantiating a command object + +236 +00:11:02.320 --> 00:11:05.200 +on the basis of the caller supplied arguments + +237 +00:11:05.200 --> 00:11:06.640 +and appending it to the queue. + +238 +00:11:06.640 --> 00:11:07.920 +And then the last thing we do + +239 +00:11:07.920 --> 00:11:11.040 +and I've just indicated this with a comment + +240 +00:11:11.040 --> 00:11:12.040 +is we kick the queue. + +241 +00:11:12.040 --> 00:11:14.560 +This kind of goes back to + +242 +00:11:14.560 --> 00:11:18.200 +the state transition diagram I laid out earlier. + +243 +00:11:18.200 --> 00:11:22.680 +What this means is the logic for saying well + +244 +00:11:22.680 --> 00:11:24.280 +if we're waiting the completion + +245 +00:11:24.280 --> 00:11:25.480 +of a previously sent command + +246 +00:11:25.480 --> 00:11:27.280 +there's really not much more to be done. + +247 +00:11:27.280 --> 00:11:31.000 +We're just going to push this command onto the queue + +248 +00:11:31.000 --> 00:11:31.600 +and return. + +249 +00:11:31.600 --> 00:11:33.120 +On the other hand + +250 +00:11:33.120 --> 00:11:37.120 +if the queue was empty on entry to LMPD send + +251 +00:11:37.120 --> 00:11:39.160 +there's no reason not to just + +252 +00:11:39.160 --> 00:11:43.400 +immediately send the command. + +253 +00:11:43.400 --> 00:11:44.680 +And this is an example of + +254 +00:11:44.680 --> 00:11:46.520 +the sort of client side code + +255 +00:11:46.520 --> 00:11:48.080 +that results from this API. + +256 +00:11:48.080 --> 00:11:51.360 +So you can see here we are giving ourselves + +257 +00:11:51.360 --> 00:11:54.240 +a connection to the MPD server on the local host + +258 +00:11:54.240 --> 00:11:56.600 +and we're going to send the get volume command + +259 +00:11:56.600 --> 00:11:58.160 +down that connection. + +260 +00:11:58.160 --> 00:12:02.840 +And if that command completes and all is well + +261 +00:12:02.840 --> 00:12:05.360 +we'll just send a message to Emacs. + +262 +00:12:05.360 --> 00:12:07.800 +Unfortunately you can't see my mini buffer + +263 +00:12:07.800 --> 00:12:10.960 +so I'll hop over to the messages buffer + +264 +00:12:10.960 --> 00:12:12.720 +and there's our result. + +265 +00:12:12.720 --> 00:12:15.160 +The volume is 43. + +266 +00:12:15.160 --> 00:12:17.960 +Great I thought. + +267 +00:12:17.960 --> 00:12:22.520 +Simple clean responsive easy to code to. + +268 +00:12:22.520 --> 00:12:27.760 +That is unfortunately not the end of the story. + +269 +00:12:27.760 --> 00:12:32.320 +Let's continue this example a little bit. + +270 +00:12:32.320 --> 00:12:33.560 +Let's imagine that + +271 +00:12:33.560 --> 00:12:35.920 +if the volume comes back from the server + +272 +00:12:35.920 --> 00:12:37.360 +and it is less than 50 + +273 +00:12:37.360 --> 00:12:38.600 +we would like to set it to 50. + +274 +00:12:38.600 --> 00:12:41.560 +So this is interesting + +275 +00:12:41.560 --> 00:12:43.200 +because we have two commands + +276 +00:12:43.200 --> 00:12:45.840 +and whether or not we send the second command + +277 +00:12:45.840 --> 00:12:46.840 +is going to depend on + +278 +00:12:46.840 --> 00:12:48.560 +the response we get from the first. + +279 +00:12:48.560 --> 00:12:51.640 +Okay I thought well that's fine + +280 +00:12:51.640 --> 00:12:55.080 +I can simply put that logic in the callback + +281 +00:12:55.080 --> 00:12:57.920 +that I specified for the get volume command. + +282 +00:12:57.920 --> 00:13:01.560 +So here we are we check the return code + +283 +00:13:01.560 --> 00:13:04.400 +we parse the volume we compare it to 50 + +284 +00:13:04.400 --> 00:13:08.360 +and if it's less we just invoke LMPD send again + +285 +00:13:08.360 --> 00:13:10.800 +from the first command's callback. + +286 +00:13:10.800 --> 00:13:13.440 +Okay I could live with that + +287 +00:13:13.440 --> 00:13:15.520 +it's not the worst thing I've ever seen. + +288 +00:13:15.520 --> 00:13:19.400 +Let's extend this example a little further + +289 +00:13:19.400 --> 00:13:21.480 +and this is contrived but bear with me. + +290 +00:13:21.480 --> 00:13:25.480 +Let us suppose that if we do set the volume to 50 + +291 +00:13:25.480 --> 00:13:27.800 +we'd like to get the volume one more time + +292 +00:13:27.800 --> 00:13:30.640 +just to make sure that our change took on the server. + +293 +00:13:30.640 --> 00:13:33.560 +Okay we can play the same game. + +294 +00:13:33.560 --> 00:13:37.280 +We will put that logic in the callback + +295 +00:13:37.280 --> 00:13:39.520 +that we specified for the set volume command. + +296 +00:13:39.520 --> 00:13:43.480 +And here we are we check the return code + +297 +00:13:43.480 --> 00:13:45.480 +we send a message to Emacs + +298 +00:13:45.480 --> 00:13:49.200 +we send the get volume command again + +299 +00:13:49.200 --> 00:13:51.080 +along with its own callback + +300 +00:13:51.080 --> 00:13:55.280 +and at this point I think you know I hope it's clear + +301 +00:13:55.280 --> 00:13:57.520 +the problem that is emerging + +302 +00:13:57.520 --> 00:14:01.360 +and if it's not yet let's let me note that so far + +303 +00:14:01.360 --> 00:14:03.000 +we're only handling the happy path + +304 +00:14:03.000 --> 00:14:04.520 +in each of these callbacks. + +305 +00:14:04.520 --> 00:14:06.840 +We really ought to do something about the error path + +306 +00:14:06.840 --> 00:14:10.120 +for purposes of illustration let's just say + +307 +00:14:10.120 --> 00:14:12.120 +we send a message to Emacs + +308 +00:14:12.120 --> 00:14:14.320 +that means it would look like this + +309 +00:14:14.320 --> 00:14:16.560 +and it's at this point + +310 +00:14:16.560 --> 00:14:19.400 +that I really think it's impossible to deny + +311 +00:14:19.400 --> 00:14:23.280 +that this API is actually not that easy to program to + +312 +00:14:23.280 --> 00:14:27.160 +and if there are any JavaScript devs watching + +313 +00:14:27.160 --> 00:14:28.840 +you're probably chuckling right now + +314 +00:14:28.840 --> 00:14:30.720 +because I have discovered for myself + +315 +00:14:30.720 --> 00:14:33.880 +what they call callback hell. + +316 +00:14:33.880 --> 00:14:36.040 +If you are returning + +317 +00:14:36.040 --> 00:14:40.160 +the results of asynchronous function invocations + +318 +00:14:40.160 --> 00:14:42.200 +to their caller via callbacks + +319 +00:14:42.200 --> 00:14:45.640 +you pretty much inevitably end up in this sort of + +320 +00:14:45.640 --> 00:14:48.040 +deeply nested sequence of callbacks + +321 +00:14:48.040 --> 00:14:49.880 +that is difficult to write difficult to read + +322 +00:14:49.880 --> 00:14:53.520 +and difficult to reason about. + +323 +00:14:53.520 --> 00:14:57.480 +And yet when I was stuck in this situation + +324 +00:14:57.480 --> 00:15:00.080 +it just seemed like it really shouldn't be this bad. + +325 +00:15:00.080 --> 00:15:05.320 +If I give myself this sort of tabular data structure + +326 +00:15:05.320 --> 00:15:10.160 +I felt that this expressed precisely the same logic + +327 +00:15:10.160 --> 00:15:11.960 +just in a much easier to read manner. + +328 +00:15:11.960 --> 00:15:15.840 +I could in my mind's eye + +329 +00:15:15.840 --> 00:15:19.720 +see the code for transforming this data structure + +330 +00:15:19.720 --> 00:15:21.040 +which is really just a list + +331 +00:15:21.040 --> 00:15:25.600 +into the code that you just saw in the previous slide + +332 +00:15:25.600 --> 00:15:29.440 +and really if Lisp is good at anything + +333 +00:15:29.440 --> 00:15:31.080 +it is list processing right + +334 +00:15:31.080 --> 00:15:33.080 +and it was really at this point + +335 +00:15:33.080 --> 00:15:35.240 +that a little bit of enlightenment dawned. + +336 +00:15:35.240 --> 00:15:40.800 +I learned that Lisp is homo iconic + +337 +00:15:40.800 --> 00:15:46.040 +which is just means that the language itself + +338 +00:15:46.040 --> 00:15:49.360 +is a data structure in that language. + +339 +00:15:49.360 --> 00:15:53.160 +Lisp code is after all just a list + +340 +00:15:53.160 --> 00:15:57.160 +and the power of Lisp macros + +341 +00:15:57.160 --> 00:15:59.760 +is taking that data structure + +342 +00:15:59.760 --> 00:16:02.400 +some data structure that you've defined + +343 +00:16:02.400 --> 00:16:04.640 +and doing exactly what I wanted to do + +344 +00:16:04.640 --> 00:16:07.520 +transforming it from one list into another + +345 +00:16:07.520 --> 00:16:11.080 +the destination list being Lisp code. + +346 +00:16:11.080 --> 00:16:16.000 +So I got busy and I coded up my first Lisp macro + +347 +00:16:16.000 --> 00:16:19.160 +which I called LMPD chain + +348 +00:16:19.160 --> 00:16:21.600 +and that lengthy list of you know + +349 +00:16:21.600 --> 00:16:24.200 +three or four nested callbacks + +350 +00:16:24.200 --> 00:16:25.920 +gets turned into this + +351 +00:16:25.920 --> 00:16:29.520 +which I hope you'll agree is much simpler + +352 +00:16:29.520 --> 00:16:32.240 +much easier to read much easier to reason about. + +353 +00:16:32.240 --> 00:16:36.000 +And if you're morbidly curious + +354 +00:16:36.000 --> 00:16:40.160 +you can you can expand your macros + +355 +00:16:40.160 --> 00:16:44.200 +and this invocation of LMPD chain expands to this. + +356 +00:16:44.200 --> 00:16:46.400 +So that's my story. + +357 +00:16:46.400 --> 00:16:50.840 +In all fairness I should note that + +358 +00:16:50.840 --> 00:16:55.160 +the MPD protocol has some subtleties and complexities + +359 +00:16:55.160 --> 00:16:56.880 +that I didn't really get into + +360 +00:16:56.880 --> 00:16:58.360 +both due to time constraints + +361 +00:16:58.360 --> 00:17:00.520 +and because they're not terribly relevant + +362 +00:17:00.520 --> 00:17:02.000 +to the points I wanted to touch on + +363 +00:17:02.000 --> 00:17:05.360 +I should also note that there's + +364 +00:17:05.360 --> 00:17:07.720 +a fair amount of work in the library itself + +365 +00:17:07.720 --> 00:17:11.240 +around accumulating partial responses + +366 +00:17:11.240 --> 00:17:12.560 +as they show up in the buffer + +367 +00:17:12.560 --> 00:17:16.120 +and dispatching them piecemeal to the caller + +368 +00:17:16.120 --> 00:17:19.720 +that was really too complex to get into here. + +369 +00:17:19.720 --> 00:17:22.360 +If you would like to see the code + +370 +00:17:22.360 --> 00:17:25.080 +it's available on GitHub as well as Melpa. + +371 +00:17:25.080 --> 00:17:29.200 +I'll be putting a version of this talk + +372 +00:17:29.200 --> 00:17:30.480 +on my personal site + +373 +00:17:30.480 --> 00:17:33.720 +and you can always reach out to me personally + +374 +00:17:33.720 --> 00:17:36.960 +I hang out on IRC as SPIF + +375 +00:17:36.960 --> 00:17:41.920 +or you can just email me as SPIF at P.O.Box dot com. + +376 +00:17:41.920 --> 00:17:47.880 +Thank you very much. diff --git a/2022/captions/emacsconf-2022-buddy--the-emacs-buddy-initiative--andrea--main.vtt b/2022/captions/emacsconf-2022-buddy--the-emacs-buddy-initiative--andrea--main.vtt new file mode 100644 index 00000000..8d4b023c --- /dev/null +++ b/2022/captions/emacsconf-2022-buddy--the-emacs-buddy-initiative--andrea--main.vtt @@ -0,0 +1,424 @@ +WEBVTT captioned by andrea
+
+00:00.000 --> 00:03.919
+Hello, welcome to my talk, the Emacs Buddy Initiative.
+
+00:03.920 --> 00:04.759
+Who am I?
+
+00:04.760 --> 00:06.999
+I'm Andrea. I work as a Clojure Software Engineer
+
+00:07.000 --> 00:08.999
+somewhere in the middle of the UK.
+
+00:09.000 --> 00:12.519
+And I started with Emacs during my PhD,
+
+00:12.520 --> 00:14.119
+thanks to my PhD supervisor
+
+00:14.120 --> 00:15.759
+that introduced me to this tool.
+
+00:15.760 --> 00:17.279
+And from now and from then,
+
+00:17.280 --> 00:20.319
+I am basically using it for everything.
+
+00:20.320 --> 00:22.159
+You can find more about this everything
+
+00:22.160 --> 00:26.519
+at ag91.github.io, that is my blog.
+
+00:26.520 --> 00:27.899
+So let's get into the talk.
+
+00:27.900 --> 00:29.479
+Why Emacs Buddy?
+
+00:29.480 --> 00:32.919
+Emacs Buddy is an initiative to bring us together.
+
+00:32.920 --> 00:36.559
+And the reason is because Emacs is a limitless tool.
+
+00:36.560 --> 00:38.799
+So you can keep learning about it,
+
+00:38.800 --> 00:41.039
+you can keep expanding it,
+
+00:41.040 --> 00:44.799
+and also takes time to get up to speed.
+
+00:44.800 --> 00:48.679
+So you may actually extend Emacs
+
+00:48.680 --> 00:50.619
+or you may actually get introduced,
+
+00:50.620 --> 00:52.319
+start using Emacs,
+
+00:52.320 --> 00:56.359
+but you could fall into all the traps
+
+00:56.360 --> 01:00.879
+or all the wasted times that other users have already gone through.
+
+01:00.880 --> 01:04.599
+And so, since there are a lot of amazing people
+
+01:04.600 --> 01:07.359
+in the Emacs community,
+
+01:07.360 --> 01:10.119
+why do every time redo the same error?
+
+01:10.120 --> 01:12.159
+So let's bring us together.
+
+01:12.160 --> 01:17.479
+And it would be amazing to get a one-to-one relation.
+
+01:17.480 --> 01:21.559
+So I have somebody that actually knows what you want to do,
+
+01:21.560 --> 01:23.399
+what you want to achieve with Emacs,
+
+01:23.400 --> 01:27.439
+and supports you because they have done a similar path to yours.
+
+01:27.440 --> 01:32.719
+And so they can remove some of the obstacles for you.
+
+01:32.720 --> 01:34.479
+So what can you expect?
+
+01:34.480 --> 01:37.879
+The main thing is guidance on your Emacs journey,
+
+01:37.880 --> 01:41.279
+because the Emacs journey is infinite, it doesn't really end.
+
+01:41.280 --> 01:44.079
+But the farther you go,
+
+01:44.080 --> 01:46.799
+the more value you get from this amazing tool.
+
+01:46.800 --> 01:50.359
+And that helps you save time.
+
+01:50.360 --> 01:54.279
+And at the same time, you can meet like-minded people.
+
+01:54.280 --> 01:59.079
+And so you can learn about Emacs or about your context,
+
+01:59.080 --> 02:02.919
+if they are in, for example, if you are a physicist,
+
+02:02.920 --> 02:07.559
+they are physicists or they are interested in the field.
+
+02:07.560 --> 02:09.159
+You may not only learn about Emacs,
+
+02:09.160 --> 02:11.879
+but you can learn also something about the field.
+
+02:11.880 --> 02:17.039
+And anyway, the idea is that you can move forward together.
+
+02:17.040 --> 02:20.399
+Somebody asked, why not just mailing lists or Reddit?
+
+02:20.400 --> 02:24.639
+Well, the point is that mailing list is many people
+
+02:24.640 --> 02:28.519
+can help you solve one issue that you have.
+
+02:28.520 --> 02:31.559
+And that naturally doesn't become a discussion
+
+02:31.560 --> 02:35.279
+of where you are from, what are you trying to achieve,
+
+02:35.280 --> 02:39.999
+and where you want to move forward with using this editor
+
+02:40.000 --> 02:42.279
+or using this tool.
+
+02:42.280 --> 02:45.639
+Instead, here, we want something more personal,
+
+02:45.640 --> 02:48.639
+something more like you tell your story.
+
+02:48.640 --> 02:53.879
+And if I can help you achieve what you need,
+
+02:53.880 --> 02:58.959
+I am also interested in your story as a buddy.
+
+02:58.960 --> 03:03.359
+So given that, how do you get in touch with a buddy?
+
+03:03.360 --> 03:04.679
+Well, the thing is easy.
+
+03:04.680 --> 03:12.719
+Just ping me at this email, andrea-dev@hotmail.com.
+
+03:12.720 --> 03:15.399
+And I can put you in touch with one of the buddies
+
+03:15.400 --> 03:16.759
+that are available.
+
+03:16.760 --> 03:20.199
+Or you can contact them personally, directly,
+
+03:20.200 --> 03:26.279
+because on the web page, on the Emacs Buddy web page,
+
+03:26.280 --> 03:32.559
+there are links to their material or their websites.
+
+03:32.560 --> 03:35.599
+And sometimes you can find the contact yourself.
+
+03:35.600 --> 03:37.159
+Anyway, I am a facilitator.
+
+03:37.160 --> 03:41.919
+So if you contact me, I will find the contact for the person
+
+03:41.920 --> 03:43.079
+that you want to get in touch.
+
+03:43.080 --> 03:44.479
+You can also get in touch with me.
+
+03:44.480 --> 03:47.959
+I'm a buddy myself.
+
+03:47.960 --> 03:49.599
+How did it go so far?
+
+03:49.600 --> 03:52.479
+Well, from when I started the initiative,
+
+03:52.480 --> 03:55.039
+more or less we had 10 buddies.
+
+03:55.040 --> 03:58.719
+We had 10 buddies that are available to help you
+
+03:58.720 --> 04:01.519
+with your Emacs journey.
+
+04:01.520 --> 04:04.879
+And I buddyed myself, or I got in touch
+
+04:04.880 --> 04:10.679
+with people that wanted a buddy, about eight people.
+
+04:10.680 --> 04:14.759
+Each of these conversations was quite interesting.
+
+04:14.760 --> 04:19.639
+I decided to paraphrase one.
+
+04:19.640 --> 04:23.519
+I had this user that got in touch and said:
+
+04:23.520 --> 04:25.559
+"I used Emacs for 10 years.
+
+04:25.560 --> 04:27.279
+I'm curious about the initiative,
+
+04:27.280 --> 04:32.359
+and here is my GitHub that I started writing recently,
+
+04:32.360 --> 04:37.679
+Elisp projects", projects in Elisp to extend Emacs.
+
+04:37.680 --> 04:40.839
+I looked at their code.
+
+04:40.840 --> 04:43.879
+I suggested, "Oh, why don't you use dash?
+
+04:43.880 --> 04:45.299
+It's something that I'm familiar with.
+
+04:45.300 --> 04:49.439
+Maybe you may like it as well."
+
+04:49.440 --> 04:51.719
+And then I started asking, "Oh, what do you do with Emacs?
+
+04:51.720 --> 04:55.999
+Have you tried a note taking tool like Org Roam?"
+
+04:56.000 --> 04:58.039
+And then the conversation started.
+
+04:58.040 --> 05:00.199
+So "yeah, I tried Org Roam version one.
+
+05:00.200 --> 05:01.199
+I use my own thing.
+
+05:01.200 --> 05:02.879
+But what is it...
+
+05:02.880 --> 05:04.239
+I'm curious about version two.
+
+05:04.240 --> 05:05.839
+Did you use it?
+
+05:05.840 --> 05:07.079
+Do you know about Luhmann?"
+
+05:07.080 --> 00:05:09.861
+That is the inspiration of Org Roam
+
+00:05:09.862 --> 00:05:13.239
+and the backlinking and stuff.
+
+05:13.240 --> 05:15.479
+And then I started the conversation about that.
+
+05:15.480 --> 05:18.359
+And we discussed about functional programming.
+
+05:18.360 --> 05:23.279
+We discussed a bit about philosophy and went on.
+
+05:23.280 --> 05:29.159
+And then this conversation is not currently going.
+
+05:29.160 --> 05:32.759
+So we arrived to a point in which it sort of died out.
+
+05:32.760 --> 05:36.679
+But if I want or if they want, they can ping me back.
+
+05:36.680 --> 05:37.439
+I can ping them.
+
+05:37.440 --> 05:40.799
+So it's sort of a reference of this person exists
+
+05:40.800 --> 05:44.439
+and is an interesting person to chat with when I have something
+
+05:44.440 --> 05:48.359
+to say to them.
+
+05:48.360 --> 05:50.479
+And what if you want to be a buddy?
+
+05:50.480 --> 05:54.279
+Well, if you want to be a buddy, it's easy as well.
+
+05:54.280 --> 06:02.279
+So basically, just open a PR on the Emacs buddy repository.
+
+06:02.280 --> 06:05.279
+That is something that I am maintaining at the moment.
+
+06:05.280 --> 06:07.759
+Or simply send me the information.
+
+06:07.760 --> 06:09.999
+Somebody just sent me an email with the information.
+
+06:10.000 --> 06:14.719
+I have created the commit to make it public available.
+
+06:14.720 --> 06:18.559
+The information is just your name, a summary,
+
+06:18.560 --> 06:21.559
+what kind of user you are so that you can attract
+
+06:21.560 --> 06:28.039
+the right people to you, and a link to your material
+
+06:28.040 --> 06:31.959
+so that if they are curious about your summary or about you,
+
+06:31.960 --> 06:35.559
+they can actually go and check and even contact you directly.
+
+06:35.560 --> 06:40.559
+If they contact via me, I will know your email anyway
+
+06:40.560 --> 06:44.319
+from the PR you open.
+
+06:44.320 --> 06:45.759
+So that is all.
+
+06:45.760 --> 06:53.039
+There are ideas to maybe... if... this is basically
+
+06:53.040 --> 06:54.759
+an advertisement for this initiative
+
+06:54.760 --> 06:57.639
+so that we can get people that want to be helped
+
+06:57.640 --> 07:01.199
+or people that want to help.
+
+07:01.200 --> 07:03.599
+It's building up organically, so no rush
+
+07:03.600 --> 07:08.639
+to make this thing grow, escalate enormously.
+
+07:08.640 --> 07:12.479
+But for example, there are ideas to join this with the meetup
+
+07:12.480 --> 07:15.719
+talk that is being happening in the conference.
+
+07:15.720 --> 07:19.519
+So for example, if you find out something very interesting,
+
+07:19.520 --> 07:22.199
+you can bring the discussion that you have with your buddy
+
+07:22.200 --> 07:27.559
+into a meetup so that the group with which you speak is bigger.
+
+07:27.560 --> 07:28.919
+There are ideas like that.
+
+07:28.920 --> 07:33.119
+But first of all, just get in touch if you want to find
+
+07:33.120 --> 07:36.599
+like-minded people that want to help you with your Emacs
+
+07:36.600 --> 07:38.919
+journey or if you want to help others.
+
+07:38.920 --> 07:39.799
+Thank you very much.
+
+07:39.800 --> 07:59.520
+Enjoy the rest of the talks and chat to you soon.
diff --git a/2022/captions/emacsconf-2022-devel--emacs-development-updates--john-wiegley--main.vtt b/2022/captions/emacsconf-2022-devel--emacs-development-updates--john-wiegley--main.vtt new file mode 100644 index 00000000..a55331b2 --- /dev/null +++ b/2022/captions/emacsconf-2022-devel--emacs-development-updates--john-wiegley--main.vtt @@ -0,0 +1,473 @@ +WEBVTT + +1 +00:00:00.000 --> 00:00:05.320 +Hello, it's time for another Emacs development update. + +2 +00:00:05.320 --> 00:00:07.800 +I want to thank the organizers of EmacsConf + +3 +00:00:07.800 --> 00:00:10.160 +for putting this together + +4 +00:00:10.160 --> 00:00:12.280 +and also the maintainers of Emacs + +5 +00:00:12.280 --> 00:00:14.240 +with a special thanks to Eli Zaretskii. + +6 +00:00:14.240 --> 00:00:16.560 +It's really he who gave me this information + +7 +00:00:16.560 --> 00:00:19.320 +so that I could pass it along to you. + +8 +00:00:19.320 --> 00:00:21.720 +The main thing to discuss this time + +9 +00:00:21.720 --> 00:00:25.880 +with regard to what's been going on with Emacs is Emacs 29. + +10 +00:00:25.880 --> 00:00:29.840 +The release cycle for Emacs 29 should begin in December + +11 +00:00:29.840 --> 00:00:32.720 +when a branch will be cut and the release work will start. + +12 +00:00:32.720 --> 00:00:36.640 +We should be seeing Emacs 29 coming out fairly soon. + +13 +00:00:36.640 --> 00:00:38.120 +Here's just a brief overview + +14 +00:00:38.120 --> 00:00:39.680 +of some of the things to look forward to + +15 +00:00:39.680 --> 00:00:42.400 +coming up in Emacs 29. + +16 +00:00:42.400 --> 00:00:45.680 +Overlays have been re-implemented. + +17 +00:00:45.680 --> 00:00:47.240 +If you haven't used them before, + +18 +00:00:47.240 --> 00:00:51.040 +overlays are a way to apply a set of properties + +19 +00:00:51.040 --> 00:00:53.680 +over a range of text so that + +20 +00:00:53.680 --> 00:00:55.840 +you can have things like mouse clicks + +21 +00:00:55.840 --> 00:00:57.920 +take on different behavior + +22 +00:00:57.920 --> 00:00:59.520 +depending on where it happens in the text. + +23 +00:00:59.520 --> 00:01:01.720 +This is different than text properties + +24 +00:01:01.720 --> 00:01:04.080 +which associate the properties with the text itself. + +25 +00:01:04.080 --> 00:01:07.200 +Overlays do not alter the text in any way + +26 +00:01:07.200 --> 00:01:09.320 +and they simply, as the name suggests, + +27 +00:01:09.320 --> 00:01:10.920 +overlay on the buffer. + +28 +00:01:10.920 --> 00:01:14.040 +Now previously, overlays were implemented as linear lists + +29 +00:01:14.040 --> 00:01:15.800 +which got very slow when there were + +30 +00:01:15.800 --> 00:01:17.840 +a lot of overlays in a buffer. + +31 +00:01:17.840 --> 00:01:19.880 +Now they're being re-implemented as trees, + +32 +00:01:19.880 --> 00:01:21.880 +so that searching should be very fast, and + +33 +00:01:21.880 --> 00:01:24.400 +in fact, comparable to text properties. + +34 +00:01:24.400 --> 00:01:26.520 +This is already on the master branch + +35 +00:01:26.520 --> 00:01:29.080 +and (more or less) is ready for release. + +36 +00:01:29.080 --> 00:01:32.200 +Eglot has been ported into Emacs. + +37 +00:01:32.200 --> 00:01:35.560 +Eglot is an LSP [Language Server Protocol] client for Emacs, + +38 +00:01:35.560 --> 00:01:38.480 +one of the two that are often used. + +39 +00:01:38.480 --> 00:01:40.840 +But now it's going to be included in core, + +40 +00:01:40.840 --> 00:01:42.800 +so it's considered official + +41 +00:01:42.800 --> 00:01:46.480 +and will be well integrated with other Emacs features. + +42 +00:01:46.480 --> 00:01:48.720 +There's going to be a Tree-sitter library. + +43 +00:01:48.720 --> 00:01:53.200 +Tree-sitter is a way of building fast incremental parsers. + +44 +00:01:53.200 --> 00:01:56.040 +There's a website on Tree-sitter if you Google for that. + +45 +00:01:56.040 --> 00:01:57.760 +This can be used for various features, + +46 +00:01:57.760 --> 00:01:59.760 +but first and foremost, it'll be used + +47 +00:01:59.760 --> 00:02:02.920 +for fontification and indentation in Emacs. + +48 +00:02:02.920 --> 00:02:05.600 +Instead of heuristics and regular expressions, + +49 +00:02:05.600 --> 00:02:07.400 +you can now build your fontifications + +50 +00:02:07.400 --> 00:02:08.720 +based on a parse tree. + +51 +00:02:08.720 --> 00:02:10.640 +There's a branch now that supports this + +52 +00:02:10.640 --> 00:02:13.600 +for several modes already, like Python, TypeScript, + +53 +00:02:13.600 --> 00:02:15.080 +and JavaScript. + +54 +00:02:15.080 --> 00:02:18.160 +We don't have anyone yet working on it for C mode + +55 +00:02:18.160 --> 00:02:20.480 +but Eli has challenged whether anyone + +56 +00:02:20.480 --> 00:02:21.960 +in the community is interested. + +57 +00:02:21.960 --> 00:02:25.960 +He would love to see Tree-sitter support added for C mode, + +58 +00:02:25.960 --> 00:02:27.880 +because this has been quite slow + +59 +00:02:27.880 --> 00:02:29.640 +when dealing with very, very large files + +60 +00:02:29.640 --> 00:02:30.840 +and Tree-sitter should help that. + +61 +00:02:30.840 --> 00:02:34.320 +There have been significant improvements + +62 +00:02:34.320 --> 00:02:36.560 +in dealing with very long lines. + +63 +00:02:36.560 --> 00:02:38.160 +This is something that has been + +64 +00:02:38.160 --> 00:02:40.480 +a long time frequent complaint. + +65 +00:02:40.480 --> 00:02:42.840 +Emacs becomes rather unusable + +66 +00:02:42.840 --> 00:02:45.560 +if you open a giant file that's a single long line. + +67 +00:02:45.560 --> 00:02:49.560 +Anyone who's ever tried to open a 30 megabyte JSON file + +68 +00:02:49.560 --> 00:02:52.200 +that's all on one line will know this pain. + +69 +00:02:52.200 --> 00:02:55.960 +Some modes, however, will have to adapt to this change, + +70 +00:02:55.960 --> 00:02:58.320 +because sometimes access to the whole buffer + +71 +00:02:58.320 --> 00:03:00.480 +is now forcefully restricted. + +72 +00:03:00.480 --> 00:03:04.400 +If the mode requires access to the entire buffer + +73 +00:03:04.400 --> 00:03:07.960 +at all times to work, then the developer of that mode + +74 +00:03:07.960 --> 00:03:10.240 +will need to devise some simplifications + +75 +00:03:10.240 --> 00:03:13.160 +so that they don't require that complete access. + +76 +00:03:13.160 --> 00:03:15.760 +For example, if a mode used to go way back + +77 +00:03:15.760 --> 00:03:16.880 +to the beginning of the buffer + +78 +00:03:16.880 --> 00:03:19.520 +in order to determine if there's an unbalanced parenthesis, + +79 +00:03:19.520 --> 00:03:23.160 +this won't work in the new long lines support mode, + +80 +00:03:23.160 --> 00:03:25.640 +because the entire buffer is not always available. + +81 +00:03:25.640 --> 00:03:27.680 +Emacs is sort of doing some + +82 +00:03:27.680 --> 00:03:29.920 +restricting of the buffer heuristically + +83 +00:03:29.920 --> 00:03:32.200 +in order to keep the visible range working + +84 +00:03:32.200 --> 00:03:35.240 +very, very quickly now. + +85 +00:03:35.240 --> 00:03:39.040 +Emacs can now build directly with SQLite. + +86 +00:03:39.040 --> 00:03:42.360 +This means that SQLite databases + +87 +00:03:42.360 --> 00:03:44.840 +can be directly accessible from Emacs. + +88 +00:03:44.840 --> 00:03:47.360 +Should be nice for anyone whose mode wants to + +89 +00:03:47.360 --> 00:03:50.080 +cache or store some queryable data. + +90 +00:03:50.080 --> 00:03:54.960 +The XInput extension is now up to version 2. + +91 +00:03:54.960 --> 00:03:58.160 +There are many extensions in this specification. + +92 +00:03:58.160 --> 00:03:59.600 +From the user's point of view, + +93 +00:03:59.600 --> 00:04:02.920 +it enables things like smooth scrolling and touch devices. + +94 +00:04:02.920 --> 00:04:06.320 +Emacs will now use this by default on all systems + +95 +00:04:06.320 --> 00:04:08.360 +where the library is installed. + +96 +00:04:08.360 --> 00:04:11.320 +It should be on every modern system that uses X. + +97 +00:04:11.320 --> 00:04:15.560 +There's also a pure GTK build in Emacs 29. + +98 +00:04:15.560 --> 00:04:17.560 +The purpose of this is to allow Emacs + +99 +00:04:17.560 --> 00:04:21.160 +on systems without X, such as Wayland or Broadway, + +100 +00:04:21.160 --> 00:04:24.640 +to be able to have a graphical build of Emacs. + +101 +00:04:24.640 --> 00:04:27.280 +There's also lots of improvements to drag and drop + +102 +00:04:27.280 --> 00:04:31.400 +on X systems, for people who like drag and drop. + +103 +00:04:31.400 --> 00:04:35.240 +And there's support for double buffering on Microsoft Windows. + +104 +00:04:35.240 --> 00:04:38.480 +The last of the headline features + +105 +00:04:38.480 --> 00:04:41.640 +coming for Emacs 29 is emoji input. + +106 +00:04:41.640 --> 00:04:43.520 +So there will now be a prefix key, + +107 +00:04:43.520 --> 00:04:47.320 +C-x 8 e for emoji input, + +108 +00:04:47.320 --> 00:04:50.240 +along with several new commands to insert emoji + +109 +00:04:50.240 --> 00:04:52.480 +by various forms of shorthand. + +110 +00:04:52.480 --> 00:04:54.360 +There will even be an input method + +111 +00:04:54.360 --> 00:04:57.600 +where you can write the plain English names of emojis + +112 +00:04:57.600 --> 00:05:00.080 +and have the symbol inserted. + +113 +00:05:00.080 --> 00:05:02.160 +So that rounds out some of the features + +114 +00:05:02.160 --> 00:05:03.680 +coming up for Emacs 29. + +115 +00:05:03.680 --> 00:05:05.680 +Sounds like an exciting release + +116 +00:05:05.680 --> 00:05:07.360 +and it should be headed your way soon. + +117 +00:05:07.360 --> 00:05:09.880 +I hope everybody has fun at the conference + +118 +00:05:09.880 --> 00:05:15.280 +and enjoy yourselves. diff --git a/2022/captions/emacsconf-2022-handwritten--how-to-incorporate-handwritten-notes-into-emacs-orgmode--bala-ramadurai--main.vtt b/2022/captions/emacsconf-2022-handwritten--how-to-incorporate-handwritten-notes-into-emacs-orgmode--bala-ramadurai--main.vtt new file mode 100644 index 00000000..0d944ae2 --- /dev/null +++ b/2022/captions/emacsconf-2022-handwritten--how-to-incorporate-handwritten-notes-into-emacs-orgmode--bala-ramadurai--main.vtt @@ -0,0 +1,323 @@ +WEBVTTcaptioned by jai + +00:00:00.000 --> 00:00:08.079 +Can you recognize this building? + +00:00:08.080 --> 00:00:09.799 +Some of you may have recognized this. + +00:00:09.800 --> 00:00:11.439 +This building is called + +00:00:11.440 --> 00:00:14.479 +the John Hancock building. + +00:00:14.480 --> 00:00:17.359 +This is in Chicago. + +00:00:17.360 --> 00:00:19.479 +I recently bought this building. + +00:00:19.480 --> 00:00:21.319 +Isn't it nice? + +00:00:21.320 --> 00:00:23.239 +Heavens no! + +00:00:23.240 --> 00:00:27.639 +I am in my home in Pune in India. + +00:00:27.640 --> 00:00:29.159 +I am Bala Ramadurai, + +00:00:29.160 --> 00:00:33.559 +an author, professor, and an innovation coach. + +00:00:33.560 --> 00:00:35.999 +Hello and welcome to my talk on + +00:00:36.000 --> 00:00:39.559 +“How to incorporate handwritten notes + +00:00:39.560 --> 00:00:42.279 +into Emacs Org Mode” + +00:00:42.280 --> 00:00:45.919 +Now, why did I show you this building? + +00:00:45.920 --> 00:00:49.399 +The name is of interest for this talk. + +00:00:49.400 --> 00:00:52.359 +In the US, someone's signature is + +00:00:52.360 --> 00:00:55.199 +also referred to as their Hancock. + +00:00:55.200 --> 00:00:59.679 +Your handwriting is pretty much part of your identity. + +00:00:59.680 --> 00:01:03.119 +It is as fundamental as that. + +00:01:03.120 --> 00:01:07.599 +Of course, there is a movie by that name too, Hancock. + +00:01:07.600 --> 00:01:11.999 +I could have started with a clip from that movie, + +00:01:12.000 --> 00:01:15.879 +but in spite of Will Smith and Charlize Theron, + +00:01:15.880 --> 00:01:24.159 +both my favorite movie stars in the movie, I hated it. + +00:01:24.160 --> 00:01:35.159 +[Clip from Hancock (2008)] + +00:01:35.160 --> 00:01:40.479 +But I digress. + +00:01:40.480 --> 00:01:44.199 +Handwriting has been a fascinating topic for me. + +00:01:44.200 --> 00:01:49.719 +However, note-taking has always been on my computer, + +00:01:49.720 --> 00:01:54.119 +in particular, in the Emacs Org Mode system. + +00:01:54.120 --> 00:01:57.359 +It is so easy to note down anything, + +00:01:57.360 --> 00:01:59.839 +add a schedule, add a deadline, + +00:01:59.840 --> 00:02:04.279 +search anything you want, link anything you want, + +00:02:04.280 --> 00:02:07.919 +export it to any format, track what you've been doing, + +00:02:07.920 --> 00:02:12.559 +clock your tasks, and on and on and on. + +00:02:12.560 --> 00:02:15.519 +It's such a squeaky-clean system to + +00:02:15.520 --> 00:02:17.559 +track everything and link it to + +00:02:17.560 --> 00:02:20.799 +anything from the digital world. + +00:02:20.800 --> 00:02:24.639 +Sharing the original notes is still a pain in the rear, + +00:02:24.640 --> 00:02:29.359 +but for personal stuff, it's awesome. + +00:02:29.360 --> 00:02:32.639 +But then what about handwriting? + +00:02:32.640 --> 00:02:35.639 +Research seems to suggest that handwritten notes + +00:02:35.640 --> 00:02:40.199 +can enhance clarity of thought, retention, + +00:02:40.200 --> 00:02:50.559 +sometimes even getting rid of your worries. + +00:02:50.560 --> 00:03:06.399 +[Fried, C. B. (2008). In-class laptop use and +its effects on student learning] + +00:03:06.400 --> 00:03:13.639 +[Speaker displays articles on Note-taking] + +00:03:13.640 --> 00:03:17.839 +My experience seems to agree with that too. + +00:03:17.840 --> 00:03:21.199 +As a professor, my fear has always been + +00:03:21.200 --> 00:03:25.199 +this quote, “Lecturing is that mysterious process + +00:03:25.200 --> 00:03:29.239 +by means of which the contents of the notebook + +00:03:29.240 --> 00:03:31.879 +of the professor are transferred + +00:03:31.880 --> 00:03:34.919 +through the instrument of the fountain pen + +00:03:34.920 --> 00:03:37.279 +to the notebook of the student + +00:03:37.280 --> 00:03:40.639 +without passing through the mind of either.” + +00:03:40.640 --> 00:03:45.679 +Hmmm... So, question — How do we combine + +00:03:45.680 --> 00:03:48.159 +the efficient Org Mode system + +00:03:48.160 --> 00:03:53.719 +with the effective handwritten note-taking system? + +00:03:53.720 --> 00:03:56.799 +Merge the systems together. Absolutely. + +00:03:56.800 --> 00:03:59.359 +How do you do that? + +00:03:59.360 --> 00:04:03.679 +Step 1: Write the notes by hand + +00:04:03.680 --> 00:04:06.079 +on a notebook. Pen, pencil. + +00:04:06.080 --> 00:04:08.999 +Keep some convention for yourselves + +00:04:09.000 --> 00:04:13.039 +for tracking tasks like a star or an asterisk. + +00:04:13.040 --> 00:04:16.399 +Step 2: Scan them using + +00:04:16.400 --> 00:04:18.559 +your favourite mobile app. + +00:04:18.560 --> 00:04:23.439 +I recommend Adobe Scan or Dropbox. + +00:04:23.440 --> 00:04:29.999 +Step 3: store the document as a JPG file + +00:04:30.000 --> 00:04:32.679 +into a folder called Inbox. + +00:04:32.680 --> 00:04:37.759 +Make sure this syncs into a cloud storage folder + +00:04:37.760 --> 00:04:39.479 +and your Org Mode system + +00:04:39.480 --> 00:04:41.119 +has access to this folder. + +00:04:41.120 --> 00:04:45.919 +(Optional) Step 4: convert the notes into text + +00:04:45.920 --> 00:04:49.319 +using Google Keep or just type + +00:04:49.320 --> 00:04:51.519 +the damn thing one more time. + +00:04:51.520 --> 00:04:54.919 +Then you can process that + +00:04:54.920 --> 00:04:56.239 +in your Org Mode system + +00:04:56.240 --> 00:04:59.639 +as you always do in whatever + +00:04:59.640 --> 00:05:02.119 +is there in your inbox. + +00:05:02.120 --> 00:05:06.119 +But, three steps or four before I get access + +00:05:06.120 --> 00:05:09.399 +to my notes and into my Org Mode? + +00:05:09.400 --> 00:05:11.639 +What a precious waste of time. + +00:05:11.640 --> 00:05:14.119 +I'd rather be tinkering with my + +00:05:14.120 --> 00:05:18.799 +config file in that time, correct? + +00:05:18.800 --> 00:05:19.359 +Boy... + +00:05:19.360 --> 00:05:24.919 +Get or buy or gift or convince your partner, + +00:05:24.920 --> 00:05:29.719 +parent, or anybody else to gift yourself + +00:05:29.720 --> 00:05:31.959 +a touch-enabled large device. + +00:05:31.960 --> 00:05:37.879 +Then use an app like OneNote to write notes + +00:05:37.880 --> 00:05:41.439 +on the device and link the handwritten note + +00:05:41.440 --> 00:05:46.239 +directly into Org Mode by copying the link. + +00:05:46.240 --> 00:05:54.079 +You can use a shortcut like Ctrl-1 + +00:05:54.080 --> 00:05:59.479 +to mark the todos, but that means it remains + +00:05:59.480 --> 00:06:05.159 +only on OneNote ecosystem, the todos. + +00:06:05.160 --> 00:06:14.919 +You can use the same app to also convert + +00:06:14.920 --> 00:06:18.319 +the handwritten note into text + +00:06:18.320 --> 00:06:23.559 +just by the click of a button. + +00:06:23.560 --> 00:06:27.359 +As a bonus, you can even include screenshots + +00:06:27.360 --> 00:06:30.919 +from your online meetings. + +00:06:30.920 --> 00:06:33.439 +I like both my options. + +00:06:33.440 --> 00:06:36.439 +Option 1: use a regular notebook, + +00:06:36.440 --> 00:06:40.839 +scan and process them into my inbox. + +00:06:40.840 --> 00:06:44.559 +Option 2: write the notes in a digital device + +00:06:44.560 --> 00:06:46.479 +and convert them into text. + +00:06:46.480 --> 00:06:52.479 +Or, third option, I appeal to thee, + +00:06:52.480 --> 00:06:56.999 +oh great community, can you please build a package + +00:06:57.000 --> 00:07:00.959 +inside Org Mode that recognises handwriting + +00:07:00.960 --> 00:07:10.039 +to export it into our Org Mode, Emacs Org Mode. + +00:07:10.040 --> 00:07:38.640 +Thank you so much for your attention. Bye. diff --git a/2022/captions/emacsconf-2022-health--health-data-journaling-and-visualization-with-org-mode-and-gnuplot--david-otoole--main.vtt b/2022/captions/emacsconf-2022-health--health-data-journaling-and-visualization-with-org-mode-and-gnuplot--david-otoole--main.vtt new file mode 100644 index 00000000..d785b36e --- /dev/null +++ b/2022/captions/emacsconf-2022-health--health-data-journaling-and-visualization-with-org-mode-and-gnuplot--david-otoole--main.vtt @@ -0,0 +1,1261 @@ +WEBVTT captioned by sachac + +NOTE Introduction + +00:00:00.000 --> 00:00:03.999 +Hi, this is Dave O'Toole, and today + +00:00:04.000 --> 00:00:07.799 +I'll be giving a presentation on tracking health data + +00:00:07.800 --> 00:00:12.759 +with Emacs, Org Mode, and Gnuplot. + +00:00:12.760 --> 00:00:16.079 +So Gnuplot is the well-known scientific + +00:00:16.080 --> 00:00:19.039 +and mathematical plotting application. + +00:00:19.040 --> 00:00:24.639 +You feed it text files full of names, dates, numbers, + +00:00:24.640 --> 00:00:27.199 +data points, and you get out a nice graph. + +00:00:27.200 --> 00:00:31.119 +You can spit out SVG. You can spit out PNG graphics. + +00:00:31.120 --> 00:00:33.639 +In this case, we're using an SVG. + +NOTE How to take daily health journal items + +00:00:33.640 --> 00:00:36.839 +What I'm going to show you today + +00:00:36.840 --> 00:00:39.839 +is how to take daily health journal items: + +00:00:39.840 --> 00:00:42.119 +in other words, things like I exercised + +00:00:42.120 --> 00:00:44.319 +such and such number of minutes today, + +00:00:44.320 --> 00:00:47.399 +I got X hours of sleep last night, + +00:00:47.400 --> 00:00:51.479 +I used such and such number of pieces of nicotine gum, + +00:00:51.480 --> 00:00:54.559 +say five pieces. So let's see, + +00:00:54.560 --> 00:00:58.439 +we've got this whole picture here, all right, + +00:00:58.440 --> 00:00:59.359 +and I've tracked here... + +00:00:59.360 --> 00:01:02.319 +This is a month of data from my life. + +00:01:02.320 --> 00:01:05.159 +This is... I'm not showing all the variables, + +00:01:05.160 --> 00:01:08.519 +but this is what I felt comfortable sharing + +00:01:08.520 --> 00:01:14.239 +in order to help people who might have a need to track, + +00:01:14.240 --> 00:01:15.919 +either because of a chronic condition, + +00:01:15.920 --> 00:01:18.599 +or just because of a health improvement goal + +00:01:18.600 --> 00:01:20.959 +or what have you, people who might need to + +00:01:20.960 --> 00:01:23.319 +track health data in a way + +00:01:23.320 --> 00:01:24.959 +that's a little bit more robust + +00:01:24.960 --> 00:01:26.599 +than just one or two variables + +00:01:26.600 --> 00:01:29.839 +and just weight or just blood pressure. + +00:01:29.840 --> 00:01:33.079 +So in this case, I've got exercise, + +00:01:33.080 --> 00:01:36.399 +I've got the number of hours of sleep, + +00:01:36.400 --> 00:01:38.559 +the number of doses of nicotine, + +00:01:38.560 --> 00:01:40.799 +(that's the yellow line here), + +00:01:40.800 --> 00:01:44.199 +and this is referring to nicotine gum. + +00:01:44.240 --> 00:01:45.559 +What we're going to be talking about + +00:01:45.560 --> 00:01:47.839 +is looking at connections, the idea + +00:01:47.840 --> 00:01:49.879 +that plotting your data can actually + +00:01:49.880 --> 00:01:52.119 +help you figure out what's going on. + +00:01:52.120 --> 00:01:53.079 +This is just one month. + +00:01:53.080 --> 00:01:55.439 +I've been doing this for a couple of months now, + +00:01:55.440 --> 00:01:57.559 +but I felt comfortable showing one month + +00:01:57.560 --> 00:01:59.439 +with a limited subset of the variables. + +NOTE How to set up your org templates + +00:01:59.440 --> 00:02:02.239 +What I'm going to be doing in this presentation + +00:02:02.240 --> 00:02:05.279 +is showing you how to set up your org templates + +00:02:05.280 --> 00:02:08.799 +so that you can, you know, hit a hotkey + +00:02:08.800 --> 00:02:11.839 +to capture today's data with an org template-- + +00:02:11.840 --> 00:02:14.199 +or in this case yesterday's. Usually I'm saying, okay, + +00:02:14.200 --> 00:02:15.639 +yesterday this happened, + +00:02:15.640 --> 00:02:17.479 +because you don't know until the day's over + +00:02:17.480 --> 00:02:19.719 +how many pieces of nicotine gum you ate + +00:02:19.720 --> 00:02:21.439 +or how many hours you slept. + +00:02:21.440 --> 00:02:25.959 +So usually we're recording data for the previous day. + +00:02:25.960 --> 00:02:28.079 +We can set up a capture template + +00:02:28.080 --> 00:02:30.919 +so that it fills a little org entry. One for exercise, + +00:02:30.920 --> 00:02:34.279 +one for sleep, one for nicotine, one for distress. + +00:02:34.280 --> 00:02:36.919 +Here distress is just 1 to 10: + +00:02:36.920 --> 00:02:38.559 +how bad do you feel today? + +00:02:38.560 --> 00:02:41.639 +It's not a scientific measure, but you know, + +00:02:41.640 --> 00:02:43.359 +many, many things ask you to rate + +00:02:43.360 --> 00:02:47.119 +on a scale of 1 to 10, how bad is the anxiety, + +00:02:47.120 --> 00:02:49.639 +how bad is the general level of stress, + +00:02:49.640 --> 00:02:51.679 +and so without a lot of complication, + +00:02:51.680 --> 00:02:53.159 +I just rate that one to ten. + +00:02:53.160 --> 00:02:58.799 +Pain, okay, we won't have to get into any details, + +00:02:58.800 --> 00:03:00.959 +but if there is a level of chronic pain, well, + +00:03:00.960 --> 00:03:04.239 +I put that between 1 and 10. As we can see here, + +00:03:04.240 --> 00:03:07.319 +during the period that I've shown you, it's pretty low. + +00:03:07.320 --> 00:03:11.919 +There's some. If you miss a dose of medication, + +00:03:11.920 --> 00:03:13.599 +you can track that, in this case + +00:03:13.600 --> 00:03:17.639 +with a big ugly red triangle, you know. + +00:03:17.640 --> 00:03:24.279 +You can see, I can see here that in mid-, in late September, + +00:03:24.280 --> 00:03:29.199 +sorry, in early to mid-October, + +00:03:29.200 --> 00:03:30.999 +I stopped using the nicotine gum + +00:03:31.000 --> 00:03:32.959 +and probably should have cut down more gradually + +00:03:32.960 --> 00:03:34.759 +because my sleep suffered. Look at this. + +00:03:34.760 --> 00:03:37.199 +The sleep line is down here, okay? + +NOTE How to do it in GNU Emacs + +00:03:38.320 --> 00:03:39.519 +What I'm going to do now, + +00:03:39.520 --> 00:03:40.879 +now that I've shown you the graph + +00:03:40.880 --> 00:03:44.799 +and some of the things that are useful about it, + +00:03:44.800 --> 00:03:46.639 +I'm going to actually take a step back + +00:03:46.640 --> 00:03:50.319 +and show you from start to finish how you can do this + +00:03:50.320 --> 00:03:53.319 +in GNU Emacs, and I have a little template generator + +00:03:53.320 --> 00:03:56.279 +that you can use if you'd like. + +00:03:56.280 --> 00:03:59.919 +All right, so let's go back. + +00:03:59.920 --> 00:04:01.479 +Let's step back from this file. + +00:04:01.480 --> 00:04:07.599 +We're going to split the screen, and on the left side, + +00:04:07.600 --> 00:04:09.839 +I'm going to put the underlying Org file + +00:04:09.840 --> 00:04:10.919 +that generates this graph. + +00:04:10.920 --> 00:04:16.839 +Let me shrink that a little bit. + +NOTE Overview of the presentation + +00:04:16.840 --> 00:04:22.759 +All right, I'm going to work my way backwards + +00:04:22.760 --> 00:04:26.519 +from the template to the template generator, + +00:04:26.520 --> 00:04:28.439 +meaning that you'll be able to spit out, + +00:04:28.440 --> 00:04:31.839 +given your own specification of health variables, + +00:04:31.840 --> 00:04:33.519 +you'll be able to have it spit out + +00:04:33.520 --> 00:04:38.159 +a custom Gnuplot script like this + +00:04:38.160 --> 00:04:41.319 +that's preset up with the definitions + +00:04:41.320 --> 00:04:43.159 +for the column view in Org mode. + +00:04:43.160 --> 00:04:45.399 +I'm assuming a little bit of familiarity + +00:04:45.400 --> 00:04:47.199 +with Org mode and Gnuplotting, + +00:04:47.200 --> 00:04:51.959 +but I'll try to explain as much as I can as I go along. + +NOTE The journal + +00:04:51.960 --> 00:04:59.039 +The journal here is where... okay, okay, one moment. + +00:04:59.040 --> 00:05:03.519 +So as you can see, there's a sub-entry here + +00:05:03.520 --> 00:05:06.279 +for each day that I've included from my data set + +00:05:06.280 --> 00:05:08.559 +starting on September 13th of this year + +00:05:08.560 --> 00:05:10.399 +and ending on October 17th. + +00:05:10.400 --> 00:05:16.959 +And there's an Org property drawer with + +00:05:16.960 --> 00:05:22.999 +the corresponding names of each field and the value. + +00:05:29.800 --> 00:05:36.759 +Now the idea here is that the columns specify... + +00:05:36.760 --> 00:05:40.639 +if you know a little bit about Org mode, + +00:05:40.640 --> 00:05:43.479 +what happens is that you... + +00:05:43.480 --> 00:05:50.919 +let's say that I hit the key for my journal template, + +00:05:50.920 --> 00:05:52.799 +which... Mine is very similar. + +NOTE The capture buffer + +00:05:52.800 --> 00:06:00.879 +This is the capture buffer for today's date, + +00:06:00.880 --> 00:06:02.679 +and if you're recording yesterday's date, + +00:06:02.680 --> 00:06:04.519 +you can just flip it like that if you need to. + +00:06:04.520 --> 00:06:08.639 +Then I say, yesterday, I remember + +00:06:08.640 --> 00:06:11.159 +I went for about a one-mile walk, + +00:06:11.160 --> 00:06:14.119 +so that's probably about 20 minutes, + +00:06:14.120 --> 00:06:16.519 +and that I had such and such, + +00:06:16.520 --> 00:06:19.079 +I had eight and a half hours of sleep, let's say. + +00:06:19.080 --> 00:06:22.479 +I estimate how many pieces of nicotine gum I have. + +00:06:22.480 --> 00:06:25.799 +I try to count as closely as I can, how much distress, + +00:06:25.800 --> 00:06:26.359 +you know what I mean, + +00:06:26.360 --> 00:06:28.279 +whether or not I missed a dose of medication. + +00:06:28.280 --> 00:06:32.399 +Then when you hit C-c C-c, + +00:06:32.400 --> 00:06:39.799 +it captures that to the end of your Org file. + +00:06:39.800 --> 00:06:46.679 +Now what this shows is that... I cut and paste it in. + +00:06:46.680 --> 00:06:48.159 +I've been keeping these entries every day for months, + +00:06:48.160 --> 00:06:51.319 +and that I cut and pasted in a month of data. + +NOTE The columnview table + +00:06:51.320 --> 00:07:00.799 +Now I'm going to dig in a little bit to the Gnuplot script. + +00:07:00.800 --> 00:07:07.759 +This here, all this stuff, is one component of the graph, + +00:07:07.760 --> 00:07:11.359 +and I'll go over how it works. + +00:07:11.360 --> 00:07:19.319 +First, the items through this column declaration here, + +00:07:19.320 --> 00:07:30.199 +and the id:myid, this columnview table here, + +00:07:30.200 --> 00:07:34.919 +#+BEGIN: columnview, this whole bit here, + +00:07:34.920 --> 00:07:39.879 +is going to get filled in with the corresponding columns, + +00:07:39.880 --> 00:07:43.039 +exercise minutes, sleep hours, nicotine doses. + +00:07:43.040 --> 00:07:53.559 +And then it gets pumped out by Org mode into a file + +00:07:53.560 --> 00:07:59.840 +that looks like this: tab-separated values + +00:07:59.841 --> 00:08:03.479 +with an ISO-style date at the beginning. + +NOTE Gnuplot + +00:08:03.480 --> 00:08:10.359 +So what we're going to do is we're going to go through + +00:08:10.360 --> 00:08:14.479 +the Gnuplot portion of this, + +00:08:14.480 --> 00:08:16.359 +and I'm going to enlarge the font a little. + +00:08:21.280 --> 00:08:23.719 +I'm going to go line by line through the Gnuplot portion. + +00:08:23.720 --> 00:08:30.639 +Now, my template generator will give you one like this. + +00:08:30.640 --> 00:08:33.119 +You don't have to write this from scratch. + +00:08:33.120 --> 00:08:35.679 +But I'm going to go through it line by line + +00:08:35.680 --> 00:08:37.479 +because if you do use the template, + +00:08:37.480 --> 00:08:42.199 +then it'll help to have gone through it line by line, + +00:08:42.200 --> 00:08:46.679 +because you're probably going to have to modify it. + +00:08:46.680 --> 00:08:49.119 +So first, we're going to clear the graphics + +00:08:49.120 --> 00:08:50.199 +from any previous runs + +00:08:50.200 --> 00:08:53.799 +so that if we reuse the same Gnuplot process, + +00:08:53.800 --> 00:08:57.759 +we're not overwriting the old-- + +00:08:57.760 --> 00:09:00.719 +that we are completely overwriting the old image. + +00:09:00.720 --> 00:09:03.319 +So that's the purpose of this line here. + +NOTE Output parameters + +00:09:03.320 --> 00:09:08.559 +The output parameters: we want to put out an SVG file. + +00:09:08.560 --> 00:09:13.639 +Font Arial, that's funny, + +00:09:13.640 --> 00:09:16.119 +but I don't know what font it's actually ending up choosing, + +00:09:16.120 --> 00:09:16.879 +but it looks fine. + +00:09:16.880 --> 00:09:19.639 +Then we want it to be square, + +00:09:19.640 --> 00:09:21.919 +so I'm giving it 900 by 900 pixels, + +00:09:21.920 --> 00:09:23.719 +even though it is a scalable vector graphic. + +00:09:23.720 --> 00:09:29.159 +We're putting it in the same folder as the org file, + +00:09:29.160 --> 00:09:30.799 +example.svg. + +00:09:30.800 --> 00:09:39.519 +These lines here set it up to use the Org mode format + +00:09:39.520 --> 00:09:42.679 +that we showed in the other file over here. + +00:09:42.680 --> 00:09:48.359 +The time format is four-digit year, two-digit month, + +00:09:48.360 --> 00:09:50.359 +two-digit day. + +00:09:50.360 --> 00:09:56.479 +The time format doesn't specify here the time, + +00:09:56.480 --> 00:09:59.599 +but that doesn't seem to mess it up. + +00:09:59.600 --> 00:10:02.439 +This line "set datafile separator" means that + +00:10:02.440 --> 00:10:04.239 +the separators between that + +00:10:04.240 --> 00:10:06.959 +and between all the other fields are tabs, + +00:10:06.960 --> 00:10:08.919 +which is what Org mode does + +00:10:08.920 --> 00:10:10.999 +when it spits out a table by default. + +00:10:11.000 --> 00:10:15.479 +Okay, along to the next lines. + +NOTE Time series data + +00:10:15.480 --> 00:10:18.119 +We're going to set up for time series data, + +00:10:18.120 --> 00:10:22.807 +meaning that the x-axis is going to be time, + +00:10:22.808 --> 00:10:26.119 +x2tics 1 format. + +00:10:26.120 --> 00:10:30.399 +I believe this means that every day has one tick + +00:10:30.400 --> 00:10:32.879 +and that this tells it that the first-- + +00:10:32.880 --> 00:10:39.359 +unfortunately, I forget the exact meaning of this one line. + +00:10:39.360 --> 00:10:44.959 +I'm just going to move on. We want one X tick per day, + +00:10:44.960 --> 00:10:46.519 +and because X is in seconds, + +00:10:46.520 --> 00:10:50.319 +it's 24 hours times 60 minutes times 60 seconds. + +00:10:50.320 --> 00:10:55.639 +This line "set grid xtics" gives us + +00:10:55.640 --> 00:10:57.279 +a vertical line on each day of the graph. + +00:10:57.280 --> 00:10:58.319 +I'll pull up the graph + +00:10:58.320 --> 00:11:00.039 +just so that it's a little easier to see. + +00:11:00.040 --> 00:11:03.919 +All these vertical lines, one on each day, + +00:11:03.920 --> 00:11:06.199 +that's given to you by "set grid xtics". + +00:11:06.200 --> 00:11:10.159 +One Y tick every five points. + +00:11:10.160 --> 00:11:13.719 +So here at five pieces of nicotine, + +00:11:13.720 --> 00:11:15.959 +we've got a five, at ten pieces – well, + +00:11:15.960 --> 00:11:19.679 +we don't want to eat ten pieces, but ten, fifteen, twenty. + +00:11:19.680 --> 00:11:25.479 +Rotating the labels to make them fit a little bit better, + +00:11:25.480 --> 00:11:28.039 +that's this part here where the labels are sideways, + +00:11:28.040 --> 00:11:30.639 +and even with just one month of data, + +00:11:30.640 --> 00:11:35.159 +they're getting a little crowded. + +00:11:35.160 --> 00:11:41.399 +This "set key box lc" just makes the line around the key, + +00:11:41.400 --> 00:11:44.039 +the legend here, a little bit less severe. + +00:11:44.040 --> 00:11:51.079 +set xtics format: this makes it so that, for example, + +00:11:51.080 --> 00:11:53.479 +I've done a United-States-style date here + +00:11:53.480 --> 00:11:55.279 +with the month and then the day. + +00:11:55.280 --> 00:11:58.839 +You don't necessarily have to do that. + +00:11:58.840 --> 00:12:01.959 +You can have whatever you want. + +00:12:01.960 --> 00:12:03.079 +This xtics format, + +00:12:03.080 --> 00:12:06.319 +that relates to how the dates are printed. + +00:12:06.320 --> 00:12:12.519 +Remember that over here, this set timefmt, + +00:12:12.520 --> 00:12:15.159 +that relates to how the dates are formatted + +00:12:15.160 --> 00:12:16.999 +in the Org mode output. + +00:12:17.000 --> 00:12:18.319 +So remember, those are two... + +00:12:18.320 --> 00:12:19.519 +You don't want to mix those up. + +00:12:19.520 --> 00:12:23.799 +All right, "yrange [0:40]". + +00:12:23.800 --> 00:12:28.719 +Thus far, my exercise sessions have all been + +00:12:28.720 --> 00:12:31.479 +less than 30 minutes, and nothing's gone over 30. + +00:12:31.480 --> 00:12:35.839 +If you have a health variable + +00:12:35.840 --> 00:12:38.119 +that is in a significantly different range, + +00:12:38.120 --> 00:12:41.639 +you may need to get a slightly more complicated + +00:12:41.640 --> 00:12:43.719 +Gnuplot script because it is possible to plot + +00:12:43.720 --> 00:12:46.479 +multiple yranges in one plot + +00:12:46.480 --> 00:12:48.719 +if you have a variable that uses a different range. + +00:12:48.720 --> 00:12:49.759 +It's just a little trickier. + +00:12:49.760 --> 00:12:55.919 +These parts here, aside from the fact + +00:12:55.920 --> 00:12:59.079 +that you might make some changes that relate to + +00:12:59.080 --> 00:13:01.319 +the date and your country format, + +00:13:01.320 --> 00:13:03.239 +are going to be the same. + +00:13:03.240 --> 00:13:05.919 +This is like boilerplate for almost anything. + +NOTE Health variables + +00:13:05.920 --> 00:13:09.799 +Now here are the parts that are going to vary + +00:13:09.800 --> 00:13:13.399 +depending on what health variables you want to store. + +00:13:13.400 --> 00:13:18.039 +There are three main sections here. + +00:13:18.040 --> 00:13:28.719 +One is setting the different line types that are used. + +00:13:28.720 --> 00:13:32.479 +Setting linetype 1 with line width 2, line color RGB. + +00:13:32.480 --> 00:13:34.959 +Unfortunately, Gnuplot is a little bit cryptic, + +00:13:34.960 --> 00:13:36.879 +which is why I've made this template generator + +00:13:36.880 --> 00:13:37.999 +that I'll show you in a moment. + +00:13:38.000 --> 00:13:43.039 +I pick a color. So this is exercise, forest green. + +00:13:43.040 --> 00:13:49.279 +Point size 1, meaning you get + +00:13:49.280 --> 00:13:51.599 +these little green triangles about that size. + +00:13:51.600 --> 00:13:54.719 +But the point type 9 is the pointing up triangle. + +00:13:54.720 --> 00:13:59.519 +Line type 2, purple. So that's the sleep line. + +00:13:59.520 --> 00:14:02.999 +So we're just establishing these different line types + +00:14:03.000 --> 00:14:04.719 +that we've given arbitrary numbers. + +00:14:04.720 --> 00:14:08.959 +Now onto the next section. + +00:14:08.960 --> 00:14:12.919 +Oh, before I move on here, + +00:14:12.920 --> 00:14:16.119 +you can see point type 11 for line 5, which is red. + +00:14:16.120 --> 00:14:18.079 +And that's the missed medications line, + +00:14:18.080 --> 00:14:20.639 +so you get a triangle that's upside down + +00:14:20.640 --> 00:14:22.679 +because that's point shape 11. + +NOTE Goal lines + +00:14:22.680 --> 00:14:27.879 +All right. The next section here is the goal lines. + +00:14:27.880 --> 00:14:33.440 +There are horizontal dashed lines here + +00:14:33.441 --> 00:14:37.359 +at 8 purple hours of sleep, because 8 hours is the goal. + +00:14:37.360 --> 00:14:41.519 +So there's a horizontal line at Y = 8. + +00:14:41.520 --> 00:14:43.879 +For pieces of nicotine gum, + +00:14:43.880 --> 00:14:46.959 +I'm trying to keep it to around 5 right now. + +00:14:46.960 --> 00:14:52.519 +So my goal line is at 5. So these... + +00:14:52.520 --> 00:14:56.759 +Here, a goal of at least 20 minutes of exercise. + +00:14:56.760 --> 00:14:59.079 +Sometimes I get more, sometimes I get less. + +00:14:59.080 --> 00:15:02.199 +There's a green line and a 20, showing that that's the goal. + +00:15:02.200 --> 00:15:06.479 +These lines here are actually the goal lines. + +00:15:06.480 --> 00:15:09.119 +You can specify the goal for each one + +00:15:09.120 --> 00:15:11.999 +in the template generator that I'll show you. + +NOTE The Gnuplot command + +00:15:12.000 --> 00:15:28.079 +The last part is the actual plot command. + +00:15:28.080 --> 00:15:30.199 +So the dependent... So okay, + +00:15:30.200 --> 00:15:34.919 +these all start with 1, "using 1" against this variable. + +00:15:34.920 --> 00:15:41.599 +So $2... This is a ternary operator here + +00:15:41.600 --> 00:15:49.199 +that says if the value of the second column is zero, + +00:15:49.200 --> 00:15:52.359 +then don't plot a point. In other words, + +00:15:52.360 --> 00:15:56.079 +not a number means it won't plot a point. + +00:15:56.080 --> 00:15:58.919 +The template generator lets you skip over + +00:15:58.920 --> 00:16:02.119 +the details of that. It sticks this in there. + +00:16:02.120 --> 00:16:02.759 +I'll show you. + +00:16:02.760 --> 00:16:09.399 +So we only want to plot a point when the value is non-zero. + +00:16:09.400 --> 00:16:12.479 +If there was no exercise, we're not plotting a point. + +00:16:12.480 --> 00:16:15.759 +The with construct means we'll plot data + +00:16:15.760 --> 00:16:21.340 +using date against exercise with points, + +00:16:21.341 --> 00:16:25.519 +the title is "exercise (minutes)", line type 1. + +00:16:25.520 --> 00:16:29.839 +Remember, we established line type 1 up here + +00:16:29.840 --> 00:16:35.079 +as being forest green, point style 1, + +00:16:35.080 --> 00:16:37.599 +point type 9, green triangles. + +00:16:37.600 --> 00:16:42.399 +Now I'm going to show 1 against column 3, + +00:16:42.400 --> 00:16:43.919 +which is "hours of sleep". + +00:16:43.920 --> 00:16:46.039 +This one is plotted with lines, + +00:16:46.040 --> 00:16:48.599 +so we don't specify a point type or point size, + +00:16:48.600 --> 00:16:51.719 +just a line type 2. And remember, you can see + +00:16:51.720 --> 00:16:55.240 +that line type 2 is defined as purple + +00:16:55.241 --> 00:16:57.359 +with point type 1, point size 1. + +00:16:57.360 --> 00:16:59.959 +Okay, so I did specify point size and point type, + +00:16:59.960 --> 00:17:01.479 +but because I'm not plotting with points, + +00:17:01.480 --> 00:17:02.279 +those are ignored. + +00:17:02.280 --> 00:17:08.799 +Here we come to the line with nicotine. + +00:17:08.800 --> 00:17:11.559 +The fourth column is the nicotine number, + +00:17:11.560 --> 00:17:13.199 +the fourth column from the Org mode file. + +00:17:13.200 --> 00:17:16.007 +So here you can see how we're telling Gnuplot + +00:17:16.008 --> 00:17:19.799 +to take each column of the tab-separated Org mode file + +00:17:19.800 --> 00:17:21.119 +and put it into the graph. + +00:17:21.120 --> 00:17:25.959 +The line types are set up here. + +00:17:25.960 --> 00:17:30.799 +The goal lines are set up here. + +00:17:30.800 --> 00:17:35.559 +And then the actual plot command is set up here. + +NOTE The template generator + +00:17:35.560 --> 00:17:41.319 +So now we're going to work further backwards + +00:17:41.320 --> 00:17:42.959 +from this Gnuplot template + +00:17:42.960 --> 00:17:46.559 +to the template generator that I used to make it. + +00:17:46.560 --> 00:18:01.959 +Now I'm not going to go into + +00:18:01.960 --> 00:18:03.759 +all of the details of the code, + +00:18:03.760 --> 00:18:06.159 +but what I am going to show you is that + +00:18:06.160 --> 00:18:10.679 +there's a variable called `health-factors'. + +00:18:10.680 --> 00:18:15.839 +And what this does, this `health-factors-from-list' + +00:18:15.840 --> 00:18:20.919 +lets you specify, with a property list + +00:18:20.920 --> 00:18:22.679 +of keyword and value pairs + +00:18:22.680 --> 00:18:24.799 +(here's the keyword name and the value is exercise), + +00:18:24.800 --> 00:18:28.199 +the goal that I want 20 minutes of exercise, + +00:18:28.200 --> 00:18:30.199 +that the unit is minutes, + +00:18:30.200 --> 00:18:36.159 +that the color is forest green, and so on. + +00:18:36.160 --> 00:18:39.439 +The aspects of the Gnuplot setup + +00:18:39.440 --> 00:18:43.559 +have been abstracted here. + +00:18:43.560 --> 00:18:49.279 +Eight hours of sleep is the goal here. + +00:18:49.280 --> 00:18:54.039 +The hours are units. What color, + +00:18:54.040 --> 00:18:55.119 +what thickness of the line. + +00:18:55.120 --> 00:19:00.079 +Here we specify the number of points. + +00:19:00.080 --> 00:19:01.279 +There's references online + +00:19:01.280 --> 00:19:05.199 +that show you what point types are what shapes in Gnuplot, + +00:19:05.200 --> 00:19:11.479 +and so on and so forth. + +NOTE The code that creates a template + +00:19:11.480 --> 00:19:17.399 +I'll walk through the code a little bit that does this, + +00:19:17.400 --> 00:19:20.439 +that actually takes these pieces, + +00:19:20.440 --> 00:19:24.399 +that takes this specification of what your variables are + +00:19:24.400 --> 00:19:30.439 +and turns it into a template. + +00:19:30.440 --> 00:19:37.959 +First, I'm using EIEIO, + +00:19:37.960 --> 00:19:41.719 +the object system that's included with GNU Emacs. + +00:19:41.720 --> 00:19:45.119 +It's a reasonable facsimile + +00:19:45.120 --> 00:19:47.319 +of the Common Lisp Object System. + +00:19:47.320 --> 00:19:51.239 +What I'm going to be doing here + +00:19:51.240 --> 00:19:56.199 +is defining a class with each of those items, + +00:19:56.200 --> 00:19:58.479 +those properties that we talked about in that list + +00:19:58.480 --> 00:20:01.319 +that lets you specify name, what the goal is, + +00:20:01.320 --> 00:20:04.239 +what the units are, and the Gnuplot things + +00:20:04.240 --> 00:20:06.559 +(the Gnuplot parameters like thickness, + +00:20:06.560 --> 00:20:13.239 +plot type, and all that) into a class that will then + +00:20:13.240 --> 00:20:16.519 +spit out the template once you feed it + +00:20:16.520 --> 00:20:27.759 +some of these health factor objects. So just a moment. + +00:20:27.760 --> 00:20:34.479 +For example, you can see that this template + +00:20:34.480 --> 00:20:46.319 +originally came from being generated by this code here. + +00:20:46.320 --> 00:20:52.959 +To use the template, + +00:20:52.960 --> 00:20:55.399 +to use this little template generator... + +00:20:55.400 --> 00:21:06.279 +See, here's where it spits out the line type + +00:21:06.280 --> 00:21:07.439 +given the pieces. + +00:21:07.440 --> 00:21:09.679 +This is all just text formatting. + +00:21:09.680 --> 00:21:11.319 +This is one of the things that Emacs Lisp + +00:21:11.320 --> 00:21:13.159 +just really excels at. + +00:21:13.160 --> 00:21:19.519 +I need to take a piece of data + +00:21:19.520 --> 00:21:22.639 +like a list of health information, + +00:21:22.640 --> 00:21:25.679 +a list of health variables, what their units are, + +00:21:25.680 --> 00:21:28.119 +and how they're supposed to be formatted in Gnuplot, + +00:21:28.120 --> 00:21:30.199 +and go from that to the nice template. + +00:21:30.200 --> 00:21:31.719 +So that's pretty much the whole thing. + +00:21:31.720 --> 00:21:40.999 +I want to see if there's anything I missed. + +NOTE The power of the chart + +00:21:41.000 --> 00:21:51.519 +Bring up the chart. + +00:21:51.520 --> 00:21:54.279 +This has been really useful + +00:21:54.280 --> 00:21:59.599 +for communicating with healthcare professionals + +00:21:59.600 --> 00:22:04.399 +because you are both on the same page + +00:22:04.400 --> 00:22:05.879 +about exactly what is happening, + +00:22:05.880 --> 00:22:10.679 +what's been happening because if... Let's say + +00:22:10.680 --> 00:22:15.239 +that you're tired when you talk to your care provider. + +00:22:15.240 --> 00:22:17.559 +Well, if you have objective information + +00:22:17.560 --> 00:22:18.839 +that you've been recording every day, + +00:22:18.840 --> 00:22:22.399 +that you're ahead of the game, really, + +00:22:22.400 --> 00:22:25.119 +because you don't need, necessarily, the presence of mind + +00:22:25.120 --> 00:22:27.679 +to be able to give your care provider + +00:22:27.680 --> 00:22:30.039 +a complete picture of what's going on in your world. + +00:22:30.040 --> 00:22:33.039 +If you can find those few minutes a day to enter-- + +00:22:33.040 --> 00:22:34.399 +not even a few minutes, + +00:22:34.400 --> 00:22:37.759 +really just a minute to enter the data + +00:22:37.760 --> 00:22:39.839 +and say what happened yesterday... + +00:22:39.840 --> 00:22:42.759 +I'm finding over these months + +00:22:42.760 --> 00:22:45.039 +that I've been more in touch with my health when I can-- + +00:22:45.040 --> 00:22:49.919 +not forced, but when I have the habit, + +00:22:49.920 --> 00:22:52.159 +the consistent habit every single day + +00:22:52.160 --> 00:22:55.839 +of recording that data--I'm accountable to myself. + +00:22:55.840 --> 00:22:57.359 +It's interesting. + +00:22:57.360 --> 00:23:01.039 +I guess it gets into a little bit of ideas + +00:23:01.040 --> 00:23:02.439 +about the Quantified Self + +00:23:02.440 --> 00:23:05.239 +and how holding yourself accountable + +00:23:05.240 --> 00:23:09.919 +can change what you do and what the outcomes are. + +00:23:09.920 --> 00:23:14.159 +Just look at this here. + +00:23:14.160 --> 00:23:17.279 +Without getting into too much detail, + +00:23:17.280 --> 00:23:19.679 +one of the reasons I track my sleep is because, + +00:23:19.680 --> 00:23:22.039 +as you can see, my sleep + +00:23:22.040 --> 00:23:26.759 +is not as well-regulated as most people, + +00:23:26.760 --> 00:23:31.439 +and that's why I need to do that. + +00:23:31.440 --> 00:23:34.440 +This was a time... 10, 12, + +00:23:34.441 --> 00:23:36.639 +here's 14 hours of sleep, that's depression. + +00:23:36.640 --> 00:23:43.519 +It oscillates a little bit. But then below the goal line, + +00:23:43.520 --> 00:23:45.639 +the things are a little more normal here. + +00:23:45.640 --> 00:23:46.919 +This is a little more normal. + +00:23:46.920 --> 00:23:52.079 +But then, really, without thinking about it too much, + +00:23:52.080 --> 00:23:56.239 +I cut out the nicotine, and my sleep suffered. + +00:23:56.240 --> 00:24:00.199 +Just the fact that I'm able to look and see that connection + +00:24:00.200 --> 00:24:01.359 +is really amazing to me. + +00:24:01.360 --> 00:24:02.759 +Maybe I would have anyway, + +00:24:02.760 --> 00:24:05.239 +but looking at the whole months of data, + +00:24:05.240 --> 00:24:07.399 +there have been many things to discuss + +00:24:07.400 --> 00:24:09.919 +and many things to think about. + +NOTE Thanks + +00:24:09.920 --> 00:24:12.159 +Because this is a short presentation, + +00:24:12.160 --> 00:24:13.839 +I probably should wrap up. + +00:24:13.840 --> 00:24:18.239 +I just want to thank the whole Emacs community + +00:24:18.240 --> 00:24:23.319 +for being there and for including me in the conference + +00:24:23.320 --> 00:24:27.079 +and I hope to participate next year as well. + +00:24:27.080 --> 00:24:29.240 +Thank you so much. diff --git a/2022/captions/emacsconf-2022-journalism--emacs-journalism-or-everythings-a-nail-if-you-hit-it-with-emacs--alfred-zanini--main.vtt b/2022/captions/emacsconf-2022-journalism--emacs-journalism-or-everythings-a-nail-if-you-hit-it-with-emacs--alfred-zanini--main.vtt new file mode 100644 index 00000000..54cf0992 --- /dev/null +++ b/2022/captions/emacsconf-2022-journalism--emacs-journalism-or-everythings-a-nail-if-you-hit-it-with-emacs--alfred-zanini--main.vtt @@ -0,0 +1,818 @@ +WEBVTT captioned by alfred + +NOTE Introduction + +00:00:00.000 --> 00:00:06.959 +All right. Hello, everyone. Welcome to my talk. + +00:00:06.960 --> 00:00:10.119 +We'll be talking today about Emacs journalism + +00:00:10.120 --> 00:00:12.279 +and what that means. + +00:00:12.280 --> 00:00:14.999 +First of all, I'd like to thank the EmacsConf organizers. + +00:00:15.000 --> 00:00:20.039 +Thank you very much, Sacha, for being very patient with me. + +00:00:20.040 --> 00:00:22.679 +Let's get right into it. So who's this talk for? + +00:00:22.680 --> 00:00:24.799 +First of all, it's for anyone + +00:00:24.800 --> 00:00:26.359 +who wants to learn about workflows + +00:00:26.360 --> 00:00:28.519 +and how you can work with Emacs + +00:00:28.520 --> 00:00:31.279 +to basically do anything you want. + +00:00:31.280 --> 00:00:33.679 +And it's for all levels of Emacs lovers. + +00:00:33.680 --> 00:00:36.119 +So I'll keep it accessible. + +NOTE Why this talk + +00:00:36.120 --> 00:00:37.479 +Why this talk? So first of all, + +00:00:37.480 --> 00:00:40.519 +I want to share a lot of Emacs. + +00:00:40.520 --> 00:00:42.519 +I also wanted to learn about workflows myself. + +00:00:42.520 --> 00:00:46.319 +So what better way than to talk about them + +00:00:46.320 --> 00:00:49.519 +to be able to learn? And we could maybe learn a thing + +00:00:49.520 --> 00:00:56.799 +or two about collaboration and using Emacs to that motive. + +00:00:56.800 --> 00:01:00.479 +I think it's useful to try and figure out who am I? + +00:01:00.480 --> 00:01:03.159 +Why am I having this talk? I'm a journalist based + +00:01:03.160 --> 00:01:06.799 +in Hong Kong and a documentary filmmaker. So that means + +00:01:06.800 --> 00:01:08.959 +that I have interviews quite often. + +00:01:08.960 --> 00:01:11.519 +I'm dealing with texts and subtitles, + +00:01:11.520 --> 00:01:14.039 +which I have to transcribe. + +00:01:14.040 --> 00:01:16.879 +And I'm also dealing with a lot of research. + +00:01:16.880 --> 00:01:22.159 +So that means going through a lot of documents and a lot of, + +00:01:22.160 --> 00:01:26.759 +well, skimming through documents + +00:01:26.760 --> 00:01:30.279 +to be able to have something to write. + +00:01:30.280 --> 00:01:34.119 +And I also use Emacs since basically one year ago, + +00:01:34.120 --> 00:01:35.399 +I started using it full time + +00:01:35.400 --> 00:01:39.639 +to have a great detriment of my productivity. + +00:01:39.640 --> 00:01:45.599 +So we'll be talking about, we'll be talking about, well, + +00:01:45.600 --> 00:01:48.439 +basically, my workflow for Emacs + +00:01:48.440 --> 00:01:52.159 +and how I went about having an Emacs workflow. + +NOTE Thinking about workflows + +00:01:52.160 --> 00:01:56.799 +So what is best when you're thinking about your own workflow + +00:01:56.800 --> 00:01:59.199 +and some things to think about journalism + +00:01:59.200 --> 00:02:03.199 +and about using these kinds of tools + +00:02:03.200 --> 00:02:09.479 +in combination for this? So where do we all start? + +00:02:09.480 --> 00:02:11.559 +Let's start with a simple-ish definition + +00:02:11.560 --> 00:02:14.959 +of what is a workflow. A workflow is + +00:02:14.960 --> 00:02:18.359 +any sequence of actions or tools you use to accomplish that. + +00:02:18.360 --> 00:02:23.199 +So it doesn't have to be through text processing, + +00:02:23.200 --> 00:02:27.759 +though obviously being a text-oriented community, + +00:02:27.760 --> 00:02:31.439 +it will most likely be partially text. + +00:02:31.440 --> 00:02:34.999 +But it's just about how we accomplish a task + +00:02:35.000 --> 00:02:39.119 +and which tools and mindsets we go into it with. + +NOTE My old workflow + +00:02:39.120 --> 00:02:42.759 +For example, let's talk about my old workflow. + +00:02:42.760 --> 00:02:46.879 +That workflow was basically just Google Drive + +00:02:46.880 --> 00:02:50.759 +using proprietary tools like Notion, Google Drive, Office, + +00:02:50.760 --> 00:02:55.839 +Storyboarder, and for communication, WeChat. + +00:02:55.840 --> 00:02:59.559 +If I could forgive all the privacy concerns of WeChat, + +00:02:59.560 --> 00:03:03.279 +I wouldn't, but I still wouldn't forgive + +00:03:03.280 --> 00:03:06.759 +the terribly buggy interface, and I hate it. + +00:03:06.760 --> 00:03:09.119 +So there are certain tools that you have to use + +00:03:09.120 --> 00:03:11.359 +and you have to modify your workflow + +00:03:11.360 --> 00:03:13.839 +or just adapt your workflow to the tools + +00:03:13.840 --> 00:03:17.119 +that you have to use. So for me, unfortunately, + +00:03:17.120 --> 00:03:23.399 +that means having to use WeChat. You compartmentalize it + +00:03:23.400 --> 00:03:27.479 +and set it aside, try not to think about it too hard. + +00:03:27.480 --> 00:03:29.319 +And this is the part that hurts the most, right? + +00:03:29.320 --> 00:03:31.039 +You're thinking about your workflow, + +00:03:31.040 --> 00:03:32.239 +you're thinking about, all right, + +00:03:32.240 --> 00:03:37.199 +I have this thing that works, I don't think about it. + +00:03:37.200 --> 00:03:40.039 +And all of a sudden, oh, I'm not happy + +00:03:40.040 --> 00:03:44.239 +with what I have right now. So let's get into, + +00:03:44.240 --> 00:03:50.079 +let's get into how, oops. So let's get into how and why + +00:03:50.080 --> 00:03:51.479 +we're not happy with our workflows. + +00:03:51.480 --> 00:03:55.679 +Because obviously, it's quite nice + +00:03:55.680 --> 00:03:57.159 +to not have to think about things. + +00:03:57.160 --> 00:03:58.719 +But once you've thought about it, + +00:03:58.720 --> 00:04:01.399 +and once you're not happy with how it works, + +00:04:01.400 --> 00:04:03.559 +I think it's quite useful to think about + +00:04:03.560 --> 00:04:05.279 +why we're not happy about it. + +NOTE Finding my workflow + +00:04:05.280 --> 00:04:10.199 +A huge part of what Emacs is being conscious of, well, + +00:04:10.200 --> 00:04:11.679 +how do we find our workflows? + +00:04:11.680 --> 00:04:17.839 +How do we find what we want to do? And for me, obviously, + +00:04:17.840 --> 00:04:19.839 +the best way to find that is to write it down + +00:04:19.840 --> 00:04:24.239 +and to try and tailor my tools to it. + +00:04:24.240 --> 00:04:26.239 +This is what I came up with. + +00:04:26.240 --> 00:04:28.039 +I want to be able to manage my accounting, + +00:04:28.040 --> 00:04:30.719 +to manage collaboration. So: working on files + +00:04:30.720 --> 00:04:33.439 +alongside my colleagues, communication, + +00:04:33.440 --> 00:04:38.839 +so that's planning out and managing meetings, + +00:04:38.840 --> 00:04:43.999 +managing teammates, managing tasks, information gathering. + +00:04:44.000 --> 00:04:45.959 +So that's what I was saying, going through documents, + +00:04:45.960 --> 00:04:49.999 +going through all these lists of tasks and all of these, + +00:04:50.000 --> 00:04:54.079 +not lists of tasks, all of these, well, basically, + +00:04:54.080 --> 00:04:59.799 +scientific papers, notes, references and wikis, media. + +00:04:59.800 --> 00:05:02.319 +So I want to be able to have a music player, + +00:05:02.320 --> 00:05:06.159 +a podcast player, a movie player. That's outside of work, + +00:05:06.160 --> 00:05:09.999 +but it's still one of the tasks that I do. Media processing, + +00:05:10.000 --> 00:05:13.559 +so this is where my job kind of gets into it a bit more. + +00:05:13.560 --> 00:05:15.159 +So I want to be able to take notes + +00:05:15.160 --> 00:05:16.479 +on the media that I watch, + +00:05:16.480 --> 00:05:19.559 +to transcribe the interviews + +00:05:19.560 --> 00:05:21.559 +and even the conversations that I have, + +00:05:21.560 --> 00:05:26.439 +to be able to later on have an easier time. + +00:05:26.440 --> 00:05:32.119 +Photo editing, video editing, so unfortunately, + +00:05:32.120 --> 00:05:35.959 +Emacs isn't quite quite oriented to that. + +00:05:35.960 --> 00:05:40.519 +Graphic design, color grading, storyboarding. + +00:05:40.520 --> 00:05:43.479 +And so obviously, you go into it a bit more. + +00:05:43.480 --> 00:05:46.519 +So managing to do scheduling tasks, interviews, + +00:05:46.520 --> 00:05:49.159 +preparing shot lists, tracking time, + +00:05:49.160 --> 00:05:53.319 +setting daily work goals, setting priorities, + +00:05:53.320 --> 00:05:55.479 +independent tasks, publishing, + +00:05:55.480 --> 00:05:59.079 +so publishing stuff for my work on my work CMS, + +00:05:59.080 --> 00:06:01.519 +publishing stuff on my personal CMS, + +00:06:01.520 --> 00:06:06.079 +although that's not happened yet. I've been kind of busy. + +00:06:06.080 --> 00:06:08.639 +Security and privacy, so making sure + +00:06:08.640 --> 00:06:13.279 +that everything that I use respects my data and respects me. + +00:06:13.280 --> 00:06:18.399 +Unfortunately, not the case, but you take what you can. + +00:06:18.400 --> 00:06:20.599 +Text processing. So that's journaling, + +00:06:20.600 --> 00:06:26.039 +writing down articles, my personal wiki, my work wiki, + +00:06:26.040 --> 00:06:34.679 +which I use to document, well, for example, + +00:06:34.680 --> 00:06:37.159 +several projects that I have currently. + +00:06:37.160 --> 00:06:43.319 +So I basically have my work wiki that I'm trying + +00:06:43.320 --> 00:06:45.159 +to fill out where I'll be able + +00:06:45.160 --> 00:06:47.199 +to basically go into it later on + +00:06:47.200 --> 00:06:50.399 +and have my thoughts written down. + +00:06:50.400 --> 00:06:56.799 +And programming, which I'm not very good at. + +NOTE Literate configuration + +00:06:56.800 --> 00:06:59.399 +Some people might have noticed + +00:06:59.400 --> 00:07:17.159 +that this looks a lot like [literate] programming. + +00:07:17.160 --> 00:07:18.639 +If you go into my config file, + +00:07:18.640 --> 00:07:20.159 +I have something kind of similar. + +00:07:20.160 --> 00:07:22.439 +I was planning on having a bit more time + +00:07:22.440 --> 00:07:26.359 +for this presentation and making it stick to that. + +00:07:26.360 --> 00:07:30.999 +But you'll see basically the mess that is my Emacs config. + +00:07:31.000 --> 00:07:33.319 +But it kind of sticks to the same thoughts, right? + +00:07:33.320 --> 00:07:37.399 +Text processing, web browsing, finances, + +00:07:37.400 --> 00:07:39.879 +that's my accounting, media and research. + +00:07:39.880 --> 00:07:43.879 +So my BibTeX... Here be dragons. + +00:07:43.880 --> 00:07:45.119 +Terrible, terrible config + +00:07:45.120 --> 00:07:47.719 +that I've stolen from plenty of people. + +00:07:47.720 --> 00:07:52.479 +So basically, that's how Emacs fits into this. + +00:07:52.480 --> 00:07:57.399 +So this is where I talk about literate configs + +00:07:57.400 --> 00:08:01.919 +and how that's helped me. Obviously, I've extolled + +00:08:01.920 --> 00:08:04.199 +the virtue of literate configs + +00:08:04.200 --> 00:08:09.359 +to quite an extent right here. It's basically... + +00:08:09.360 --> 00:08:15.239 +The concept is to have documents, living documents + +00:08:15.240 --> 00:08:18.239 +and documentation as code. + +00:08:18.240 --> 00:08:22.239 +So basically, let's go back into my config. + +00:08:22.240 --> 00:08:31.279 +I talk about what the config file does, have code blocks. + +00:08:31.280 --> 00:08:33.599 +So this is something that Emacs does. I'm pretty sure + +00:08:33.600 --> 00:08:36.639 +that there are some resources about that accessible online, + +00:08:36.640 --> 00:08:46.439 +which are even accessible in the Emacs Gulf. And so, yeah, + +00:08:46.440 --> 00:08:50.199 +basically just having everything accessible + +00:08:50.200 --> 00:08:52.479 +in one single source, one single file, + +00:08:52.480 --> 00:08:54.879 +which allows you to basically put everything down + +00:08:54.880 --> 00:09:00.639 +and integrate things from your config much much more easily. + +00:09:00.640 --> 00:09:05.239 +That's something that I found very useful in Emacs + +00:09:05.240 --> 00:09:07.599 +and which I think everyone can benefit from + +00:09:07.600 --> 00:09:11.279 +or the idea of it, like having everything stored centrally. + +00:09:11.280 --> 00:09:14.999 +It doesn't have to be used just for Emacs. + +00:09:15.000 --> 00:09:21.999 +It can be used also, it can be used also for, for example, + +00:09:22.000 --> 00:09:26.679 +a Qt browser or for other window manager configs. + +00:09:26.680 --> 00:09:28.239 +That kind of thing. + +00:09:28.240 --> 00:09:32.919 +And it's not been very easy to set a place. + +00:09:32.920 --> 00:09:37.639 +So I haven't done that just yet, but that's the plan. + +NOTE Org Mode + +00:09:37.640 --> 00:09:41.479 +Basically, this is all thanks to Org mode. + +00:09:41.480 --> 00:09:45.639 +So, small presentation of what Org mode is. Org mode + +00:09:45.640 --> 00:09:49.599 +is basically a project / task management, + +00:09:49.600 --> 00:09:52.479 +past management and task management, + +00:09:52.480 --> 00:09:54.319 +and writing mode for Emacs. + +00:09:54.320 --> 00:10:00.039 +So I can just put in a heading to do Hello World, + +00:10:00.040 --> 00:10:10.319 +send a message to Rosie tomorrow about the shoot space MDS-- + +00:10:10.320 --> 00:10:15.399 +that's thanks to wonderful Doom Emacs--and schedule it. + +00:10:15.400 --> 00:10:21.799 +I don't know. It's tomorrow. Let's go and set it to 9am. + +00:10:21.800 --> 00:10:28.759 +And say, maybe it's it's tomorrow already. I've done it. + +00:10:28.760 --> 00:10:31.439 +I've sent a message. Perfect. It's done. + +00:10:31.440 --> 00:10:33.679 +And it also allows you to have an agenda view. + +00:10:33.680 --> 00:10:37.719 +So I hope there's nothing too compromising right here. + +00:10:37.720 --> 00:10:41.879 +Whatever. It's fine. So it allows you + +00:10:41.880 --> 00:10:45.199 +to basically manage your agenda from there. + +00:10:45.200 --> 00:10:54.439 +And you might have seen me doing my little space nrf + +00:10:54.440 --> 00:10:58.359 +and wonderful key binding by Org Roam. So this + +00:10:58.360 --> 00:11:01.039 +is also another thing which is quite quite nice + +00:11:01.040 --> 00:11:06.079 +with Emacs is that you can you can have Org Roam, which + +00:11:06.080 --> 00:11:09.079 +is basically a database management program. + +00:11:09.080 --> 00:11:12.959 +So I can have documentary ideas + +00:11:12.960 --> 00:11:21.799 +and have basically my ideas which link up to another file. + +00:11:21.800 --> 00:11:25.839 +So for example, this one, which I have nothing for, + +00:11:25.840 --> 00:11:29.239 +but you get the idea. So it allows you to apps + +00:11:29.240 --> 00:11:33.719 +to link up with different files and to manage your thoughts. + +00:11:33.720 --> 00:11:37.959 +And this gets back into the workflow part of my talk, + +00:11:37.960 --> 00:11:41.879 +which is, well, this, this is a way + +00:11:41.880 --> 00:11:44.319 +to control what your workflow + +00:11:44.320 --> 00:11:49.759 +is control what the tools you're using are and to control, + +00:11:49.760 --> 00:11:52.079 +basically the way in which you interact + +00:11:52.080 --> 00:11:52.959 +with your technology. + +NOTE Collaborating with Pandoc + +00:11:52.960 --> 00:11:59.799 +So I am getting back into the way that I collaborate. + +00:11:59.800 --> 00:12:02.799 +Because obviously it's no good having just + +00:12:02.800 --> 00:12:07.919 +one Emacs user who's trying to share to share things + +00:12:07.920 --> 00:12:11.159 +with his editor. So I use pandoc. + +00:12:11.160 --> 00:12:17.479 +For example, let's go back into my file right here. + +00:12:17.480 --> 00:12:24.359 +Obviously, I don't spend much time inside of tables. + +00:12:24.360 --> 00:12:29.199 +But if I select this one, that's "SPC m e". + +00:12:29.200 --> 00:12:32.079 +Thank you, Doom Emacs for the for the keybindings. + +00:12:32.080 --> 00:12:38.239 +And I can just export it via pandoc right here, So "p". + +00:12:38.240 --> 00:12:50.719 +And I can just export it to doc, docx, or export it to ODT. + +00:12:50.720 --> 00:12:55.119 +So as an ODT file, which is typically what I do. + +00:12:55.120 --> 00:12:57.119 +And then I just send it through WeChat, + +00:12:57.120 --> 00:13:00.359 +which is not optimal, but I'm not allowed + +00:13:00.360 --> 00:13:04.079 +to do anything else. So it is what it is. + +00:13:04.080 --> 00:13:12.759 +Basically, this is how I export my files. And I re-import, + +00:13:12.760 --> 00:13:15.519 +I re-import them with pandoc as well. + +00:13:15.520 --> 00:13:19.799 +So I convert my Pages files, which I receive + +00:13:19.800 --> 00:13:22.879 +through an ICS plugin. It's not quite finalized, + +00:13:22.880 --> 00:13:24.119 +so I'm not ready to show it, + +00:13:24.120 --> 00:13:26.359 +but there's a link that I'll be putting + +00:13:26.360 --> 00:13:29.479 +in the description which talks about this. + +00:13:29.480 --> 00:13:32.959 +So this is my sharing part. + +00:13:32.960 --> 00:13:35.439 +It's nothing very special, honestly. + +00:13:35.440 --> 00:13:38.319 +It's just making sure that your documents + +00:13:38.320 --> 00:13:41.479 +are able to be shared. + +NOTE My own +00:13:41.480 --> 00:13:44.079 +I have certain things. So for example, + +00:13:44.080 --> 00:13:47.839 +if I go into retro gaming in Hong Kong, + +00:13:47.840 --> 00:13:53.919 +if I go into my scripts, there are certain headings + +00:13:53.920 --> 00:13:55.519 +which I have. So for example, they ignore... + +00:13:55.520 --> 00:13:58.759 +My editor doesn't like to have some headings. + +00:13:58.760 --> 00:14:02.599 +But when I have a video script that I'm preparing, + +00:14:02.600 --> 00:14:05.519 +I like to have them for my own organization + +00:14:05.520 --> 00:14:09.399 +and for my thinking. So I keep them in right there + +00:14:09.400 --> 00:14:11.760 +and put in ignore. This is the advantage + +00:14:11.761 --> 00:14:17.280 +of the Emacs because you can just SPC m e o o, + +00:14:17.281 --> 00:14:20.479 +and this is ready to send, basically. + +00:14:20.480 --> 00:14:24.039 +There are ways to have export presets, + +00:14:24.040 --> 00:14:26.959 +but I'm not quite there yet. It's a lot of work. + +NOTE You don't have to get lost in the weeds + +00:14:26.960 --> 00:14:30.119 +So, getting back to my presentation. + +00:14:30.120 --> 00:14:36.719 +This all goes into basically other packages, + +00:14:36.720 --> 00:14:39.319 +which I want to implement, but I haven't been able to. + +00:14:39.320 --> 00:14:43.839 +My main conclusion: you don't have to get lost in the weeds. + +00:14:43.840 --> 00:14:48.279 +I kind of did that while preparing this talk. + +00:14:48.280 --> 00:14:51.719 +So basically, you don't have to do it all at once. + +00:14:51.720 --> 00:14:55.639 +Don't let it consume your life. + +00:14:55.640 --> 00:14:57.319 +I probably should have done this earlier. + +00:14:57.320 --> 00:15:02.119 +But Emacs configs are forever work in progress. + +00:15:02.120 --> 00:15:04.919 +So there are lots of features which you can add, + +00:15:04.920 --> 00:15:08.119 +a lot of things which you can implement if you only had, + +00:15:08.120 --> 00:15:11.639 +I don't know, five weeks to be able to implement them. + +00:15:11.640 --> 00:15:12.959 +But you're working right now. + +00:15:12.960 --> 00:15:16.319 +And this is a message to me five months ago. + +00:15:16.320 --> 00:15:19.639 +Don't do it. Just keep working + +00:15:19.640 --> 00:15:23.639 +and don't get lost in configuration all day. + +00:15:23.640 --> 00:15:27.559 +So yeah, basically the aim is to use software that you love, + +00:15:27.560 --> 00:15:29.439 +but not die in the process. + +00:15:29.440 --> 00:15:34.719 +And yeah, basically just using it as much as you can + +00:15:34.720 --> 00:15:36.519 +using fast software as much as you can. + +00:15:36.520 --> 00:15:39.839 +I'm doing that as well for... + +00:15:39.840 --> 00:15:46.679 +I have certain software such as storyboarder or bit tags, + +00:15:46.680 --> 00:15:50.159 +that kind of thing, which I try to use as much as possible, + +00:15:50.160 --> 00:15:51.839 +even outside of Emacs. + +00:15:51.840 --> 00:15:56.279 +And the aim is to get the work done in the end. + +00:15:56.280 --> 00:16:00.679 +I'm not an absolutist on this. So yeah, basically, + +00:16:00.680 --> 00:16:03.919 +let's keep modding our configs and having fun. + +00:16:03.920 --> 00:16:06.479 +If you've got any questions about the talk, + +00:16:06.480 --> 00:16:10.439 +I'm happy to answer. I am a novice at this, + +00:16:10.440 --> 00:16:12.959 +both presenting in front of camera + +00:16:12.960 --> 00:16:15.719 +and at talking about Emacs. + +00:16:15.720 --> 00:16:18.679 +I'm sure I've gotten a few things wrong, + +00:16:18.680 --> 00:16:23.719 +and it's not been the smoothest talk, but it's 10pm, almost. + +00:16:23.720 --> 00:16:28.759 +I need to get back home. Yeah, take care, everyone. + +00:16:28.760 --> 00:16:32.719 +Thanks again to the organizers. Here's my contact info. + +00:16:32.720 --> 00:16:36.199 +And I'll be in touch with the questions. + +00:16:36.200 --> 00:16:38.319 +I don't think I'll be able to do the live answers, + +00:16:38.320 --> 00:16:41.879 +but that's more or less it. Thanks so much for listening, + +00:16:41.880 --> 00:16:44.400 +if you've been listening, and take care. diff --git a/2022/captions/emacsconf-2022-lspbridge--lspbridge-a-smooth-as-butter-asynchronous-lsp-client--andy-stewart-matthew-zeng--main.vtt b/2022/captions/emacsconf-2022-lspbridge--lspbridge-a-smooth-as-butter-asynchronous-lsp-client--andy-stewart-matthew-zeng--main.vtt new file mode 100644 index 00000000..622d0b40 --- /dev/null +++ b/2022/captions/emacsconf-2022-lspbridge--lspbridge-a-smooth-as-butter-asynchronous-lsp-client--andy-stewart-matthew-zeng--main.vtt @@ -0,0 +1,1002 @@ +WEBVTT captioned by matthew + +NOTE Opening + +00:00:00.000 --> 00:00:04.639 +Good morning folks, I'm Matthew. + +00:00:04.640 --> 00:00:07.399 +Welcome to another year of EmacsConf. + +00:00:07.400 --> 00:00:10.319 +It's looking fantastic this year. + +00:00:10.320 --> 00:00:13.559 +Firstly, I have to apologize for my voice + +00:00:13.560 --> 00:00:15.879 +and occasional cough today. + +00:00:15.880 --> 00:00:18.039 +I am currently recovering from a cold, + +00:00:18.040 --> 00:00:21.159 +hopefully it's not Covid or flu, + +00:00:21.160 --> 00:00:24.719 +so please bear with me today. + +00:00:24.720 --> 00:00:27.919 +Actually, this talk was supposed to be brought to you + +00:00:27.920 --> 00:00:31.559 +by Manatee Lazycat, the author of lsp-bridge. + +00:00:31.560 --> 00:00:36.079 +But verbal English isn't Lazycat's strongest skill, + +00:00:36.080 --> 00:00:38.599 +and we are good friends as we maintain + +00:00:38.600 --> 00:00:40.999 +the Emacs Application Framework together, + +00:00:41.000 --> 00:00:45.999 +so here I am today presenting to you this package. + +00:00:46.000 --> 00:00:48.479 +Welcome to my talk on lsp-bridge: + +00:00:48.480 --> 00:00:50.320 +a smooth-as-butter asynchronous LSP client. + +NOTE What is LSP? + +00:00:50.321 --> 00:00:57.200 +What is LSP? + +00:00:57.201 --> 00:01:01.159 +The first question is, what is LSP? + +00:01:01.160 --> 00:01:03.199 +For anyone who doesn't know here, + +00:01:03.200 --> 00:01:06.799 +LSP stands for Language Server Protocol, + +00:01:06.800 --> 00:01:09.719 +it is a set of protocols defined by Microsoft + +00:01:09.720 --> 00:01:13.399 +that provides smart features like autocomplete, + +00:01:13.400 --> 00:01:17.599 +go to definition, documentation, etc., + +00:01:17.600 --> 00:01:23.439 +that can be implemented across different editors and IDEs. + +00:01:23.440 --> 00:01:25.559 +It was initially created + +00:01:25.560 --> 00:01:28.399 +for their Visual Studio Code product, + +00:01:28.400 --> 00:01:33.919 +then publically shared with everyone. + +00:01:33.920 --> 00:01:35.999 +So there are language servers out there + +00:01:36.000 --> 00:01:38.119 +that implemented this procotol, + +00:01:38.120 --> 00:01:41.239 +and editors need to implement the same procotols + +00:01:41.240 --> 00:01:43.119 +to talk to the language servers + +00:01:43.120 --> 00:01:46.799 +in order to retrieve necessary information. + +00:01:46.800 --> 00:01:53.159 +Emacs has 2 LSP clients already, the lsp-mode and eglot, + +00:01:53.160 --> 00:01:57.319 +both implemented the protocols and both are very good. + +NOTE Why another LSP client? + +00:02:00.440 --> 00:02:03.199 +Now comes to the second question, of course, + +00:02:03.200 --> 00:02:09.519 +given lsp-mode and eglot, why another LSP client? + +00:02:09.520 --> 00:02:12.359 +I used to use lsp-mode all the time, + +00:02:12.360 --> 00:02:15.999 +I have to say I really appreciate Ivan Yonchovski + +00:02:16.000 --> 00:02:20.159 +and the team's efforts. Also, I'd like to congratuate eglot + +00:02:20.160 --> 00:02:27.439 +for making into Emacs 29! These are fantastic packages, + +00:02:27.440 --> 00:02:30.999 +they are very mature and robust. + +NOTE + +00:02:31.000 --> 00:02:31.000 +However, with all due respect, both of the implementation + +00:02:35.120 --> 00:02:36.719 +are fundamentally limited + +00:02:36.720 --> 00:02:39.639 +by the single-threaded nature of Emacs, + +00:02:39.640 --> 00:02:43.639 +it is neither the fault of lsp-mode nor eglot. + +NOTE + +00:02:46.000 --> 00:02:47.959 +Although in recent years there have been + +00:02:47.960 --> 00:02:51.799 +improvements to Emacs core such as native JSON support, + +00:02:51.800 --> 00:02:55.319 +there are still scenarios where Emacs clog + +00:02:55.320 --> 00:02:59.359 +for a brief second when processing large amounts of data, + +00:02:59.360 --> 00:03:03.399 +as Emacs is processing everything in the single thread. + +00:03:03.400 --> 00:03:08.439 +This problem is especially apparent in some LSP servers + +00:03:08.440 --> 00:03:11.839 +that feeds in tens of thousands of JSON data + +00:03:11.840 --> 00:03:15.199 +with every single key press. + +NOTE + +00:03:15.200 --> 00:03:17.559 +Additionally, the large amount of data + +00:03:17.560 --> 00:03:21.279 +sent by the LSP server, such as the completion candidates, + +00:03:21.280 --> 00:03:23.959 +the diagnostics and documentation, + +00:03:23.960 --> 00:03:27.359 +they are temporarily stored in the Emacs memory, + +00:03:27.360 --> 00:03:31.159 +which will trigger garbage collection very frequently, + +00:03:31.160 --> 00:03:34.159 +this also causes stuttering user experience. + +00:03:34.160 --> 00:03:37.279 +Increasing the gc-cons-threshold helps, + +00:03:37.280 --> 00:03:43.759 +but doesn't eliminate the problem. + +NOTE + +00:03:43.760 --> 00:03:45.559 +For something like the LSP, + +00:03:45.560 --> 00:03:48.319 +the language servers need time to compute, + +00:03:48.320 --> 00:03:52.359 +and Emacs needs capacity to process and filter + +00:03:52.360 --> 00:03:55.799 +all the data coming from the language servers. + +00:03:55.800 --> 00:03:59.399 +A large codebase project with a slow language server + +00:03:59.400 --> 00:04:02.439 +that sends tens of thousands of JSON + +00:04:02.440 --> 00:04:06.519 +will significantly increase the time needed to process it, + +00:04:06.520 --> 00:04:08.079 +when we don't have a multi-thread, + +00:04:08.080 --> 00:04:12.719 +the single thread originally allocated for perhaps, + +00:04:12.720 --> 00:04:17.279 +handling user input will be used to process all the data, + +00:04:17.280 --> 00:04:22.719 +and don't even talk about the garbage collection along the way. + +NOTE + +00:04:22.720 --> 00:04:26.239 +The unfortunate truth is that the size of the codebase + +00:04:26.240 --> 00:04:28.919 +and the efficiency of the language server + +00:04:28.920 --> 00:04:31.759 +is completely out of Emacs' control, + +00:04:31.760 --> 00:04:38.519 +it is also out of both the lsp-mode and eglot's control. + +NOTE + +00:04:38.520 --> 00:04:40.279 +If there's an LSP client + +00:04:40.280 --> 00:04:42.279 +that can completely eliminate stuttering + +00:04:42.280 --> 00:04:44.999 +and provide a seamless feedback, + +00:04:45.000 --> 00:04:50.279 +that would be great, isn't it? + +NOTE What is seamless input feedback? + +00:04:50.280 --> 00:04:53.839 +However, we're vaguely talking about speed right now, + +00:04:53.840 --> 00:04:56.399 +what is considered fast? + +00:04:56.400 --> 00:04:58.359 +What is considered seamless? + +00:04:58.360 --> 00:05:01.479 +What we really mean when we say + +00:05:01.480 --> 00:05:05.239 +the current LSP implementation is slow? + +00:05:05.240 --> 00:05:12.559 +Let's first look at the problem fundamentally. + +NOTE + +00:05:12.560 --> 00:05:17.679 +We interact with Emacs through a keyboard, + +00:05:17.680 --> 00:05:22.719 +so what we perceive as a fast and smooth feedback + +00:05:22.720 --> 00:05:25.999 +completely depends on how long it takes + +00:05:26.000 --> 00:05:29.359 +for a keyboard input to display on the Emacs buffer. + +00:05:29.360 --> 00:05:32.919 +From a pure graphical perspective, + +00:05:32.920 --> 00:05:36.519 +we need a minimum of 24 frames per second, + +00:05:36.520 --> 00:05:39.079 +the standard in the media industry, + +00:05:39.080 --> 00:05:42.359 +for us humans to perceive something as seamless. + +00:05:42.360 --> 00:05:46.999 +Say we need 25 frames per second, this means, + +00:05:47.000 --> 00:05:50.399 +if we divide 1000 milliseconds by 25, + +00:05:50.400 --> 00:05:54.759 +we only have approximately 40 millisecond window + +00:05:54.760 --> 00:05:57.919 +for the response time to spare. + +00:05:57.920 --> 00:06:01.679 +Even if we relax the constraint a bit more, + +00:06:01.680 --> 00:06:06.679 +on average a typist takes about 100 to 200 milliseconds + +00:06:06.680 --> 00:06:09.159 +between typing each character, + +00:06:09.160 --> 00:06:12.599 +so as long as we see a response within this timeframe, + +00:06:12.600 --> 00:06:19.559 +it is tolerable. However, using a slow language server + +00:06:19.560 --> 00:06:22.279 +on a large codebase easily exceeds + +00:06:22.280 --> 00:06:24.679 +the hundred millisecond mark, + +00:06:24.680 --> 00:06:27.479 +and sometimes takes more than 200 milliseconds, + +00:06:27.480 --> 00:06:32.039 +and inevitably will cause an inconsistent delay + +00:06:32.040 --> 00:06:33.199 +for the end user. + +NOTE + +00:06:33.200 --> 00:06:37.959 +At this point, someone might want to point out + +00:06:37.960 --> 00:06:41.079 +that nobody is gonna type at the maximum pace all the time. + +00:06:41.080 --> 00:06:45.039 +That's right, frankly speaking most of my time + +00:06:45.040 --> 00:06:47.639 +spent at programming is not writing code, + +00:06:47.640 --> 00:06:49.039 +but staring at the screen + +00:06:49.040 --> 00:06:51.279 +thinking about how to write the code. + +00:06:51.280 --> 00:06:55.599 +However, when we do actually type, + +00:06:55.600 --> 00:07:00.359 +maybe only a sentence, a variable name, a keyword, + +00:07:00.360 --> 00:07:03.039 +or just performing keybinding shortcuts, + +00:07:03.040 --> 00:07:08.479 +that's when we want to see our input feedback immediately. + +00:07:08.480 --> 00:07:10.479 +We've already spend so much time + +00:07:10.480 --> 00:07:12.159 +thinking about how to write, + +00:07:12.160 --> 00:07:16.479 +we don't want to waste any more time waiting for Emacs + +00:07:16.480 --> 00:07:19.559 +to process and show us what we've written + +00:07:19.560 --> 00:07:27.679 +half a second ago. Otherwise the frustration will build up. + +NOTE EAF showed a possibility + +00:07:28.400 --> 00:07:31.999 +In the past two years of EmacsConf, I've talked about + +00:07:32.000 --> 00:07:35.399 +the Emacs Application Framework, a project that extended + +00:07:35.400 --> 00:07:39.839 +Emacs Lisp to Python, Qt and JavaScript ecosystems. + +00:07:39.840 --> 00:07:43.759 +The EAF project specializes in improving + +00:07:43.760 --> 00:07:47.439 +the graphical and multimedia capabilities of Emacs + +00:07:47.440 --> 00:07:51.759 +through other languages, it was a great success. + +00:07:51.760 --> 00:07:55.759 +It demonstrated the endless possibilities of Emacs + +00:07:55.760 --> 00:08:00.159 +by embracing the strengths in other ecosystems. + +00:08:00.160 --> 00:08:04.239 +If anyone is interested for more information on EAF, + +00:08:04.240 --> 00:08:08.519 +please see the EAF repo and refer to my talks + +00:08:08.520 --> 00:08:12.959 +from EmacsConf2020 and 2021. + +00:08:12.960 --> 00:08:12.960 + + +00:08:12.960 --> 00:08:16.239 +The EAF project was created by Manatee Lazycat as well, + +00:08:16.240 --> 00:08:19.999 +so he thought if there is a way to design + +00:08:20.000 --> 00:08:22.759 +an LSP client similar to EAF + +00:08:22.760 --> 00:08:25.759 +that takes the advantage of Python's multi-threading, + +00:08:25.760 --> 00:08:27.839 +it will be able to solve our problem. + +00:08:27.840 --> 00:08:32.399 +Conveniently EAF had already done most of the ground work + +00:08:32.400 --> 00:08:34.359 +and demonstrated the possibility + +00:08:34.360 --> 00:08:42.159 +of cooperating Elisp and Python using the Emacs RPC effectively. + +NOTE LSP Bridge Objectives + +00:08:42.160 --> 00:08:45.039 +LSP Bridge has several goals in mind. + +00:08:45.040 --> 00:08:50.159 +Firstly, performance is the number one priority. + +00:08:50.160 --> 00:08:55.839 +Secondly, use Python multi-threading to bypass + +00:08:55.840 --> 00:08:59.239 +the aforementioned bottlenecks of a single-threaded Emacs. + +00:08:59.240 --> 00:09:04.519 +Thirdly, provide a simple solution that requires + +00:09:04.520 --> 00:09:07.519 +minimal setup for someone who just wants to have + +00:09:07.520 --> 00:09:10.079 +a fast autocomplete system in Emacs. + +00:09:10.080 --> 00:09:15.999 +This means, LSP Bridge does not intend + +00:09:16.000 --> 00:09:21.439 +and will not implement the entire LSP protocol, + +00:09:21.440 --> 00:09:23.639 +which is a vastly different approach + +00:09:23.640 --> 00:09:25.759 +than a solution like lsp-mode, + +00:09:25.760 --> 00:09:28.479 +we do not want to compete this way. + +00:09:28.480 --> 00:09:33.559 +We also believe some of the LSP Protocol features + +00:09:33.560 --> 00:09:37.759 +are unnecessary, or we already have better solutions + +00:09:37.760 --> 00:09:38.959 +in the Emacs ecosystem, + +00:09:38.960 --> 00:09:42.679 +such as tree-sitter for syntax highlighting. + +00:09:42.680 --> 00:09:44.959 +So we will not reinvent the wheel. + +00:09:44.960 --> 00:09:50.279 +Ultimately, we want to provide the fastest, butter-smooth + +00:09:50.280 --> 00:09:53.679 +and performant LSP client out of the box. + +NOTE Design. + +00:09:53.680 --> 00:09:54.560 +Design. + +00:09:54.561 --> 00:10:01.239 +Now let's look at the design architecture diagram. + +00:10:01.240 --> 00:10:04.639 +As you can see, it is split into + +00:10:04.640 --> 00:10:07.079 +the top half and bottom half. + +00:10:07.080 --> 00:10:10.559 +The top is the design for a single file model, + +00:10:10.560 --> 00:10:13.359 +and the bottom half is for project model. + +00:10:13.360 --> 00:10:18.159 +We make this distinction because we don't want a new user + +00:10:18.160 --> 00:10:22.599 +to be troubled on choosing a project root directory + +00:10:22.600 --> 00:10:25.199 +as the first impression to LSP + +00:10:25.200 --> 00:10:27.279 +before even start writing code. + +00:10:27.280 --> 00:10:27.280 + + +00:10:27.280 --> 00:10:30.479 +From a new user's perspective, + +00:10:30.480 --> 00:10:32.959 +they've just installed this package, + +00:10:32.960 --> 00:10:35.159 +and all they are expecting + +00:10:35.160 --> 00:10:37.679 +is using a smart autocomplete system, + +00:10:37.680 --> 00:10:41.519 +what does root directory even mean in this context? + +00:10:41.520 --> 00:10:44.119 +So we make the decision for them + +00:10:44.120 --> 00:10:48.199 +based on whether this file is part of a git repository. + +00:10:48.200 --> 00:10:56.719 +Often times we write code in its own standalone file, + +00:10:56.720 --> 00:10:59.919 +this is extremely common for scripting languages + +00:10:59.920 --> 00:11:03.319 +like bash or python. So in the single file model, + +00:11:03.320 --> 00:11:07.159 +LSP Bridge will start a dedicated LSP server + +00:11:07.160 --> 00:11:10.319 +for this particular file based on file type, + +00:11:10.320 --> 00:11:13.479 +and every file corresponds to a LSP server, + +00:11:13.480 --> 00:11:17.839 +so each server doesn't interfere with one another. + +00:11:17.840 --> 00:11:23.719 +The project model will have every file of the same type + +00:11:23.720 --> 00:11:25.919 +under the same project share one server. + +00:11:25.920 --> 00:11:30.439 +We believe this is a positive trade-off for user experience. + +00:11:30.440 --> 00:11:30.440 + + +00:11:30.440 --> 00:11:36.599 +LSP Bridge internally implemented two main threads, + +00:11:36.600 --> 00:11:40.399 +one is the Request Thread, the other is Response Thread. + +00:11:40.400 --> 00:11:45.279 +The Request Thread is used to handle all the requests + +00:11:45.280 --> 00:11:48.679 +coming from Emacs, it does not answer immediately, + +00:11:48.680 --> 00:11:52.839 +this is important because Emacs doesn't need to wait + +00:11:52.840 --> 00:11:54.679 +for any response under any reason, + +00:11:54.680 --> 00:11:58.159 +even if the server is buggy or died out, + +00:11:58.160 --> 00:12:01.159 +it shouldn't matter to the performance of Emacs. + +00:12:01.160 --> 00:12:04.039 +The Response Thread is used to handle + +00:12:04.040 --> 00:12:06.559 +the response coming from LSP servers. + +00:12:06.560 --> 00:12:11.239 +After retrieving a response, regardless of the JSON size, + +00:12:11.240 --> 00:12:14.439 +it sends to its own thread for computation, + +00:12:14.440 --> 00:12:17.079 +such as candidate filtering and renaming. + +00:12:17.080 --> 00:12:19.999 +Once the computation is finished, + +00:12:20.000 --> 00:12:23.639 +it will determine if this information is expired, + +00:12:23.640 --> 00:12:26.399 +if not, then push it to Emacs. + +00:12:26.400 --> 00:12:26.400 + + +00:12:26.400 --> 00:12:31.559 +From the Emacs side, when it receives the LSP information, + +00:12:31.560 --> 00:12:34.639 +it only needs to determine the course of action, + +00:12:34.640 --> 00:12:39.159 +either popup completion, jump to definition, + +00:12:39.160 --> 00:12:44.799 +renaming action, or show references and show documentions. + +00:12:44.800 --> 00:12:49.119 +You see, from a user, all LSP Bridge doing + +00:12:49.120 --> 00:12:52.279 +is these 5 things, the user doesn't need to care about + +00:12:52.280 --> 00:12:54.559 +anything else like the complicated + +00:12:54.560 --> 00:12:56.479 +Language Server Protocols. + +00:12:56.480 --> 00:12:56.480 + + +00:12:56.480 --> 00:13:02.439 +Python side caches heavy data + +00:13:02.440 --> 00:13:06.279 +such as candidate documentation and diagnostics. + +00:13:06.280 --> 00:13:11.079 +We process as much server data as possible in Python, + +00:13:11.080 --> 00:13:15.759 +and only pass to Emacs as little data as possible + +00:13:15.760 --> 00:13:18.159 +so it doesn't clog the Emacs thread + +00:13:18.160 --> 00:13:19.799 +and triggers garbage collection. + +00:13:19.800 --> 00:13:19.800 + + +00:13:19.800 --> 00:13:24.319 +This design is critical, because all Emacs needs to do + +00:13:24.320 --> 00:13:27.039 +is sending LSP requests to LSP Bridge, + +00:13:27.040 --> 00:13:29.439 +it doesn't wait for a response, + +00:13:29.440 --> 00:13:32.999 +it simply knows what to do *when* there is a response. + +00:13:33.000 --> 00:13:37.159 +So the user's input immediately displays on the buffer + +00:13:37.160 --> 00:13:39.559 +well within the 40 millisecond window, + +00:13:39.560 --> 00:13:45.199 +and in the mean time, the user can continue to type + +00:13:45.200 --> 00:13:48.199 +if he doesn't need the help from LSP right away, + +00:13:48.200 --> 00:13:51.279 +it fundamentally resolves the stuttering problem. + +NOTE ACM - Asynchronous Completion Menu + +00:13:51.280 --> 00:13:59.079 +Now I want to talk about acm-mode, + +00:13:59.080 --> 00:14:09.599 +which stands for asynchronous completion menu, + +00:14:09.600 --> 00:14:12.479 +it is a completion framework + +00:14:12.480 --> 00:14:15.039 +that currently bundled with LSP Bridge + +00:14:15.040 --> 00:14:17.279 +designed to accomodate for + +00:14:17.280 --> 00:14:20.399 +the asynchronous nature of LSP servers. + +00:14:20.400 --> 00:14:26.919 +It is a replacement for the built-in capf, + +00:14:26.920 --> 00:14:30.359 +short for completion-at-point-functions, + +00:14:30.360 --> 00:14:32.519 +used in almost everywhere + +00:14:32.520 --> 00:14:35.759 +including company-mode and corfu-mode. + +00:14:35.760 --> 00:14:40.839 +Yes, we unfortunately reinvented a very fundamental wheel. + +00:14:40.840 --> 00:14:44.279 +No, it wasn't an easy decision. + +00:14:44.280 --> 00:14:47.879 +However we still believe it's worth it. + +00:14:47.880 --> 00:14:53.359 +LSP Bridge initially used company-mode, + +00:14:53.360 --> 00:14:56.119 +then moved on to corfu-mode for a while, + +00:14:56.120 --> 00:14:58.999 +but eventually Lazycat determined + +00:14:59.000 --> 00:15:00.719 +that it is much more painful to write + +00:15:00.720 --> 00:15:05.679 +a lot of workaround code to force LSP Bridge + +00:15:05.680 --> 00:15:09.959 +to handle capf nicely than to just fork Corfu, + +00:15:09.960 --> 00:15:11.999 +remove all the capf code, + +00:15:12.000 --> 00:15:15.239 +and write a new completion framework from the remainings. + +00:15:15.240 --> 00:15:15.240 + + +00:15:15.240 --> 00:15:20.719 +Performance wise, capf requires Emacs to store + +00:15:20.720 --> 00:15:23.119 +the entire candidate list + +00:15:23.120 --> 00:15:27.159 +when looking up candidate annotations. + +00:15:27.160 --> 00:15:30.639 +It needs to search through the entire candidate list first, + +00:15:30.640 --> 00:15:32.599 +then use the candidate as a key + +00:15:32.600 --> 00:15:34.799 +to search for the actual information. + +00:15:34.800 --> 00:15:38.919 +This entire process will be repeated every time + +00:15:38.920 --> 00:15:40.679 +when drawing the completion menu. + +00:15:40.680 --> 00:15:45.199 +This is truly intensive computing task for Emacs to handle. + +00:15:45.200 --> 00:15:50.519 +On top of that, the existing capf frameworks assume + +00:15:50.520 --> 00:15:54.279 +the candidate list, which is retrieved from the LSP server, + +00:15:54.280 --> 00:15:56.839 +to be ready and finalized in place + +00:15:56.840 --> 00:15:58.719 +when the completion popup occurred. + +00:15:58.720 --> 00:16:02.119 +However given the design of LSP Bridge, + +00:16:02.120 --> 00:16:05.919 +Emacs will not sit there and wait for the server response, + +00:16:05.920 --> 00:16:10.439 +instead the Response Thread may feed Emacs data + +00:16:10.440 --> 00:16:14.919 +whenever it's ready. This makes capf almost impossible + +00:16:14.920 --> 00:16:21.919 +to form a finalized candidate list during popup. + +00:16:21.920 --> 00:16:21.920 + + +00:16:21.920 --> 00:16:26.079 +The complete reasons regarding why capf is incompatible + +00:16:26.080 --> 00:16:28.679 +with the asynchronous nature of LSP servers + +00:16:28.680 --> 00:16:32.479 +are very complicated and deserves its own talk. + +00:16:32.480 --> 00:16:37.079 +Lazycat wrote an entire blog post detailing his reasonings, + +00:16:37.080 --> 00:16:40.999 +while Corfu's author Daniel Mendler a.k.a minad + +00:16:41.000 --> 00:16:44.239 +also done his own investigations and experiments, + +00:16:44.240 --> 00:16:47.239 +and reached a common conclusion. + +00:16:47.240 --> 00:16:50.919 +For anyone interested, I've pasted the links + +00:16:50.920 --> 00:16:52.759 +to the corresponding posts here. + +00:16:52.760 --> 00:16:57.399 +Therefore, keep in mind that LSP Bridge + +00:16:57.400 --> 00:16:59.919 +can only use acm-mode to work nicely, + +00:16:59.920 --> 00:17:03.359 +so please disable other completion frameworks + +00:17:03.360 --> 00:17:07.159 +like company and corfu before trying LSP Bridge. + +NOTE LSP Bridge + ACM -> Multi-Backend Completion Framework + +00:17:07.160 --> 00:17:14.919 +By designing ACM with asynchronous server response in mind, + +00:17:14.920 --> 00:17:18.759 +this unlocks LSP Bridge project's potential + +00:17:18.760 --> 00:17:22.199 +to provide completions from almost any backends. + +00:17:22.200 --> 00:17:25.679 +ACM has blended all the backends together, + +00:17:25.680 --> 00:17:28.799 +and configured a priority to display + +00:17:28.800 --> 00:17:32.839 +important completion results like LSP before other backends. + +00:17:32.840 --> 00:17:38.559 +It can autocomplete LSP, TabNine, Elisp symbols, yasnippets, + +00:17:38.560 --> 00:17:41.039 +even English dictionaries and much more. + +00:17:41.040 --> 00:17:43.959 +As long as you have the backends installed, + +00:17:43.960 --> 00:17:46.319 +they all work out-of-the-box! + +NOTE Today and future. Join us! + +00:17:46.320 --> 00:17:55.239 +Although LSP Bridge is a relatively new package + +00:17:55.240 --> 00:18:00.039 +with just over 7 months old, it is already a success! + +00:18:00.040 --> 00:18:06.599 +As of December of 2022, we have 67 contributors + +00:18:06.600 --> 00:18:08.439 +making more than 1000 commits, + +00:18:08.440 --> 00:18:12.679 +and we reached more than 600 stars on Github! + +00:18:12.680 --> 00:18:16.359 +LSP Bridge is easily extensible, + +00:18:16.360 --> 00:18:18.879 +developing a new language backend is very simple too, + +00:18:18.880 --> 00:18:20.639 +feel free to join us! + +00:18:20.640 --> 00:18:25.599 +LSP Bridge is another successful example + +00:18:25.600 --> 00:18:29.919 +of extending Emacs Lisp with Python, and just like EAF, + +00:18:29.920 --> 00:18:33.639 +it demonstrated the potential Emacs can achieve + +00:18:33.640 --> 00:18:37.039 +when we jump out of the Lisp-only world + +00:18:37.040 --> 00:18:39.199 +and embrace other ecosystems. + +00:18:39.200 --> 00:18:43.479 +Recently Lazycat created a package called blink-search + +00:18:43.480 --> 00:18:45.679 +that leveraged similar ideas + +00:18:45.680 --> 00:18:48.919 +but an asynchronous search framework, + +00:18:48.920 --> 00:18:51.239 +as well as a package called deno-bridge + +00:18:51.240 --> 00:18:53.119 +that extended Emacs Lisp + +00:18:53.120 --> 00:18:56.439 +with Deno JavaScript TypeScript runtimes. + +00:18:56.440 --> 00:18:57.559 +Please check it out, + +00:18:57.560 --> 00:19:05.199 +if consider joining the development too! + +NOTE Thanks + +00:19:05.200 --> 00:19:08.599 +This is the entirety of my presentation, thanks for joining! + +00:19:08.600 --> 00:19:11.319 +Me and Lazycat will be available + +00:19:11.320 --> 00:19:20.240 +to answer questions on IRC and Etherpad. diff --git a/2022/captions/emacsconf-2022-sat-open--opening-remarks--main.vtt b/2022/captions/emacsconf-2022-sat-open--opening-remarks--main.vtt new file mode 100644 index 00000000..2fc69a17 --- /dev/null +++ b/2022/captions/emacsconf-2022-sat-open--opening-remarks--main.vtt @@ -0,0 +1,273 @@ +WEBVTT captioned by sachac + +NOTE General and Development tracks +#+OUTPUT: /home/sacha/proj/emacsconf/emacsconf-2022-sat-open--opening-remarks--main.webm +[[file:/home/sacha/screenshots/Screenshot_2022-12-03_00-20-35.png]] + +00:00:00.000 --> 00:00:03.519 +Welcome to EmacsConf 2022, where we get to find out + +00:00:03.520 --> 00:00:06.239 +just how crazy a text editor can get. + +00:00:06.240 --> 00:00:08.319 +There were so many interesting talks + +00:00:08.320 --> 00:00:11.319 +that we couldn't figure out how to fit them in two days, + +00:00:11.320 --> 00:00:14.119 +so this year we're experimenting with having two tracks. + +NOTE +[[file:/home/sacha/screenshots/Screenshot_2022-12-03_00-29-06.png]] + +00:00:14.120 --> 00:00:16.119 +There's a General track and a Development track, + +00:00:16.120 --> 00:00:17.959 +but really, you'll probably find + +00:00:17.960 --> 00:00:19.599 +interesting things on both tracks + +00:00:19.600 --> 00:00:22.159 +no matter what your level of experience is, + +00:00:22.160 --> 00:00:25.079 +so don't feel limited to one or the other. + +00:00:25.080 --> 00:00:26.999 +If we all figure out this track thing together, + +00:00:27.000 --> 00:00:29.879 +that could mean being able to have even more Emacs talks + +00:00:29.880 --> 00:00:32.839 +next year, so let's give it a try! + +NOTE Conversations +[[file:/home/sacha/screenshots/Screenshot_2022-12-03_00-22-47.png]] + +00:00:32.840 --> 00:00:35.719 +The best parts of EmacsConf are the conversations. + +00:00:35.720 --> 00:00:38.279 +The wiki has a page on how to watch and participate, + +00:00:38.280 --> 00:00:40.839 +and I'll give you a quick overview as well. + +NOTE +[[file:/home/sacha/screenshots/Screenshot_2022-12-03_00-23-52.png]] + +00:00:40.840 --> 00:00:43.999 +You can watch both streams at live.emacsconf.org + +00:00:44.000 --> 00:00:46.279 +using free and open source software. + +NOTE +[[file:/home/sacha/screenshots/Screenshot_2022-12-03_01-00-29.png]] + +00:00:46.280 --> 00:00:48.199 +The schedule shows the General track on top + +00:00:48.200 --> 00:00:49.959 +and the Development track on the bottom, + +00:00:49.960 --> 00:00:52.159 +so you can see what else is going on. + +NOTE +[[file:/home/sacha/screenshots/Screenshot_2022-12-03_00-24-24.png]] + +00:00:52.160 --> 00:00:54.559 +The track pages have quick shortcuts so that you can + +00:00:54.560 --> 00:00:57.359 +find out more about talks, open the Etherpads, + +00:00:57.360 --> 00:01:00.799 +and join the Q&A sessions. The watch page has more tips + +00:01:00.800 --> 00:01:02.119 +on how to make the most of Q&A. + +NOTE Etherpad +[[file:/home/sacha/screenshots/Screenshot_2022-12-03_00-24-44.png]] + +00:01:02.120 --> 00:01:05.759 +If you can, please add notes and ask questions + +00:01:05.760 --> 00:01:08.519 +in the Etherpad for the talk. That makes it easier + +00:01:08.520 --> 00:01:10.079 +for everyone to share their notes, + +00:01:10.080 --> 00:01:13.119 +and speakers and hosts can read the questions from there. + +00:01:13.120 --> 00:01:16.039 +We'll copy the notes to the talk pages afterwards. + +NOTE +[[file:/home/sacha/screenshots/Screenshot_2022-12-03_00-25-06.png]] + +00:01:16.040 --> 00:01:18.319 +We have one pad for each talk this year, + +00:01:18.320 --> 00:01:20.919 +so you can follow the links to get to the next one + +00:01:20.920 --> 00:01:23.959 +or go back to the schedule and get the link from there. + +NOTE +[[file:/home/sacha/screenshots/Screenshot_2022-12-03_00-25-27.png]] + +00:01:23.960 --> 00:01:25.599 +If you have general feedback about + +00:01:25.600 --> 00:01:27.759 +the conference itself, please put it in + +00:01:27.760 --> 00:01:30.679 +pad.emacsconf.org/2022 . + +NOTE Internet Relay Chat +[[file:/home/sacha/screenshots/Screenshot_2022-12-03_00-25-47.png]] + +00:01:31.600 --> 00:01:34.479 +Internet Relay Chat or IRC can be another great way + +00:01:34.480 --> 00:01:37.279 +to be part of lots of conversations. + +NOTE +[[file:/home/sacha/screenshots/Screenshot_2022-12-03_00-26-04.png]] + +00:01:37.280 --> 00:01:40.319 +You can use chat.emacsconf.org to join the IRC channels + +00:01:40.320 --> 00:01:43.199 +through your web browser. The tabs on the left can help you + +00:01:43.200 --> 00:01:45.239 +switch between the different channels. + +00:01:45.240 --> 00:01:47.719 +There's #emacsconf-gen for the General track + +00:01:47.720 --> 00:01:50.239 +and #emacsconf-dev for the Development track. + +00:01:50.240 --> 00:01:53.439 +If you need to reach us, you can join #emacsconf-org + +00:01:53.440 --> 00:01:57.879 +or e-mail emacsconf-org-private@gnu.org. + +00:01:57.880 --> 00:02:01.359 +You can use #emacsconf for hallway conversations. + +NOTE Accessibility and open captions +[[file:/home/sacha/screenshots/Screenshot_2022-12-03_00-26-32.png]] + +00:02:01.360 --> 00:02:03.919 +Once again, we're going to be streaming with open captions + +00:02:03.920 --> 00:02:06.639 +for most of the talks this year, thanks to our speakers and + +00:02:06.640 --> 00:02:09.919 +captioning volunteers. The captioned talks are indicated + +00:02:09.920 --> 00:02:12.519 +on the schedule, and with any luck, we'll be posting + +00:02:12.520 --> 00:02:16.119 +transcripts on talk pages shortly after the talks start. + +00:02:16.120 --> 00:02:18.919 +If you need additional accommodations, please let us know + +00:02:18.920 --> 00:02:20.319 +in #emacsconf-org and we'll see + +00:02:20.320 --> 00:02:22.439 +if we can make things happen. + +NOTE status.emacsconf.org, #emacsconf-org +[[file:/home/sacha/screenshots/Screenshot_2022-12-03_00-26-55.png]] + +00:02:22.440 --> 00:02:26.319 +If something goes down, we'll update status.emacsconf.org. + +00:02:26.320 --> 00:02:27.799 +If it doesn't look like we've noticed yet, + +00:02:27.800 --> 00:02:31.599 +please let us know in the #emacsconf-org IRC channel, + +00:02:31.600 --> 00:02:34.519 +where we will be quietly panicking. + +NOTE Guidelines for conduct +[[file:/home/sacha/screenshots/Screenshot_2022-12-03_00-27-19.png]] + +00:02:34.520 --> 00:02:36.959 +In all of these conversations, please keep in mind + +00:02:36.960 --> 00:02:39.759 +our guidelines for conduct. You can find them on the wiki, + +00:02:39.760 --> 00:02:42.959 +and they basically boil down to: please be nice. Thank you! + +NOTE Recordings +#+CAPTION: +[[file:/home/sacha/screenshots/Screenshot_2022-12-03_00-27-53.png]] + +00:02:42.960 --> 00:02:47.519 +We'll be posting the prerecorded videos as soon as possible. + +00:02:47.520 --> 00:02:50.039 +Assuming things go well, you might be able to check out + +00:02:50.040 --> 00:02:52.719 +quick replays on the Toobnix channel, which you can + +00:02:52.720 --> 00:02:55.679 +find on the watch page in the wiki. We'll post the live + +00:02:55.680 --> 00:02:58.759 +talks and Q&A sessions some time after the conference. + +00:02:58.760 --> 00:03:01.799 +If you'd like to get an update, you can subscribe to + +00:03:01.800 --> 00:03:05.359 +the emacsconf-discuss mailing list. + +NOTE Let's have fun +[[file:/home/sacha/screenshots/Screenshot_2022-12-03_00-28-14.png]] + +00:03:05.360 --> 00:03:06.599 +All right, let's get going. + +00:03:06.600 --> 00:03:09.639 +Leo Vivier is going to be hosting the general track, + +00:03:09.640 --> 00:03:12.399 +and Amin Bandali will host the development track. + +00:03:12.400 --> 00:03:15.319 +The other volunteers and I will run around mostly backstage, + +00:03:15.320 --> 00:03:18.159 +and you'll probably meet us in the closing remarks. + +00:03:18.160 --> 00:03:20.720 +Let's have fun at EmacsConf 2022! diff --git a/2022/captions/emacsconf-2022-school--back-to-school-with-emacs--daniel-rosel--main.vtt b/2022/captions/emacsconf-2022-school--back-to-school-with-emacs--daniel-rosel--main.vtt new file mode 100644 index 00000000..92b99925 --- /dev/null +++ b/2022/captions/emacsconf-2022-school--back-to-school-with-emacs--daniel-rosel--main.vtt @@ -0,0 +1,383 @@ +WEBVTT captioned by sachac + +NOTE Introduction + +00:00:00.000 --> 00:00:04.879 +Taking notes on a computer can be challenging, + +00:00:04.880 --> 00:00:08.279 +especially if you compare computer notes + +00:00:08.280 --> 00:00:11.959 +with handwritten notes. When you're handwriting, + +00:00:11.960 --> 00:00:16.159 +you don't focus as much on taking those notes. + +00:00:16.160 --> 00:00:19.559 +Well, you don't focus as much on *how* you take the notes, + +00:00:19.560 --> 00:00:24.119 +you more so focus on what you're taking. + +00:00:24.120 --> 00:00:27.719 +You don't get that same experience + +00:00:27.720 --> 00:00:30.519 +if you're writing your notes on a computer. + +00:00:30.520 --> 00:00:32.119 +When writing notes on a computer, + +00:00:32.120 --> 00:00:38.439 +you mostly focus on typing or alignment. + +00:00:38.440 --> 00:00:42.159 +Those are things that are kind of solved already + +00:00:42.160 --> 00:00:45.359 +by certain software such as Org Mode, + +00:00:45.360 --> 00:00:48.599 +which is fantastic when it comes to note-taking, + +00:00:48.600 --> 00:00:51.919 +but I still believe it could be much better. + +NOTE Packages: Lectorg, Reorg, HBH + +00:00:51.920 --> 00:00:56.639 +That's why I've developed the package called Lectorg. + +00:00:56.640 --> 00:01:01.799 +It's a collection of scripts and snippets which allow you + +00:01:01.800 --> 00:01:04.959 +to improve your note-taking experience on the computer, + +00:01:04.960 --> 00:01:09.919 +of course, making you more focused on the subject + +00:01:09.920 --> 00:01:14.439 +rather than the process of taking notes. + +00:01:14.440 --> 00:01:16.559 +So why use Emacs? Well, again, + +00:01:16.560 --> 00:01:18.719 +if compared with other software, + +00:01:18.720 --> 00:01:21.799 +it has a lot more customizability + +00:01:21.800 --> 00:01:24.679 +and it can also unify pretty much anything you need + +00:01:24.680 --> 00:01:31.079 +in student life or work life into one place. + +00:01:31.080 --> 00:01:35.639 +The problems that Lectorg solves are kind of, + +00:01:35.640 --> 00:01:37.879 +as I mentioned, already solved partially + +00:01:37.880 --> 00:01:40.479 +by Org Mode itself. + +00:01:40.480 --> 00:01:44.599 +What I've done is simply make a bunch of additions + +00:01:44.600 --> 00:01:47.359 +to Org Mode through an external package, + +00:01:47.360 --> 00:01:51.279 +but I've also developed other sub-modules, + +00:01:51.280 --> 00:01:54.439 +one of them being HBH, which allows me + +00:01:54.440 --> 00:02:01.399 +to easily plan out my days HBH, hour by hour, + +00:02:01.400 --> 00:02:04.679 +therefore I can plan out my days on an hourly basis + +00:02:04.680 --> 00:02:09.439 +practically. But I've also built something called Reorg + +00:02:09.440 --> 00:02:11.999 +which, for those of you that are familiar + +00:02:12.000 --> 00:02:14.599 +with the Remarkable tablet, allows you + +00:02:14.600 --> 00:02:19.999 +to integrate notes from your Remarkable into Emacs-- + +00:02:20.000 --> 00:02:22.439 +into your Org Mode notes basically. + +00:02:22.440 --> 00:02:25.199 +Now I believe there's already another talk on integrating + +00:02:25.200 --> 00:02:26.919 +handwritten notes into Emacs, + +00:02:26.920 --> 00:02:30.679 +so I won't get too much into that. + +NOTE Org Mode + +00:02:30.680 --> 00:02:36.079 +So again, at the heart of Lectorg is Org Mode, + +00:02:36.080 --> 00:02:38.479 +which for those of you that might not be familiar, + +00:02:38.480 --> 00:02:43.759 +Org Mode is one of the best pieces of software + +00:02:43.760 --> 00:02:49.039 +when it comes to basically capturing any sort of text, + +00:02:49.040 --> 00:02:51.559 +managing that text, exporting it + +00:02:51.560 --> 00:02:53.959 +into various different formats, + +00:02:53.960 --> 00:02:57.279 +which is perfect for taking notes + +00:02:57.280 --> 00:02:59.399 +because you can either export them, + +00:02:59.400 --> 00:03:02.119 +take them on the go if you don't have access + +00:03:02.120 --> 00:03:03.879 +to your computer all the time, + +00:03:03.880 --> 00:03:05.839 +or you can share them with friends, which... + +00:03:05.840 --> 00:03:11.359 +Well, that is somewhat self-explanatory + +00:03:11.360 --> 00:03:14.919 +in how that can help you or others. + +NOTE The ecosystem of Lectorg: Elisp and Python + +00:03:14.920 --> 00:03:16.559 +Now the ecosystem of Lectorg, + +00:03:16.560 --> 00:03:21.719 +it's a bit chaotic as of right now. It's a package itself, + +00:03:21.720 --> 00:03:25.759 +Lectorg.el, which also partially relies on + +00:03:25.760 --> 00:03:27.759 +a collection of Python scripts + +00:03:27.760 --> 00:03:30.039 +as I didn't have that much time + +00:03:30.040 --> 00:03:34.119 +to develop the software strictly in Elisp, + +00:03:34.120 --> 00:03:37.599 +but it still gets the job done, + +00:03:37.600 --> 00:03:43.719 +and I believe that there is no speed hindrance. + +00:03:43.720 --> 00:03:46.519 +Now to further improve Lectorg, + +00:03:46.520 --> 00:03:49.279 +I'd love to ask for your help + +00:03:49.280 --> 00:03:53.079 +if you have encountered any sort of issue + +00:03:53.080 --> 00:03:56.839 +when it comes to note-taking or academics in general, + +00:03:56.840 --> 00:03:59.759 +I would love to integrate your solution + +00:03:59.760 --> 00:04:04.399 +(or if you don't have one, we can come up with one) + +00:04:04.400 --> 00:04:07.519 +into Lectorg. Also, if anyone would be willing + +00:04:07.520 --> 00:04:13.439 +to transcribe those Python scripts + +00:04:13.440 --> 00:04:18.679 +into a more Lisp approach, then that'd be fabulous. + +NOTE How Lectorg works + +00:04:18.680 --> 00:04:24.319 +So let's look at how Lectorg works in practice. + +00:04:24.320 --> 00:04:26.039 +We'll look at two examples, + +00:04:26.040 --> 00:04:28.319 +one of taking notes for math + +00:04:28.320 --> 00:04:33.319 +and the other for business, I believe. + +00:04:33.320 --> 00:04:36.039 +Now I have to mention that all of the things + +00:04:36.040 --> 00:04:38.279 +that I do in that example + +00:04:38.280 --> 00:04:43.919 +do not cover all the functions and features of Lectorg. + +00:04:43.920 --> 00:04:49.159 +There is decent documentation on the Lectorg GitLab page, + +NOTE Math + +00:04:49.160 --> 00:04:57.519 +so do check that out for further reference. + +00:04:57.520 --> 00:04:59.319 +For our first example, we're going to start off + +00:04:59.320 --> 00:05:04.239 +with taking notes for statistics. Now what I'm doing here + +00:05:04.240 --> 00:05:06.479 +is opening Lectorg Hub, which allows me + +00:05:06.480 --> 00:05:10.879 +to associate certain resources with this particular course. + +00:05:10.880 --> 00:05:15.679 +Here, I've opened the book which I have associated + +00:05:15.680 --> 00:05:19.319 +with this course, and I'm going to go ahead + +00:05:19.320 --> 00:05:22.519 +and start taking some notes + +00:05:22.520 --> 00:05:26.639 +on the cumulative distribution function here. + +00:05:26.640 --> 00:05:29.999 +Now what OrgMode allows you to do + +00:05:30.000 --> 00:05:34.599 +is integrate LaTeX into regular text quite easily, + +00:05:34.600 --> 00:05:38.239 +preview it, and then later export it. + +00:05:38.240 --> 00:05:48.599 +Now here we can see the first usage of a snippet !m, + +00:05:48.600 --> 00:05:59.639 +which inserts a block for entering a LaTeX equation. + +00:05:59.640 --> 00:06:00.839 +What I'm trying to do here + +00:06:00.840 --> 00:06:04.999 +is take a screenshot of the figures in the book, + +00:06:05.000 --> 00:06:10.679 +which is done with org-download (not a part of Lectorg, + +00:06:10.680 --> 00:06:15.799 +but a very useful tool). Now that is it for math. + +NOTE Business + +00:06:15.800 --> 00:06:18.039 +Let's look at something a bit different. + +00:06:18.040 --> 00:06:20.199 +We're going to take a look at business, + +00:06:20.200 --> 00:06:24.519 +more specifically, taking notes on the product lifecycle. + +00:06:24.520 --> 00:06:27.559 +Here on the left, I have certain notes from class + +00:06:27.560 --> 00:06:31.079 +which are not complete. + +00:06:31.080 --> 00:06:34.679 +As you can see at the top, there's a comment + +00:06:34.680 --> 00:06:42.719 +also done using Lectorg which puts this file into a TODO + +00:06:42.720 --> 00:06:46.719 +so that I can get back to it whenever I want + +00:06:46.720 --> 00:06:48.879 +or schedule this TODO. + +00:06:48.880 --> 00:06:54.439 +Now I'm taking notes on a video lecture, + +00:06:54.440 --> 00:07:07.639 +which I've opened, again, through Lectorg hub. + +00:07:07.640 --> 00:07:09.759 +As you can see right now, I'm inserting + +00:07:09.760 --> 00:07:12.479 +another snippet for Plantuml, + +00:07:12.480 --> 00:07:15.319 +which immediately exports it to a file, + +00:07:15.320 --> 00:07:19.799 +and again I'm going to be using org-download here + +00:07:19.800 --> 00:07:25.759 +to insert another figure at the top. + +NOTE Conclusion + +00:07:25.760 --> 00:07:33.359 +I hope this demonstration was useful. + +00:07:33.360 --> 00:07:35.599 +Once again, it did not demonstrate everything. + +00:07:35.600 --> 00:07:37.839 +You can find more on GitLab. + +00:07:37.840 --> 00:07:44.399 +I hope some of you might consider using Lectorg + +00:07:44.400 --> 00:07:46.839 +in your academic life or perhaps even + +00:07:46.840 --> 00:07:51.319 +in some areas of business. I believe that is + +00:07:51.320 --> 00:07:53.759 +everything I have to demonstrate for today. + +00:07:53.760 --> 00:07:57.439 +Thank you for listening to this talk, + +00:07:57.440 --> 00:08:08.480 +have a nice rest of the day. diff --git a/2022/captions/emacsconf-2022-science--writing-and-organizing-literature-notes-for-scientific-writing--vidianos--main.vtt b/2022/captions/emacsconf-2022-science--writing-and-organizing-literature-notes-for-scientific-writing--vidianos--main.vtt new file mode 100644 index 00000000..6b098ba9 --- /dev/null +++ b/2022/captions/emacsconf-2022-science--writing-and-organizing-literature-notes-for-scientific-writing--vidianos--main.vtt @@ -0,0 +1,1153 @@ +WEBVTT captioned by hannah + +00:00:00.000 --> 00:00:02.039 +Hello everyone, I'm Vidianos. + +00:00:02.040 --> 00:00:03.079 +Today I'm going to show you + +00:00:03.080 --> 00:00:04.079 +how I write and organize + +00:00:04.080 --> 00:00:06.439 +my literature notes using Emacs. + +00:00:06.440 --> 00:00:08.719 +I take my notes using Zettelkasten, + +00:00:08.720 --> 00:00:11.079 +which you may or may not have heard. + +00:00:11.080 --> 00:00:13.839 +It is about taking small atomic notes + +00:00:13.840 --> 00:00:14.999 +and linking them one another + +00:00:15.000 --> 00:00:17.599 +to create your so-called second brain. + +00:00:17.600 --> 00:00:19.159 +Here is mine. + +00:00:19.160 --> 00:00:20.719 +This is a graph of all the notes + +00:00:20.720 --> 00:00:22.879 +I have accumulated the last few years. + +00:00:22.880 --> 00:00:25.199 +It has various types of notes, + +00:00:25.200 --> 00:00:25.959 +but we're mainly going to focus on + +00:00:25.960 --> 00:00:28.319 +literature notes today. + +00:00:28.320 --> 00:00:29.639 +Here are the contents of my talk. + +00:00:29.640 --> 00:00:30.439 +We're going to start + +00:00:30.440 --> 00:00:31.919 +with bibliography management, + +00:00:31.920 --> 00:00:33.319 +which is how I take bibliography + +00:00:33.320 --> 00:00:35.959 +from the web and import it to Emacs. + +00:00:35.960 --> 00:00:37.079 +Then we're going to talk about + +00:00:37.080 --> 00:00:38.879 +how I create literature notes + +00:00:38.880 --> 00:00:42.759 +using a custom org-roam-bibtex template I have. + +00:00:42.760 --> 00:00:43.919 +And after talking about that, + +00:00:43.920 --> 00:00:46.359 +we can talk about how I write literature notes, + +00:00:46.360 --> 00:00:48.239 +which is through annotating an article + +00:00:48.240 --> 00:00:51.319 +using org-noter. Org-noter is a package + +00:00:51.320 --> 00:00:53.439 +that allows you to annotate PDFs + +00:00:53.440 --> 00:00:54.999 +using the Org format + +00:00:55.000 --> 00:00:59.559 +and creates a supplementary Org file to your PDF. + +00:00:59.560 --> 00:01:00.879 +Then we're going to talk about + +00:01:00.880 --> 00:01:03.519 +adding the literature to your Zettelkasten, + +00:01:03.520 --> 00:01:06.279 +which is a simple but important topic, + +00:01:06.280 --> 00:01:08.599 +and how you can write permanent notes + +00:01:08.600 --> 00:01:11.719 +based on the info you obtain from this literature. + +00:01:11.720 --> 00:01:13.319 +Lastly, we're going to focus on + +00:01:13.320 --> 00:01:14.999 +the organization problem + +00:01:15.000 --> 00:01:17.719 +one might find when having a lot of literature + +00:01:17.720 --> 00:01:21.439 +for an assignment or an article or something, + +00:01:21.440 --> 00:01:22.959 +and how I have tried to solve this + +00:01:22.960 --> 00:01:24.839 +with my package Zetteldesk. + +00:01:24.840 --> 00:01:26.359 +This isn't the perfect solution, + +00:01:26.360 --> 00:01:29.799 +but it is what I have, and I really like it. + +00:01:29.800 --> 00:01:30.839 +Finally, we're going to talk about + +00:01:30.840 --> 00:01:33.559 +how to compose the final article + +00:01:33.560 --> 00:01:35.199 +that you want to produce + +00:01:35.200 --> 00:01:36.799 +using this literature + +00:01:36.800 --> 00:01:38.639 +with the technique described + +00:01:38.640 --> 00:01:40.559 +in the rest of this talk. + +00:01:40.560 --> 00:01:42.239 +So let's begin the talk + +00:01:42.240 --> 00:01:44.239 +with bibliography management. + +00:01:44.240 --> 00:01:47.239 +Zotero is the bibliography manager I use. + +00:01:47.240 --> 00:01:49.399 +It is very simple to store articles with it, + +00:01:49.400 --> 00:01:50.679 +and it exports to .bib, + +00:01:50.680 --> 00:01:52.079 +integrating with packages + +00:01:52.080 --> 00:01:54.959 +such as org-roam-bibtex and ivy-bibtex. + +00:01:54.960 --> 00:01:56.679 +When researching, I typically find + +00:01:56.680 --> 00:02:00.039 +a long list of articles from a search engine. + +00:02:00.040 --> 00:02:03.439 +I open the titles which have interesting titles + +00:02:03.440 --> 00:02:05.039 +through their abstracts + +00:02:05.040 --> 00:02:07.799 +and save to Zotero those whose abstracts + +00:02:07.800 --> 00:02:10.319 +are the most relevant to what I want. + +00:02:10.320 --> 00:02:11.799 +From these articles, + +00:02:11.800 --> 00:02:13.359 +I typically won't read all of them + +00:02:13.360 --> 00:02:14.519 +because they're a lot, + +00:02:14.520 --> 00:02:17.759 +but I will select a few, + +00:02:17.760 --> 00:02:21.639 +once I have collected as many as I want. + +00:02:21.640 --> 00:02:24.079 +Zotero acts as a way to store everything + +00:02:24.080 --> 00:02:25.479 +that might be interesting, + +00:02:25.480 --> 00:02:28.519 +while Emacs and my Zettelkasten + +00:02:28.520 --> 00:02:30.959 +stores everything that is definitely interesting, + +00:02:30.960 --> 00:02:35.199 +and I have read it already. + +00:02:35.200 --> 00:02:36.359 +And then we can move to + +00:02:36.360 --> 00:02:38.559 +how I create literature notes. + +00:02:38.560 --> 00:02:41.119 +I set the default action of ivy-bibtex + +00:02:41.120 --> 00:02:43.599 +to ivy-bibtex-edit-notes, + +00:02:43.600 --> 00:02:44.919 +which will prompt-- which + +00:02:44.920 --> 00:02:46.479 +with org-roam-bibtex-mode active, + +00:02:46.480 --> 00:02:48.839 +prompts you for an org-capture template + +00:02:48.840 --> 00:02:50.799 +when selecting something + +00:02:50.800 --> 00:02:52.319 +if the node doesn't exist, + +00:02:52.320 --> 00:02:54.959 +or takes you to the existing node. + +00:02:54.960 --> 00:02:58.439 +And obviously you need to have this here, + +00:02:58.440 --> 00:03:00.799 +to set the default action + +00:03:00.800 --> 00:03:02.599 +that was already there + +00:03:02.600 --> 00:03:04.959 +to a letter. + +00:03:04.960 --> 00:03:08.039 +Then we can move to my org-roam reference template, + +00:03:08.040 --> 00:03:11.159 +using org-roam-bibtex. + +00:03:11.160 --> 00:03:12.439 +This isn't so complicated, + +00:03:12.440 --> 00:03:14.119 +but it has some important stuff + +00:03:14.120 --> 00:03:14.879 +I want to highlight. + +00:03:14.880 --> 00:03:17.399 +Save it to the ref directory, + +00:03:17.400 --> 00:03:19.719 +so I can remember where it is, + +00:03:19.720 --> 00:03:23.559 +and it's classified as a literature note. + +00:03:23.560 --> 00:03:25.119 +The file name is the cite key, + +00:03:25.120 --> 00:03:27.759 +which is easy and small, + +00:03:27.760 --> 00:03:30.079 +but the title is the actual article's title. + +00:03:30.080 --> 00:03:32.319 +Give it a tag of the entry-type; + +00:03:32.320 --> 00:03:35.039 +this is typically "article," + +00:03:35.040 --> 00:03:37.479 +but it's easy to sort things this way + +00:03:37.480 --> 00:03:41.399 +because not all literature notes are articles. + +00:03:41.400 --> 00:03:43.159 +And then give the keywords + +00:03:43.160 --> 00:03:47.359 +that are given by Zotero, because why not? + +00:03:47.360 --> 00:03:51.479 +Tags here are tags from Zettelkasten. + +00:03:51.480 --> 00:03:53.639 +These are the links to + +00:03:53.640 --> 00:03:55.359 +other files which are relevant, + +00:03:55.360 --> 00:03:58.079 +but its initialization is empty, obviously. + +00:03:58.080 --> 00:03:59.839 +And then this heading is where + +00:03:59.840 --> 00:04:00.839 +all the magic happens. + +00:04:00.840 --> 00:04:04.719 +The name is just not really so relevant; + +00:04:04.720 --> 00:04:07.559 +I just needed something that made sense. + +00:04:07.560 --> 00:04:10.399 +The properties are what matters, + +00:04:10.400 --> 00:04:12.239 +and mainly this one here. + +00:04:12.240 --> 00:04:18.879 +The ${file} attribute finds + +00:04:18.880 --> 00:04:24.799 +the file of this specific literature + +00:04:24.800 --> 00:04:27.519 +and makes sure that org-noter works + +00:04:27.520 --> 00:04:29.639 +by default here. + +00:04:29.640 --> 00:04:32.559 +As I'm going to show you in a moment, + +00:04:32.560 --> 00:04:34.599 +this way [of] initializing the literature note, + +00:04:34.600 --> 00:04:36.999 +org-noter works by default. + +00:04:37.000 --> 00:04:40.159 +That's all, basically, for the template. + +00:04:40.160 --> 00:04:42.759 +This is the point of the talk + +00:04:42.760 --> 00:04:44.039 +where we reach the first demo. + +00:04:44.040 --> 00:04:47.079 +This is about opening ivy-bibtex, + +00:04:47.080 --> 00:04:50.239 +selecting an article I want to annotate, + +00:04:50.240 --> 00:04:52.999 +initializing the literature note. + +00:04:53.000 --> 00:04:54.999 +We can see that everything + +00:04:55.000 --> 00:04:56.479 +is inserted in for me, + +00:04:56.480 --> 00:05:01.079 +and if I open org-noter on this heading, + +00:05:01.080 --> 00:05:03.759 +it opens the article, as expected. + +00:05:03.760 --> 00:05:06.199 +I can read the article, + +00:05:06.200 --> 00:05:08.439 +I can say I want to + +00:05:08.440 --> 00:05:10.720 +annotate something here. + +00:05:20.720 --> 00:05:24.119 +Obviously, annotation is not that simple as here, + +00:05:24.120 --> 00:05:26.479 +but I don't really have the time + +00:05:26.480 --> 00:05:28.599 +to actually annotate an article live. + +00:05:28.600 --> 00:05:34.039 +But you can keep going, and it's a good setup. + +00:05:34.040 --> 00:05:39.879 +Then close org-noter, + +00:05:39.880 --> 00:05:40.839 +and let's go presentation again. + +00:05:40.840 --> 00:05:44.359 +Moving on, this section is some stuff + +00:05:44.360 --> 00:05:45.799 +about my annotation process. + +00:05:45.800 --> 00:05:49.479 +As I said, there is not enough time for me + +00:05:49.480 --> 00:05:51.119 +to actually annotate an article live, + +00:05:51.120 --> 00:05:52.999 +but here are some things about it. + +00:05:53.000 --> 00:05:55.479 +First, is that I annotate with org-noter, + +00:05:55.480 --> 00:05:56.719 +which I absolutely love. + +00:05:56.720 --> 00:05:59.599 +It is great for annotations + +00:05:59.600 --> 00:06:02.519 +because you do them in org, + +00:06:02.520 --> 00:06:03.879 +which is an amazing format + +00:06:03.880 --> 00:06:05.879 +and gives you a lot of flexibility, + +00:06:05.880 --> 00:06:07.839 +such as adding to the Zettelkasten, + +00:06:07.840 --> 00:06:11.319 +being initialized by a capture template, + +00:06:11.320 --> 00:06:13.119 +and other things. + +00:06:13.120 --> 00:06:15.959 +But also, you don't need to look for + +00:06:15.960 --> 00:06:17.359 +the notes inside the PDF, + +00:06:17.360 --> 00:06:19.519 +which is a problem you can have + +00:06:19.520 --> 00:06:20.959 +if you annotate on the PDF, + +00:06:20.960 --> 00:06:23.079 +and it is very annoying in my opinion. + +00:06:23.080 --> 00:06:26.439 +So I prefer having these notes, + +00:06:26.440 --> 00:06:27.879 +and I can only focus on them, + +00:06:27.880 --> 00:06:29.759 +but I can also see where they refer. + +00:06:29.760 --> 00:06:33.199 +The other scenarios are not so good. + +00:06:33.200 --> 00:06:35.519 +Annotating on the PDF, + +00:06:35.520 --> 00:06:36.479 +you search for it, + +00:06:36.480 --> 00:06:41.199 +and if you don't know which section it refers to, + +00:06:41.200 --> 00:06:42.759 +then you need to look about it, + +00:06:42.760 --> 00:06:44.239 +and that is very tiring. + +00:06:44.240 --> 00:06:48.359 +Also, I am always annotating in English. + +00:06:48.360 --> 00:06:50.199 +This is not my mother tongue, + +00:06:50.200 --> 00:06:52.039 +but it helps me avoid + +00:06:52.040 --> 00:06:53.679 +the necessary mental overhead + +00:06:53.680 --> 00:06:55.199 +of translating while reading. + +00:06:55.200 --> 00:06:57.559 +I want to pay attention to what I read + +00:06:57.560 --> 00:06:59.679 +and not to translate stuff. + +00:06:59.680 --> 00:07:02.119 +I will translate later. + +00:07:02.120 --> 00:07:05.039 +And when finishing an article, + +00:07:05.040 --> 00:07:07.719 +I write a mini-abstract myself, + +00:07:07.720 --> 00:07:10.119 +which contains what I think about the article. + +00:07:10.120 --> 00:07:11.639 +It doesn't need to be much, + +00:07:11.640 --> 00:07:13.999 +it's usually like 3 or 4 paragraphs, + +00:07:14.000 --> 00:07:18.319 +and it shows things that are useful in the article, + +00:07:18.320 --> 00:07:21.159 +and what is mentioned that matters to me. + +00:07:21.160 --> 00:07:22.599 +So I can look back at it, + +00:07:22.600 --> 00:07:24.919 +and it is very easy for me to find + +00:07:24.920 --> 00:07:26.599 +what I got from this article, + +00:07:26.600 --> 00:07:30.199 +so where I will cite it on my actual project. + +00:07:30.200 --> 00:07:33.879 +Then last thing you need to do + +00:07:33.880 --> 00:07:35.479 +is add a note to your Zettelkasten. + +00:07:35.480 --> 00:07:38.039 +This is very easy due to it being in an org format. + +00:07:38.040 --> 00:07:41.799 +You can just have it in the org-roam directory, + +00:07:41.800 --> 00:07:43.639 +which it automatically goes to, + +00:07:43.640 --> 00:07:46.559 +and link it to other relevant notes, + +00:07:46.560 --> 00:07:48.519 +which is its index + +00:07:48.520 --> 00:07:50.559 +because everything in my Zettelkasten + +00:07:50.560 --> 00:07:51.719 +(at least) has an index, + +00:07:51.720 --> 00:07:54.519 +but also every other permanent note + +00:07:54.520 --> 00:07:56.759 +whose contents are in one way or another + +00:07:56.760 --> 00:07:58.079 +mentioned inside the article. + +00:07:58.080 --> 00:08:00.359 +This way the article is in a network with notes + +00:08:00.360 --> 00:08:02.039 +that are similar to it. + +00:08:02.040 --> 00:08:05.359 +Then we move on to the second demo, + +00:08:05.360 --> 00:08:08.039 +which is about a full-fledged literature note. + +00:08:08.040 --> 00:08:11.119 +We can go on org-roam-node-find, + +00:08:11.120 --> 00:08:13.159 +search for references, + +00:08:13.160 --> 00:08:15.559 +go to this, and you can see + +00:08:15.560 --> 00:08:17.759 +it is linked to other notes. + +00:08:17.760 --> 00:08:20.039 +And here is the mini-abstract, + +00:08:20.040 --> 00:08:21.479 +and here are my notes on it. + +00:08:21.480 --> 00:08:27.519 +The last thing you need to do + +00:08:27.520 --> 00:08:29.119 +when creating a literature note, + +00:08:29.120 --> 00:08:31.319 +is obviously create permanent notes + +00:08:31.320 --> 00:08:32.279 +based on what you read. + +00:08:32.280 --> 00:08:35.679 +If you never create these literature notes, + +00:08:35.680 --> 00:08:37.679 +you will never get new information. + +00:08:37.680 --> 00:08:40.439 +So for your Zettelkasten to grow, + +00:08:40.440 --> 00:08:42.359 +you need to create such notes. + +00:08:42.360 --> 00:08:45.879 +This means that the subject you are researching + +00:08:45.880 --> 00:08:47.799 +is not just literature notes + +00:08:47.800 --> 00:08:50.279 +but has well-structured permanent notes, + +00:08:50.280 --> 00:08:52.799 +which is what you will actually read. + +00:08:52.800 --> 00:08:55.159 +You typically only read literature notes + +00:08:55.160 --> 00:08:57.159 +to see what gets cited where. + +00:08:57.160 --> 00:08:58.759 +What you will mostly read + +00:08:58.760 --> 00:08:59.839 +is these permanent notes + +00:08:59.840 --> 00:09:01.679 +that you create from this knowledge. + +00:09:01.680 --> 00:09:05.239 +So finally we are at the last part of the talk, + +00:09:05.240 --> 00:09:07.359 +which is about organizing literature notes. + +00:09:07.360 --> 00:09:09.559 +And this is in my opinion + +00:09:09.560 --> 00:09:10.879 +the most interesting part + +00:09:10.880 --> 00:09:12.199 +because it is very unique. + +00:09:12.200 --> 00:09:14.719 +It uses a package I wrote myself, + +00:09:14.720 --> 00:09:18.319 +and it doesn't have as much usage + +00:09:18.320 --> 00:09:21.519 +as the rest of the things I described so far. + +00:09:21.520 --> 00:09:24.799 +So what is the problem you might find? + +00:09:24.800 --> 00:09:27.959 +Indeed, if you read a lot of things, + +00:09:27.960 --> 00:09:30.959 +you have a large collection of notes, + +00:09:30.960 --> 00:09:33.919 +and it's not the only thing you will think about. + +00:09:33.920 --> 00:09:36.079 +However, you do need to + +00:09:36.080 --> 00:09:37.799 +justify everything with citations, + +00:09:37.800 --> 00:09:39.879 +so you need to remember everything + +00:09:39.880 --> 00:09:41.119 +you read in these notes. + +00:09:41.120 --> 00:09:43.519 +You have done a lot of work, + +00:09:43.520 --> 00:09:45.919 +but there is still a lot for you + +00:09:45.920 --> 00:09:47.319 +to reach your final manuscript. + +00:09:47.320 --> 00:09:50.359 +Except if there was a handy little way + +00:09:50.360 --> 00:09:52.879 +to combine everything + +00:09:52.880 --> 00:09:55.879 +and sort it in a very easy way. + +00:09:55.880 --> 00:09:56.959 +Well, there is, + +00:09:56.960 --> 00:10:00.119 +and I think it came out pretty well. + +00:10:00.120 --> 00:10:01.799 +It's zetteldesk.el. + +00:10:01.800 --> 00:10:05.039 +It was inspired by this quote here + +00:10:05.040 --> 00:10:06.479 +from How to Take Smart Notes. + +00:10:06.480 --> 00:10:09.799 +Sönke Ahrens here talked about a desktop, + +00:10:09.800 --> 00:10:13.079 +which you have all the literature + +00:10:13.080 --> 00:10:16.239 +you want in that desktop, + +00:10:16.240 --> 00:10:20.079 +and you try to bring it in order. + +00:10:20.080 --> 00:10:22.599 +And by doing that, + +00:10:22.600 --> 00:10:24.839 +you can improve your ideas + +00:10:24.840 --> 00:10:27.519 +and have a structure + +00:10:27.520 --> 00:10:30.919 +so that your manuscript will then be + +00:10:30.920 --> 00:10:33.879 +very, very easy to write. + +00:10:33.880 --> 00:10:36.279 +And as I say here, in trying to do this, + +00:10:36.280 --> 00:10:38.919 +I made something much more general + +00:10:38.920 --> 00:10:41.559 +than it needed to be, so yeah, + +00:10:41.560 --> 00:10:43.599 +you can use it for many other things. + +00:10:43.600 --> 00:10:46.959 +But before I show you some things about it, + +00:10:46.960 --> 00:10:49.879 +I want to introduce you to what a desktop is. + +00:10:49.880 --> 00:10:53.159 +It's essentially a collection of the knowledge + +00:10:53.160 --> 00:10:54.839 +you want to be able to see. + +00:10:54.840 --> 00:10:57.999 +You add things to your Zetteldesk, + +00:10:58.000 --> 00:11:01.679 +and using filter functions, + +00:11:01.680 --> 00:11:04.919 +you only see these notes and nothing else, + +00:11:04.920 --> 00:11:07.359 +which in my opinion is very handy. + +00:11:07.360 --> 00:11:10.319 +So having said that, + +00:11:10.320 --> 00:11:12.479 +we can see these things in action + +00:11:12.480 --> 00:11:14.399 +for the final demo of the talk. + +00:11:14.400 --> 00:11:15.839 +This is the third one. + +00:11:15.840 --> 00:11:20.879 +I will go to an index file of mine. + +00:11:20.880 --> 00:11:21.959 +This is 3D printing, + +00:11:21.960 --> 00:11:23.479 +an assignment I had last semester. + +00:11:23.480 --> 00:11:27.039 +And this has 28 backlinks, + +00:11:27.040 --> 00:11:30.399 +so a lot of things that I looked at + +00:11:30.400 --> 00:11:31.799 +for this assignment. + +00:11:31.800 --> 00:11:33.519 +I can say I want to add + +00:11:33.520 --> 00:11:35.799 +the current note's backlinks to the Zetteldesk, + +00:11:35.800 --> 00:11:38.239 +and now I have a filtered version + +00:11:38.240 --> 00:11:40.119 +of org-roam-node-find defined, + +00:11:40.120 --> 00:11:41.999 +which only lists these 29 notes. + +00:11:42.000 --> 00:11:45.039 +Very nice, right? + +00:11:45.040 --> 00:11:49.159 +I can also filter just the literature notes, + +00:11:49.160 --> 00:11:55.999 +which can also use other UIs beside org-roam, + +00:11:56.000 --> 00:11:57.439 +such as, for example, + +00:11:57.440 --> 00:12:00.039 +one I use a lot is the ivy-bibtex command. + +00:12:00.040 --> 00:12:03.239 +This takes a lot of time, + +00:12:03.240 --> 00:12:04.599 +much longer than the org-roam one, + +00:12:04.600 --> 00:12:06.479 +but has them in this UI, + +00:12:06.480 --> 00:12:09.839 +which in a lot of cases is more useful for me. + +00:12:09.840 --> 00:12:15.719 +The other very important thing is inserting these. + +00:12:15.720 --> 00:12:19.999 +For example, say I want to insert a permanent note, + +00:12:20.000 --> 00:12:21.759 +such as this. + +00:12:21.760 --> 00:12:25.399 +Its title will become a top-level heading, + +00:12:25.400 --> 00:12:29.319 +and everything else will be inserted as expected. + +00:12:29.320 --> 00:12:35.399 +But the most important thing for us + +00:12:35.400 --> 00:12:37.159 +is inserting literature, right? + +00:12:37.160 --> 00:12:39.519 +This is done with this command, + +00:12:39.520 --> 00:12:42.719 +and let's say I want to insert this. + +00:12:42.720 --> 00:12:48.239 +The title again becomes a heading, + +00:12:48.240 --> 00:12:50.839 +and this is the article title also. + +00:12:50.840 --> 00:12:53.039 +I store the cite key here, + +00:12:53.040 --> 00:12:56.319 +and everything else about it is also here. + +00:12:56.320 --> 00:12:58.239 +And I can add others, + +00:12:58.240 --> 00:13:01.199 +for example, this and this. + +00:13:01.200 --> 00:13:09.039 +And we have all of them here. + +00:13:09.040 --> 00:13:11.279 +I see it says this is the basic, + +00:13:11.280 --> 00:13:12.799 +so let's put it at the top. + +00:13:12.800 --> 00:13:18.839 +And then maybe I want to put this last. + +00:13:18.840 --> 00:13:24.159 +And this way, you can sort things, + +00:13:24.160 --> 00:13:26.319 +and typically, on the other side, + +00:13:26.320 --> 00:13:27.719 +I have a manuscript, + +00:13:27.720 --> 00:13:29.999 +and I look at what order + +00:13:30.000 --> 00:13:31.159 +I want to have things in + +00:13:31.160 --> 00:13:34.799 +and sort the articles and the permanent notes + +00:13:34.800 --> 00:13:38.359 +in a way so that each section can have + +00:13:38.360 --> 00:13:41.799 +its own citations and its own notes, + +00:13:41.800 --> 00:13:46.199 +which makes writing, again, very easy, in my opinion. + +00:13:46.200 --> 00:13:53.719 +Finally, let's go to composing the final article. + +00:13:53.720 --> 00:13:57.279 +This is our goal: we wrote and organized + +00:13:57.280 --> 00:13:58.359 +all these literature notes + +00:13:58.360 --> 00:14:00.399 +to put them in your final project. + +00:14:00.400 --> 00:14:01.879 +This might be an assignment + +00:14:01.880 --> 00:14:04.439 +or an actual scientific article. + +00:14:04.440 --> 00:14:07.479 +It is apparent that you have done + +00:14:07.480 --> 00:14:09.079 +a lot of work for this so far, + +00:14:09.080 --> 00:14:12.279 +but you don't need to do a lot more. + +00:14:12.280 --> 00:14:14.079 +In my opinion, this is the easiest part + +00:14:14.080 --> 00:14:15.519 +of the whole workflow. + +00:14:15.520 --> 00:14:19.279 +People consider final article composition hard, + +00:14:19.280 --> 00:14:21.239 +but if you've done all these steps, + +00:14:21.240 --> 00:14:23.439 +you already have everything you want + +00:14:23.440 --> 00:14:25.639 +to add in the article from your notes. + +00:14:25.640 --> 00:14:27.719 +It's already there, + +00:14:27.720 --> 00:14:30.759 +a lot of things are copy-pasted, + +00:14:30.760 --> 00:14:34.039 +it's all in a coherent order, + +00:14:34.040 --> 00:14:38.439 +connections are to an extent already there, + +00:14:38.440 --> 00:14:41.599 +and you know what citation goes where, + +00:14:41.600 --> 00:14:44.199 +so you can justify everything you write. + +00:14:44.200 --> 00:14:46.799 +The actual draft isn't there, + +00:14:46.800 --> 00:14:48.519 +but it is very easy + +00:14:48.520 --> 00:14:52.599 +because now you just write things as you see them + +00:14:52.600 --> 00:14:54.439 +in your desktop and connect them. + +00:14:54.440 --> 00:14:56.959 +Connections are basic-- + +00:14:56.960 --> 00:14:59.439 +connections and making the article good, obviously, + +00:14:59.440 --> 00:15:02.399 +are basically the only thing you need to worry, + +00:15:02.400 --> 00:15:05.919 +but those are very important + +00:15:05.920 --> 00:15:09.039 +because others will only see the final manuscript, + +00:15:09.040 --> 00:15:11.079 +so if that's not good, + +00:15:11.080 --> 00:15:14.079 +then the whole assignment is not good, obviously. + +00:15:14.080 --> 00:15:17.519 +So it's not like your work is done, + +00:15:17.520 --> 00:15:19.159 +it's just very easy. + +00:15:19.160 --> 00:15:23.279 +And with that, I hope you liked my talk + +00:15:23.280 --> 00:15:25.519 +because it is coming to an end now. + +00:15:25.520 --> 00:15:27.919 +I want to thank you for your time; + +00:15:27.920 --> 00:15:29.679 +I hope you enjoyed it. + +00:15:29.680 --> 00:15:32.519 +You can feel free to email me at this address; + +00:15:32.520 --> 00:15:35.639 +it has also been on every slide since the beginning. + +00:15:35.640 --> 00:15:40.239 +I also have the GitHub for zetteldesk.el here, + +00:15:40.240 --> 00:15:42.519 +and I will be available for questions. + +00:15:42.520 --> 00:15:44.999 +I will be viewing both the pad and the IRC + +00:15:45.000 --> 00:15:49.159 +and will do a live Q&A after this. See you. + +00:15:49.160 --> 00:15:51.279 +Actually, before I go, + +00:15:51.280 --> 00:15:54.199 +let's show you the GitHub for zetteldesk.el. + +00:15:54.200 --> 00:15:57.119 +Here's the README; if you're interested on it, + +00:15:57.120 --> 00:15:58.519 +you can see more about it, + +00:15:58.520 --> 00:16:02.559 +and also I have a very in-depth wiki about it + +00:16:02.560 --> 00:16:06.519 +with 11 pages, and talking about everything + +00:16:06.520 --> 00:16:08.079 +that happens here. + +00:16:08.080 --> 00:16:11.759 +A lot of what we discussed is in this section + +00:16:11.760 --> 00:16:12.919 +about literature notes. + +00:16:12.920 --> 00:16:17.199 +These documents go a lot more in-depth + +00:16:17.200 --> 00:16:22.799 +in how Zetteldesk works, and also how to use it, + +00:16:22.800 --> 00:16:27.719 +so if you're interested, feel free to read them, + +00:16:27.720 --> 00:16:30.239 +and if you have any problems, + +00:16:30.240 --> 00:16:31.839 +you can open an issue about it; + +00:16:31.840 --> 00:16:44.480 +I will be very active. Thank you. diff --git a/2022/captions/emacsconf-2022-treesitter--treesitter-beyond-syntax-highlighting--abin-simon--main.vtt b/2022/captions/emacsconf-2022-treesitter--treesitter-beyond-syntax-highlighting--abin-simon--main.vtt new file mode 100644 index 00000000..8a426e7c --- /dev/null +++ b/2022/captions/emacsconf-2022-treesitter--treesitter-beyond-syntax-highlighting--abin-simon--main.vtt @@ -0,0 +1,727 @@ +WEBVTT captioned by sachac + +00:00:00.000 --> 00:00:03.240 +Hey everyone, my name is Abin Simon + +00:00:03.240 --> 00:00:05.080 +and this talk is about "Tree-sitter: + +00:00:05.080 --> 00:00:08.200 +Beyond Syntax Highlighting." + +00:00:08.200 --> 00:00:10.720 +For those who are not aware of what Tree-sitter is, + +00:00:10.720 --> 00:00:11.720 +let me give you a quick intro. + +00:00:11.720 --> 00:00:17.120 +Tree-sitter, at its core, is a parser generator tool + +00:00:17.120 --> 00:00:19.440 +and an incremental parsing library. + +00:00:19.440 --> 00:00:22.000 +What it essentially means is that it gives you + +00:00:22.000 --> 00:00:23.154 +an always up-to-date + +00:00:23.155 --> 00:00:24.200 +AST [abstract syntax tree] of your code. + +00:00:24.200 --> 00:00:27.960 +In the current Emacs frame, what you see to the right + +00:00:27.960 --> 00:00:30.840 +is the AST tree produced by Tree-sitter + +00:00:30.840 --> 00:00:33.560 +of the code that is on the left. + +00:00:33.560 --> 00:00:37.000 +For example, if you go to this "if" statement, + +00:00:37.000 --> 00:00:38.840 +you can see it goes here. + +00:00:38.840 --> 00:00:41.440 +It is also really good at handling errors. + +00:00:41.440 --> 00:00:44.400 +For example, if I were to delete this [if statement], + +00:00:44.400 --> 00:00:47.960 +it still parses out a tree as much as it can, + +00:00:47.960 --> 00:00:50.280 +but with an error node. + +00:00:50.280 --> 00:00:51.760 +Now let's see how we can query the tree + +00:00:51.760 --> 00:00:54.440 +to get the information that we need. + +00:00:54.440 --> 00:01:01.480 +Let's first try to get all the identifiers in the buffer. + +00:01:01.480 --> 00:01:04.000 +It highlights all the identifiers in the buffer, + +00:01:04.000 --> 00:01:05.440 +but let's say we want to get something + +00:01:05.440 --> 00:01:07.280 +a little more precise. + +00:01:07.280 --> 00:01:10.400 +Let's say we wanted to get this "i" here. + +00:01:10.400 --> 00:01:13.280 +This, in our case, would be this identifier + +00:01:13.280 --> 00:01:15.200 +inside this assignment expression + +00:01:15.200 --> 00:01:27.320 +inside this "for" statement. + +00:01:27.320 --> 00:01:29.920 +We can write it out like this. + +00:01:29.920 --> 00:01:31.880 +I hope this gives you a basic idea + +00:01:31.880 --> 00:01:34.480 +of how Tree-sitter works and how you can query + +00:01:34.480 --> 00:01:37.040 +to get the information that you need. + +00:01:37.040 --> 00:01:39.520 +First of all, let's see how Tree-sitter can help us + +00:01:39.520 --> 00:01:41.880 +with syntax highlighting. + +00:01:41.880 --> 00:01:46.480 +This is the default syntax highlighting by Emacs for SQL. + +00:01:46.480 --> 00:01:52.000 +Now let's see how Tree-sitter helps. + +00:01:52.000 --> 00:01:54.240 +This is the syntax highlighting in Emacs + +00:01:54.240 --> 00:01:56.760 +which Tree-sitter enabled. + +00:01:56.760 --> 00:01:58.240 +You'll see that we're able to target + +00:01:58.240 --> 00:02:01.240 +a lot more things and highlight them. + +00:02:01.240 --> 00:02:03.138 +That said, you don't always have to + +00:02:03.139 --> 00:02:04.200 +highlight everything. + +00:02:04.200 --> 00:02:15.640 +I personally prefer a much simpler theme. + +00:02:15.640 --> 00:02:17.880 +Now let's see how Tree-sitter helps you simplify + +00:02:17.880 --> 00:02:20.920 +adding custom syntax highlighting to your code. + +00:02:20.920 --> 00:02:22.200 +This is a Python file which has + +00:02:22.200 --> 00:02:25.640 +a class and a few member functions. + +00:02:25.640 --> 00:02:27.680 +Anyone who has used Python will know that + +00:02:27.680 --> 00:02:32.040 +the "self" keyword, while it is passed in as an argument, + +00:02:32.040 --> 00:02:34.240 +it has more meaning than that. + +00:02:34.240 --> 00:02:35.480 +Let's see if you can use Tree-sitter + +00:02:35.480 --> 00:02:38.720 +to highlight just the "self" keyword. + +00:02:38.720 --> 00:02:40.400 +If you look at the Tree-sitter tree, + +00:02:40.400 --> 00:02:43.120 +you can see that this is the first identifier + +00:02:43.120 --> 00:02:45.520 +in the list of parameters for a function definition. + +00:02:45.520 --> 00:02:55.480 +This is how you would query for the first identifier + +00:02:55.480 --> 00:02:59.320 +inside parameters inside a function definition. + +00:02:59.320 --> 00:03:02.520 +Now, if you see here, it also matches "cls", + +00:03:02.520 --> 00:03:11.360 +but let's restrict it to match just "self". + +00:03:11.360 --> 00:03:14.200 +Now we have a Tree-sitter query that identifies + +00:03:14.200 --> 00:03:16.960 +the first argument to the function definition + +00:03:16.960 --> 00:03:19.640 +and is also called "self". + +00:03:19.640 --> 00:03:22.520 +We can use this to apply custom highlighting onto this. + +00:03:22.520 --> 00:03:25.000 +This is pretty much all the code + +00:03:25.000 --> 00:03:26.520 +that you'll need to do this. + +00:03:26.520 --> 00:03:29.240 +The first block here is essentially to say to + +00:03:29.240 --> 00:03:32.160 +Tree-sitter to highlight anything with python.self + +00:03:32.160 --> 00:03:35.720 +with the face of custom-set. + +00:03:35.720 --> 00:03:37.520 +Now the second block here essentially is + +00:03:37.520 --> 00:03:39.800 +how we match for that. + +00:03:39.800 --> 00:03:41.800 +Now if you go back into a Python buffer + +00:03:41.800 --> 00:03:44.680 +and re-enable python-mode, we'll see that "self" + +00:03:44.680 --> 00:03:47.120 +is highlighted differently. + +00:03:47.120 --> 00:03:48.880 +How about creating text objects? + +00:03:48.880 --> 00:03:50.440 +Tree-sitter can help there too. + +00:03:50.440 --> 00:03:53.080 +For those who don't know, text objects + +00:03:53.080 --> 00:03:54.440 +is an idea that comes from Vim, + +00:03:54.440 --> 00:03:57.760 +and you can do things like select word, + +00:03:57.760 --> 00:04:00.520 +delete word, things like that. + +00:04:00.520 --> 00:04:06.200 +There are other text objects like line and paragraph. + +00:04:06.200 --> 00:04:09.000 +For each text object, you can have operations + +00:04:09.000 --> 00:04:09.760 +that are defined on them. + +00:04:09.760 --> 00:04:13.600 +For example, delete, copy, select, comment, + +00:04:13.600 --> 00:04:16.400 +all of these are operations that you can do. + +00:04:16.400 --> 00:04:19.400 +Let's try and use Tree-sitter to add more text objects. + +00:04:19.400 --> 00:04:20.560 +This is a plugin that I wrote + +00:04:20.560 --> 00:04:25.000 +which lets you add more text objects into Emacs. + +00:04:25.000 --> 00:04:27.880 +It helps you code aware text objects + +00:04:27.880 --> 00:04:31.880 +like functions, conditionals, loops, and such. + +00:04:31.880 --> 00:04:34.360 +Let's see an example scenario of how + +00:04:34.360 --> 00:04:35.920 +something like this could come in handy. + +00:04:35.920 --> 00:04:39.280 +For example, I can select inside this condition + +00:04:39.280 --> 00:04:42.960 +or inside this function and do things like that. + +00:04:42.960 --> 00:04:44.520 +Let's say I want to take this conditional, + +00:04:44.520 --> 00:04:47.160 +move to the next function, and create it here. + +00:04:47.160 --> 00:04:49.640 +What I would do is something like + +00:04:49.640 --> 00:04:52.320 +delete the conditional, move to the next function, + +00:04:52.320 --> 00:04:56.240 +create a conditional there, and paste. + +00:04:56.240 --> 00:04:57.160 +Let's try another example. + +00:04:57.160 --> 00:05:01.360 +Let's say I want to take this and move it to the end. + +00:05:01.360 --> 00:05:02.960 +If I had to do it without text objects, + +00:05:02.960 --> 00:05:06.800 +I'd probably have to go back to the previous comma, + +00:05:06.800 --> 00:05:10.440 +delete till next comma, find the closing bracket, + +00:05:10.440 --> 00:05:11.880 +and paste before. + +00:05:11.880 --> 00:05:14.040 +That works, but let's see + +00:05:14.040 --> 00:05:16.520 +how Tree-sitter can simplify it. + +00:05:16.520 --> 00:05:19.240 +With Tree-sitter, I can say delete the argument, + +00:05:19.240 --> 00:05:22.880 +go to the end of the next argument, and then paste. + +00:05:22.880 --> 00:05:25.280 +Tree-sitter essentially helps Emacs + +00:05:25.280 --> 00:05:27.240 +understand the code better semantically. + +00:05:27.240 --> 00:05:29.600 +Here is yet another use case. + +00:05:29.600 --> 00:05:31.480 +I work at a remote company, + +00:05:31.480 --> 00:05:33.440 +and I often find myself being in a call + +00:05:33.440 --> 00:05:35.400 +with my teammates, explaining the code to them. + +00:05:35.400 --> 00:05:38.000 +And one thing that really comes in handy + +00:05:38.000 --> 00:05:39.760 +is the narrowing accessibility of Emacs. + +00:05:39.760 --> 00:05:43.040 +Specifically, the fancy-narrow package. + +00:05:43.040 --> 00:05:44.840 +I use it to narrow just the function, + +00:05:44.840 --> 00:05:48.760 +or I could narrow to the conditional. + +00:05:48.760 --> 00:05:51.520 +Next to the end, the list would be code folding. + +00:05:51.520 --> 00:05:54.480 +This is a package which uses Tree-sitter + +00:05:54.480 --> 00:05:57.560 +to improve the code folding functionalities of Emacs. + +00:05:57.560 --> 00:06:00.200 +Code folding has always been this thing + +00:06:00.200 --> 00:06:02.280 +that I've had a love-hate relationship with. + +00:06:02.280 --> 00:06:04.280 +It usually works most of the time, + +00:06:04.280 --> 00:06:06.960 +but then fails if the indentation is wrong + +00:06:06.960 --> 00:06:09.160 +or we do something weird with the arguments. + +00:06:09.160 --> 00:06:11.680 +But now with Tree-sitter in the mix, + +00:06:11.680 --> 00:06:12.720 +it's a lot more precise. + +00:06:12.720 --> 00:06:17.040 +I can fold comments, I can fold functions, + +00:06:17.040 --> 00:06:20.480 +I can fold conditionals. You get the idea. + +00:06:20.480 --> 00:06:23.840 +I work with Kubernetes, which means I end up + +00:06:23.840 --> 00:06:28.080 +having to write and read a lot of YAML files. + +00:06:28.080 --> 00:06:31.840 +And navigating big YAML files is a mess. + +00:06:31.840 --> 00:06:35.760 +The two main problems are figuring out where I am, + +00:06:35.760 --> 00:06:38.760 +and two, navigating to where I want to be. + +00:06:38.760 --> 00:06:41.760 +Let's see how Tree-sitter can help us with both of this. + +00:06:41.760 --> 00:06:43.840 +This is an example YAML file. + +00:06:43.840 --> 00:06:47.080 +To be precise, this is the values file + +00:06:47.080 --> 00:06:48.640 +of the Redis helm chart. + +00:06:48.640 --> 00:06:52.240 +I'm somewhere in the file on tag under image, + +00:06:52.240 --> 00:06:54.880 +but I don't know what this tag is for. + +00:06:54.880 --> 00:06:57.240 +But with the help of Tree-sitter, + +00:06:57.240 --> 00:06:59.160 +I've been able to add this information + +00:06:59.160 --> 00:07:00.440 +into my header line. + +00:07:00.440 --> 00:07:02.960 +If you see in the header line, + +00:07:02.960 --> 00:07:05.880 +you'll see that I'm under sentinel.image. + +00:07:05.880 --> 00:07:08.800 +Now let's see how this helps with navigation. + +00:07:08.800 --> 00:07:12.680 +Let's say I want to enable persistence on master node. + +00:07:12.680 --> 00:07:18.200 +So with the help of Tree-sitter, + +00:07:18.200 --> 00:07:20.400 +I was able to enumerate every field + +00:07:20.400 --> 00:07:22.200 +that is available in this YAML file, + +00:07:22.200 --> 00:07:24.520 +and I can pass that information onto imenu, + +00:07:24.520 --> 00:07:28.040 +which I can then use to go to exactly where I want to. + +00:07:28.040 --> 00:07:30.000 +Also, since we're not dealing with + +00:07:30.000 --> 00:07:32.600 +any language specific constructs, + +00:07:32.600 --> 00:07:34.040 +this is very easy to extend to + +00:07:34.040 --> 00:07:35.760 +other similar languages + +00:07:35.760 --> 00:07:37.440 +or config files in this case. + +00:07:37.440 --> 00:07:39.520 +So for example, this is a JSON file, + +00:07:39.520 --> 00:07:44.800 +and I can navigate to location or project. + +00:07:44.800 --> 00:07:48.320 +And just like in YAML, it shows me where I'm at. + +00:07:48.320 --> 00:07:49.920 +I'm in projects.name, + +00:07:49.920 --> 00:07:52.880 +or I'm inside projects.highlights. + +00:07:52.880 --> 00:07:55.600 +Or how about Nix? + +00:07:55.600 --> 00:07:57.480 +This is my home.nix file. + +00:07:57.480 --> 00:08:01.040 +Again, I can search for services, + +00:08:01.040 --> 00:08:04.640 +and this lists me all the services that I've enabled. + +00:08:04.640 --> 00:08:06.720 +How about just services.description? + +00:08:06.720 --> 00:08:08.160 +So this is all the services + +00:08:08.160 --> 00:08:10.480 +that I've enabled and have descriptions. + +00:08:10.480 --> 00:08:12.720 +Now that we have seen this for config files, + +00:08:12.720 --> 00:08:15.040 +let's see how similar things apply for code. + +00:08:15.040 --> 00:08:16.760 +Just like in config files, + +00:08:16.760 --> 00:08:18.680 +I can see which function I'm under, + +00:08:18.680 --> 00:08:21.560 +and if I go to the next function, it changes. + +00:08:21.560 --> 00:08:23.960 +Okay, here is something really awesome. + +00:08:23.960 --> 00:08:26.600 +This is probably one of my favorites, + +00:08:26.600 --> 00:08:30.400 +and one of the things that actually made me understand + +00:08:30.400 --> 00:08:34.080 +how powerful Tree-sitter is, and got me into it. + +00:08:34.080 --> 00:08:35.680 +I work with a lot of Go code, + +00:08:35.680 --> 00:08:38.840 +and anyone who has worked with Go will tell you + +00:08:38.840 --> 00:08:41.040 +how repetitive it is handling errors. + +00:08:41.040 --> 00:08:42.800 +For those who don't write Go, + +00:08:42.800 --> 00:08:45.200 +let me give you a rough idea of what I'm talking about. + +00:08:45.200 --> 00:08:47.000 +If you want to bubble up the error, + +00:08:47.000 --> 00:08:49.920 +the way you would do it is just to return the error + +00:08:49.920 --> 00:08:51.400 +to the function that called it. + +00:08:51.400 --> 00:08:55.720 +Over here, you can either return nil or an empty value, + +00:08:55.720 --> 00:08:57.640 +and at the end, you return error. + +00:08:57.640 --> 00:09:00.200 +Let's try and use Tree-sitter to do this. + +00:09:00.200 --> 00:09:03.120 +Using the help of Tree-sitter, let's make Emacs + +00:09:03.120 --> 00:09:06.421 +go back, figure out what the return arguments are, + +00:09:06.422 --> 00:09:08.240 +figure out what their default values are, + +00:09:08.240 --> 00:09:11.480 +and automatically fill in the return statement. + +00:09:11.480 --> 00:09:13.040 +It would look something like this. + +00:09:13.040 --> 00:09:16.120 +In my case, it filled in the complete form, + +00:09:16.120 --> 00:09:18.320 +it figured out what the return arguments are, + +00:09:18.320 --> 00:09:19.320 +what their types are, + +00:09:19.320 --> 00:09:20.960 +and what their default values are, + +00:09:20.960 --> 00:09:22.800 +and filled out the entire return. + +00:09:22.800 --> 00:09:24.760 +And since this is a template, + +00:09:24.760 --> 00:09:27.720 +I can go to the next function, do the same thing, + +00:09:27.720 --> 00:09:29.560 +next function, do the same thing, + +00:09:29.560 --> 00:09:31.520 +next function, do the same thing. + +00:09:31.520 --> 00:09:34.360 +Here is a really fascinating use case of Tree-sitter, + +00:09:34.360 --> 00:09:36.320 +structural editing. + +00:09:36.320 --> 00:09:38.200 +You might be aware of plugins like paredit, + +00:09:38.200 --> 00:09:40.280 +which seems to "know" your code. + +00:09:40.280 --> 00:09:42.520 +This sort of takes it onto another level. + +00:09:42.520 --> 00:09:46.040 +It is in its early stages, but what this lets you do + +00:09:46.040 --> 00:09:48.920 +is completely treat your code as an AST, + +00:09:48.920 --> 00:09:52.000 +and edit as if it's a tree instead of characters. + +00:09:52.000 --> 00:09:54.640 +I am not going to go much in depth into it, + +00:09:54.640 --> 00:09:57.000 +but if you're interested, there is a talk + +00:09:57.000 --> 00:09:59.080 +from last year's EmacsConf around it. + +00:09:59.080 --> 00:10:02.320 +I'm just going to end this with one last tiny thing + +00:10:02.320 --> 00:10:04.920 +that I found in the tree-sitter-extras package. + +00:10:04.920 --> 00:10:07.600 +It's this tiny macro called tree-sitter-save-excursion. + +00:10:07.600 --> 00:10:11.240 +It works pretty much like save-excursion, but better. + +00:10:11.240 --> 00:10:13.400 +It uses the Tree-sitter syntax tree + +00:10:13.400 --> 00:10:14.800 +instead of just the code + +00:10:14.800 --> 00:10:16.720 +to figure out where to restore the position. + +00:10:16.720 --> 00:10:20.200 +My main use case for this was with code formatters. + +00:10:20.200 --> 00:10:22.080 +Since the code moves around a lot + +00:10:22.080 --> 00:10:23.160 +when it gets formatted, + +00:10:23.160 --> 00:10:25.000 +save-excursion was completely useless, + +00:10:25.000 --> 00:10:26.240 +but this came in handy. + +00:10:26.240 --> 00:10:28.120 +I'll just leave you off with + +00:10:28.120 --> 00:10:31.120 +what the future of Tree-sitter looks like for Emacs. + +00:10:31.120 --> 00:10:33.760 +So far, every Tree-sitter related feature + +00:10:33.760 --> 00:10:36.040 +that I've talked about is powered by this library. + +00:10:36.040 --> 00:10:42.320 +But there is talk about Tree-sitter coming into the core. + +00:10:42.320 --> 00:10:45.840 +It will most probably be landing in Emacs 29, + +00:10:45.840 --> 00:10:48.720 +and if you want to check out the work on Tree-sitter + +00:10:48.720 --> 00:10:51.200 +in core Emacs, you can check out + +00:10:51.200 --> 00:10:52.920 +the features/tree-sitter branch. + +00:10:52.920 --> 00:10:56.640 +You'll probably see more and more features and packages + +00:10:56.640 --> 00:10:59.640 +relying upon Tree-sitter, and even major modes + +00:10:59.640 --> 00:11:01.560 +being powered by Tree-sitter. + +00:11:01.560 --> 00:11:03.880 +And that's a wrap from me. Thank you. diff --git a/2022/captions/emacsconf-2022-wayland--emacs-should-become-a-wayland-compositor--michael-bauer--main.vtt b/2022/captions/emacsconf-2022-wayland--emacs-should-become-a-wayland-compositor--michael-bauer--main.vtt new file mode 100644 index 00000000..34eeb842 --- /dev/null +++ b/2022/captions/emacsconf-2022-wayland--emacs-should-become-a-wayland-compositor--michael-bauer--main.vtt @@ -0,0 +1,471 @@ +WEBVTT captioned by bhavin192 + +NOTE Introduction + +00:00.000 --> 00:08.000 +Hello EmacsConf and hello fellow Emacs fans. + +00:08.000 --> 00:10.920 +My name is Michael Bauer, and I'm from Germany. + +00:10.920 --> 00:00:13.440 +I'm gonna talk to you about "Why and how Emacs + +00:00:13.440 --> 00:00:17.200 +should become a Wayland compositor." + +00:17.200 --> 00:21.740 +And it already kinda is a Wayland compositor. + +00:21.740 --> 00:25.000 +This talk is composed by Wayland and Emacs. + +00:25.000 --> 00:00:26.840 +If I'm talking about a Wayland compositor + +00:00:26.840 --> 00:00:29.360 +or Emacs as Wayland compositor, + +00:00:29.360 --> 00:00:30.440 +I mean it in the sense that + +00:00:30.440 --> 00:00:36.000 +EXWM is an X window manager. I hope you know EXWM. + +NOTE Why + +00:36.000 --> 00:41.000 +So, why? + +00:41.000 --> 00:00:44.120 +Emacs can do Wayland now, that was a stopper + +00:00:44.120 --> 00:00:49.000 +before, and now it's solved with `pgtk` branch. + +00:49.000 --> 00:00:53.240 +It makes the Emacs toolbox bigger, + +00:00:53.240 --> 00:00:55.000 +which is always a good thing. + +00:55.000 --> 00:00:58.440 +And the cool thing about Wayland, which is not + +00:00:58.440 --> 00:01:02.280 +possible under X is, it can run standalone + +00:01:02.280 --> 00:01:06.840 +on the Linux kernel interface, or nested under X, + +00:01:06.840 --> 00:01:07.120 +or even nested under Wayland. + +01:09.000 --> 00:01:13.840 +The compositor features of Emacs doesn't mean + +00:01:13.840 --> 00:01:16.960 +it has to take over the whole output. + +00:01:16.960 --> 00:01:20.560 +It can use them, even if it's just like + +00:01:20.560 --> 00:01:23.080 +a normal window or normal program. + +01:23.000 --> 00:01:25.120 +And last reason is, + +00:01:25.120 --> 00:01:27.240 +I want to keep living inside Emacs + +00:01:27.240 --> 00:01:31.000 +and Wayland is the future, apparently. + +NOTE EXWM use case + +01:31.000 --> 01:35.000 +EXWM use case is the first use case. + +01:35.000 --> 00:01:38.400 +You take a Wayland surface and put it inside + +00:01:38.400 --> 00:01:41.520 +an Emacs window. You see it right below. + +00:01:41.520 --> 00:01:45.880 +The video of me is a Wayland surface, + +00:01:45.880 --> 00:01:50.000 +and it's inside an Emacs window managed by Emacs. + +01:50.000 --> 00:01:53.480 +Emacs does the input, and the clipboard handling, + +00:01:53.480 --> 00:01:59.000 +and can insert itself here, and do great things. + +01:59.000 --> 00:02:03.200 +And it's a possibility to Lispify the Linux desktop, + +00:02:03.200 --> 00:02:08.000 +as Emacs Lispifies the command line. + +NOTE XWidget use case + +02:08.000 --> 00:02:12.960 +The other use case is the XWidget use case. + +00:02:12.960 --> 00:02:17.000 +I don't know if you know XWidgets. + +02:17.000 --> 00:02:19.720 +It's embedded X windows inside Emacs. + +00:02:19.720 --> 00:02:24.000 +There's a web browser available in Emacs. + +02:24.000 --> 00:02:27.520 +With Wayland, you could embed anything that can + +00:02:27.520 --> 00:02:32.000 +create a Wayland surface like video, web, or 3D. + +02:32.000 --> 00:02:34.880 +Think OpenGL, something like + +00:02:34.880 --> 00:02:38.000 +EmacsGL would be possible. + +02:38.000 --> 02:46.000 +And we wouldn't have just images like we have so far. + +NOTE How + +02:46.000 --> 00:02:50.560 +So, how to implement this Wayland compositor? + +00:02:50.560 --> 00:02:52.560 +I'm going to tell you how I did it, + +00:02:52.560 --> 00:02:57.000 +or I did this demo I'm showing you right now. + +02:57.000 --> 00:03:00.680 +First of all, how does Wayland work? + +00:03:00.680 --> 00:03:04.000 +Wayland is a protocol in XML. + +03:04.000 --> 00:03:11.120 +It's a server and client, and they share a set of + +00:03:11.120 --> 00:03:13.960 +objects, and the objects have methods. + +00:03:13.960 --> 00:03:16.120 +They are specified in the protocol, + +00:03:16.120 --> 00:03:24.080 +and Wayland also says how the server + +00:03:24.080 --> 00:03:25.720 +and client talk to each other. + +00:03:25.720 --> 00:03:33.440 +First blocker for Emacs becoming a Wayland + +00:03:33.440 --> 00:03:37.000 +compositor is that Emacs and Wayland both have + +00:03:37.000 --> 00:03:41.880 +their own event loop, and you can't merge them too. + +00:03:41.880 --> 00:03:45.800 +But you don't have to merge them + +00:03:45.800 --> 00:03:48.000 +because you can just make Emacs speak Wayland. + +03:48.000 --> 00:03:50.040 +So, Emacs becomes a Wayland client, + +00:03:50.040 --> 00:03:53.000 +and there's an extra server Emacs is talking to. + +03:53.000 --> 00:03:59.160 +So, we need a minimal Wayland server that does all + +00:03:59.160 --> 00:04:03.000 +the stuff Emacs can't do and do the rest in Emacs. + +04:03.000 --> 00:04:07.800 +---The minimal Wayland server, I did it in wlroots. + +00:04:07.800 --> 00:04:13.040 +That's the library behind Sway. I think it's + +00:04:13.040 --> 00:04:20.000 +the Wayland library to do stuff like this. + +04:20.000 --> 04:26.000 +I implemented four different things to make it work. + +04:26.000 --> 00:04:30.680 +It's these three letter acronyms on the left. + +00:04:30.680 --> 00:04:34.520 +It's Emacs, Wayland, and then it's a server, + +00:04:34.520 --> 00:04:38.000 +a client, a protocol, and buffers. + +04:38.000 --> 04:44.000 +The server is written in C and it's mostly tinywl. + +04:44.000 --> 00:04:46.280 +It's the example of wlroots, + +00:04:46.280 --> 00:04:52.000 +and it's around 1000 lines of code. + +04:52.000 --> 00:04:54.960 +ewc, the Wayland client in Emacs, + +00:04:54.960 --> 00:04:58.560 +is the thing I'm most proud of. + +00:04:58.560 --> 00:05:02.120 +It's 300 lines of code, and it is a + +00:05:02.120 --> 00:05:08.000 +fully featured Wayland client in Emacs. + +05:08.000 --> 00:05:11.640 +With this, Emacs can speak Wayland, + +00:05:11.640 --> 00:05:18.000 +and then I implemented Emacs Wayland protocol. + +05:18.000 --> 00:05:21.280 +It more or less allows Emacs to become a Wayland + +00:05:21.280 --> 00:05:24.640 +window manager, so it's not actually the compositor. + +00:05:24.640 --> 00:05:27.680 +The compositor stays in C, but Emacs is + +00:05:27.680 --> 00:05:31.000 +now a Wayland window manager! + +05:31.000 --> 00:05:34.520 +And the last thing is Emacs Wayland buffers. + +00:05:34.520 --> 00:05:35.880 +It's the window manager part. + +00:05:35.880 --> 00:05:38.440 +It's around 500 lines of code, + +00:05:38.440 --> 00:05:41.680 +and it does the buffer management inside + +00:05:41.680 --> 00:05:45.680 +Emacs windows, or floating right like you see me + +00:05:45.680 --> 00:05:48.000 +now floating on the right. + +05:48.000 --> 00:05:51.000 +It works, but it is still buggy, + +00:05:51.000 --> 00:05:54.320 +and it is also missing input handling, + +00:05:54.320 --> 00:06:01.000 +so there's more code to come for this to work. + +NOTE Caveats + +06:01.000 --> 06:05.000 +Some caveats about this approach. + +06:05.000 --> 00:06:09.640 +wlroots is around 60 kilo LoCs (Line of Code) + +00:06:09.640 --> 00:06:12.000 +and in active development. + +06:12.000 --> 00:06:16.640 +They have like a slogan 60 kilo locs of code + +00:06:16.640 --> 00:06:19.760 +you had to write anyway to make a Wayland + +00:06:19.760 --> 00:06:22.520 +compositor. And no, you don't have to write it. + +00:06:22.520 --> 00:06:25.840 +But I still remember when it was like 50 kilo locs, + +00:06:25.840 --> 00:06:29.680 +and now it's 60. And it's like a moving target. + +00:06:29.680 --> 00:06:32.480 +I think it could be quite a lot of work + +00:06:32.480 --> 00:06:34.000 +to keep up with it. + +06:34.000 --> 06:41.000 +Yeah, it could be quite a bit of work. + +06:41.000 --> 06:46.000 +Some windows don't like to keep the aspect ratios. + +06:46.000 --> 00:06:49.560 +You tell them and you have to crop them. + +00:06:49.560 --> 00:06:53.000 +And the interface I use in wlroots for doing this, + +06:53.000 --> 00:06:57.280 +`wlr_scene`, can't do cropping yet, + +00:06:57.280 --> 00:07:01.000 +so this doesn't work. + +07:01.000 --> 00:07:03.240 +Another problem is with GTK. + +00:07:03.240 --> 00:07:03.280 +Once Wayland is enabled and it stays on. + +07:11.000 --> 00:07:12.560 +This doesn't make sense. + +00:07:12.560 --> 00:07:15.000 +Okay, if you kill the Wayland server, + +00:07:15.000 --> 00:07:18.000 +GTK kills Emacs, that's not a good thing. + +07:18.000 --> 00:07:21.000 +And it's still a bit of work and fussing needed + +00:07:21.000 --> 00:07:23.640 +to get this to work reliably. + +00:07:23.640 --> 00:07:26.000 +It's quite buggy right now. + +NOTE Call to action + +07:26.000 --> 07:30.000 +And that brings me to my call to action. + +07:30.000 --> 00:07:34.440 +I think making Emacs Wayland capable is + +00:07:34.440 --> 00:07:39.000 +a further step to make an Emacs OS. + +07:39.000 --> 00:07:41.360 +It gains output and input handling. + +00:07:41.360 --> 00:07:44.120 +Output handling is already there, + +00:07:44.120 --> 00:07:45.760 +input handling is still missing, + +00:07:45.760 --> 00:07:49.720 +but Emacs can manage monitors, outputs, + +00:07:49.720 --> 00:07:53.040 +different frames if it's like nested, + +00:07:53.040 --> 00:07:57.080 +And inputs, keyboards, simulation keys, + +00:07:57.080 --> 00:07:58.000 +stuff like that. + +07:58.000 --> 08:02.000 +We could use it in more ways for Emacs display, maybe. + +08:02.000 --> 00:08:05.720 +Wayland just manages simple pixel buffers, + +00:08:05.720 --> 00:08:09.000 +so it's a protocol for managing pixel buffers. + +08:09.000 --> 00:08:12.560 +And in a sense, we could go back to + +00:08:12.560 --> 00:08:15.560 +the old X ways and maybe even ditch GTK. + +00:08:15.560 --> 00:08:18.000 +I don't know, but why need it? + +08:18.000 --> 00:08:20.600 +We can composite without it. + +00:08:20.600 --> 00:08:27.000 +Let's make buffer menus, buffer world, buffer. + +08:27.000 --> 00:08:29.040 +Emacs Wayland protocol, like I did it, + +00:08:29.040 --> 00:08:34.040 +allows a very concise design, and it allows + +00:08:34.040 --> 00:08:38.000 +to improve on the EXWM code base. + +08:38.000 --> 00:08:41.840 +And I wrote KISS style because EXWM has + +00:08:41.840 --> 00:08:45.000 +workspace management integrated. + +08:45.000 --> 00:08:50.600 +I don't think that's needed, like Emacs does it. + +00:08:50.600 --> 00:08:53.640 +Why do you have to do something extra? + +00:08:53.640 --> 00:08:56.000 +So why do it? + +08:56.000 --> 00:09:00.040 +To finish the call to action, + +00:09:00.040 --> 00:09:03.280 +if this is the thing you want to see in Emacs, + +00:09:03.280 --> 00:09:06.600 +maybe you want to get involved, have some ideas, + +00:09:06.600 --> 00:09:10.000 +so we could discuss it. + +09:10.000 --> 00:09:14.960 +I'm looking forward to discuss with you + +00:09:14.960 --> 00:09:21.000 +and hear your questions and ideas. + +09:21.000 --> 00:09:24.200 +I want to say a big thank you to the + +00:09:24.200 --> 00:09:26.600 +organizers of EmacsConf and the other speakers + +00:09:26.600 --> 00:09:29.000 +for making this event possible. + +09:29.000 --> 09:39.000 +Thank you, and see you. |