From c726222fe29d64ab4550f2e197b5b3ab8728789f Mon Sep 17 00:00:00 2001 From: Sacha Chua Date: Sun, 4 Dec 2022 13:51:05 -0500 Subject: Automated commit --- ...or-developers--george-mauer--main--chapters.vtt | 77 ++ ...orkflows-for-developers--george-mauer--main.vtt | 1309 ++++++++++++++++++++ 2 files changed, 1386 insertions(+) create mode 100644 2022/captions/emacsconf-2022-workflows--org-workflows-for-developers--george-mauer--main--chapters.vtt create mode 100644 2022/captions/emacsconf-2022-workflows--org-workflows-for-developers--george-mauer--main.vtt (limited to '2022/captions') diff --git a/2022/captions/emacsconf-2022-workflows--org-workflows-for-developers--george-mauer--main--chapters.vtt b/2022/captions/emacsconf-2022-workflows--org-workflows-for-developers--george-mauer--main--chapters.vtt new file mode 100644 index 00000000..d3302b79 --- /dev/null +++ b/2022/captions/emacsconf-2022-workflows--org-workflows-for-developers--george-mauer--main--chapters.vtt @@ -0,0 +1,77 @@ +WEBVTT + +1 +00:00:00.000 --> 00:00:53.960 +Introduction + +21 +00:00:53.960 --> 00:02:30.200 +The future + +60 +00:02:30.200 --> 00:03:15.680 +Org development workflows + +78 +00:03:15.680 --> 00:04:54.600 +Taking notes + +109 +00:04:54.600 --> 00:06:10.680 +org-capture templates + +132 +00:06:10.680 --> 00:06:49.160 +Building up a dashboard + +146 +00:06:49.160 --> 00:07:45.680 +org-store-links + +164 +00:07:45.680 --> 00:08:21.480 +Formatting + +174 +00:08:21.480 --> 00:08:52.200 +Pasting code + +184 +00:08:52.200 --> 00:10:04.960 +Git + +202 +00:10:04.960 --> 00:11:29.040 +async-shell-command + +226 +00:11:29.040 --> 00:13:47.840 +Literate programming and tangling + +272 +00:13:47.840 --> 00:14:36.400 +Noweb + +290 +00:14:36.400 --> 00:16:04.480 +Running commands + +316 +00:16:04.480 --> 00:16:43.600 +Buttons + +327 +00:16:43.600 --> 00:18:04.800 +Workspaces + +353 +00:18:04.800 --> 00:18:36.000 +dash + +366 +00:18:36.000 --> 00:19:29.920 +Header arguments + +386 +00:19:29.920 --> 00:20:26.920 +Conclusion diff --git a/2022/captions/emacsconf-2022-workflows--org-workflows-for-developers--george-mauer--main.vtt b/2022/captions/emacsconf-2022-workflows--org-workflows-for-developers--george-mauer--main.vtt new file mode 100644 index 00000000..58d88b2f --- /dev/null +++ b/2022/captions/emacsconf-2022-workflows--org-workflows-for-developers--george-mauer--main.vtt @@ -0,0 +1,1309 @@ +WEBVTT captioned by bhavin192 + +00:00:00.000 --> 00:00:04.600 +Hello. Welcome to my first ever EmacsConf talk. + +00:00:04.600 --> 00:00:06.360 +This is really exciting for me. + +00:00:06.360 --> 00:00:08.600 +I've done lots of conferences, + +00:00:08.600 --> 00:00:12.800 +but rarely ones this technical and this nerdy. + +00:00:12.800 --> 00:00:13.508 +I also feel like + +00:00:13.508 --> 00:00:15.040 +I have something interesting to share. + +00:00:15.040 --> 00:00:18.680 +I come to Emacs relatively late in my career, + +00:00:18.680 --> 00:00:20.920 +only about six years ago, + +00:00:20.920 --> 00:00:22.880 +but I've been absolutely amazed + +00:00:22.880 --> 00:00:25.800 +at the innovation and commitment of the community + +00:00:25.800 --> 00:00:28.200 +to do things their own way. + +00:00:28.200 --> 00:00:30.120 +Oftentimes, these become things + +00:00:30.120 --> 00:00:33.880 +that are not readily available anywhere else. + +00:00:33.880 --> 00:00:35.307 +So, as I've been using Emacs + +00:00:35.307 --> 00:00:37.160 +(and Org mode specifically) + +00:00:37.160 --> 00:00:39.600 +a great deal in my day-to-day workflows, + +00:00:39.600 --> 00:00:41.520 +I've been leaning more and more into + +00:00:41.520 --> 00:00:43.607 +some of these tips and tricks. + +00:00:43.607 --> 00:00:46.680 +I find that there is almost every day + +00:00:46.680 --> 00:00:48.120 +that I discover some useful tweak + +00:00:48.120 --> 00:00:50.760 +that can make my development better. + +00:00:50.760 --> 00:00:53.960 +I want to share them with you now. + +00:00:53.960 --> 00:00:54.874 +[Future George]: Hey, hold on! + +00:00:54.874 --> 00:00:56.200 +Who are you? + +00:00:56.200 --> 00:01:00.400 +[Future George]: I'm you from the future! + +00:01:00.400 --> 00:01:02.480 +Oh, nice. How good. + +00:01:02.480 --> 00:01:05.240 +No, I'm you from, like, a month from now. + +00:01:05.240 --> 00:01:08.440 +Look, you know how these talks are pre-recorded, + +00:01:08.440 --> 00:01:10.760 +and you know how you've spent the last two years + +00:01:10.760 --> 00:01:12.400 +criticizing conference speakers + +00:01:12.400 --> 00:01:14.000 +for trying to do the same old thing + +00:01:14.000 --> 00:01:15.120 +and not creatively adapting + +00:01:15.120 --> 00:01:17.440 +to the online conference medium? + +00:01:17.440 --> 00:01:20.520 +Well, you are recording this back in November. + +00:01:20.520 --> 00:01:23.160 +I'm in December when everyone is watching this + +00:01:23.160 --> 00:01:24.720 +for the first time. + +00:01:24.720 --> 00:01:27.120 +That is something we can do now. + +00:01:27.120 --> 00:01:29.640 +[George]: Okay, so this is a gimmick. + +00:01:29.640 --> 00:01:32.880 +Cool! And I see you still haven't figured out + +00:01:32.880 --> 00:01:35.440 +how to remove backgrounds with OBS. + +00:01:35.440 --> 00:01:37.240 +[Future George]: Oh my god! It's such a pain, + +00:01:37.240 --> 00:01:40.360 +I have to get a plugin or something. + +00:01:40.360 --> 00:01:42.760 +So, yes, it's kind of a gimmick, + +00:01:42.760 --> 00:01:44.920 +but I also have a cool point. + +00:01:44.920 --> 00:01:46.200 +You know, how you just said + +00:01:46.200 --> 00:01:48.840 +that you discover something new every day? + +00:01:48.840 --> 00:01:49.920 +Well, your talk isn't that long, + +00:01:49.920 --> 00:01:52.720 +and I found a bunch of cool new workflow synths. + +00:01:52.720 --> 00:01:55.920 +[George]: Oh, okay, that makes sense. + +00:01:55.920 --> 00:01:58.360 +I'm starting a new job in the intervening time. + +00:01:58.360 --> 00:01:59.720 +[Future George]: Exactly! + +00:01:59.720 --> 00:02:02.440 +So, I have more stuff I want to add. + +00:02:02.440 --> 00:02:03.740 +[George]: Oh, and I bet that + +00:02:03.740 --> 00:02:05.960 +once we set the ground rules, + +00:02:05.960 --> 00:02:07.136 +the audience might have + +00:02:07.136 --> 00:02:08.960 +some of their own suggestions. + +00:02:08.960 --> 00:02:11.160 +That is a good idea. + +00:02:11.160 --> 00:02:11.960 +Okay, go away now. + +00:02:11.960 --> 00:02:13.574 +[Future George]: Fine, but + +00:02:13.574 --> 00:02:15.240 +aren't you gonna explain the dino? + +00:02:15.240 --> 00:02:18.800 +[George]: This is EmacsConf, dude. + +00:02:18.800 --> 00:02:20.320 +You think a dinosaur built out of + +00:02:20.320 --> 00:02:22.160 +boxes and old dishwasher parts + +00:02:22.160 --> 00:02:24.207 +is the weirdest background thing we'll see? + +00:02:24.207 --> 00:02:27.880 +[Both making dinosaur roaring sound: ROAAAAR!] + +00:02:27.880 --> 00:02:30.200 +Okay, bye now. + +00:02:30.200 --> 00:02:33.160 +Hey everyone, you heard the idea. + +00:02:33.160 --> 00:02:35.000 +This is going to be a thinly-veiled attempt + +00:02:35.000 --> 00:02:36.940 +to show you stuff about + +00:02:36.940 --> 00:02:38.760 +Emacs and Org mode, specifically, + +00:02:38.760 --> 00:02:41.560 +that I think is super cool and immediately useful + +00:02:41.560 --> 00:02:43.600 +while you're doing development. + +00:02:43.600 --> 00:02:46.720 +Let's define the scope of Org development workflow + +00:02:46.720 --> 00:02:49.000 +as something specific you do with Org mode + +00:02:49.000 --> 00:02:50.800 +that helps in certain common + +00:02:50.800 --> 00:02:52.880 +development related activities. + +00:02:52.880 --> 00:02:54.560 +Now, tie-dye me from the future said + +00:02:54.560 --> 00:02:56.960 +he's got some more ideas + +00:02:56.960 --> 00:02:58.840 +beyond what I'm presenting here. + +00:02:58.840 --> 00:03:01.960 +I'm sure many of you have ideas as well. + +00:03:01.960 --> 00:03:07.960 +So, we're going to share a collaborative document, + +00:03:07.960 --> 00:03:10.120 +and let's all as we're listening to this + +00:03:10.120 --> 00:03:11.440 +be talking, and chatting, and entering + +00:03:11.440 --> 00:03:13.240 +our own ideas and workflows, + +00:03:13.240 --> 00:03:15.680 +so that we can learn and improve together. + +00:03:15.680 --> 00:03:17.960 +And now with that, let's begin. + +00:03:17.960 --> 00:03:20.280 +I've got a ton of ground to cover, + +00:03:20.280 --> 00:03:23.480 +and I want to start by talking about note-taking. + +00:03:23.480 --> 00:03:25.720 +Shrink down! [transition] + +00:03:25.720 --> 00:03:30.074 +Note-taking is incredibly important. + +00:03:30.074 --> 00:03:33.600 +We can't keep all this stuff in our heads. + +00:03:33.600 --> 00:03:36.640 +So, for example, I find myself with + +00:03:36.640 --> 00:03:41.760 +the need to learn about the solid project. + +00:03:41.760 --> 00:03:44.520 +This right here is the solid project, + +00:03:44.520 --> 00:03:47.320 +and I want to play around with it. + +00:03:47.320 --> 00:03:50.920 +I am going to start by creating a note for it. + +00:03:50.920 --> 00:03:53.360 +Now, one of the things that I want to do + +00:03:53.360 --> 00:03:57.240 +is explore one of their tutorials. + +00:03:57.240 --> 00:03:58.960 +That's the site I just saw. + +00:03:58.960 --> 00:04:03.720 +I can go ahead and create a note for myself. + +00:04:03.720 --> 00:04:10.280 +Right, "Solid React Example", + +00:04:10.280 --> 00:04:12.120 +and maybe a set of stuff ending on there. + +00:04:12.120 --> 00:04:14.240 +I'm going to clone this project, + +00:04:14.240 --> 00:04:15.720 +which I've already done, + +00:04:15.720 --> 00:04:18.360 +and I can pull it up right here. + +00:04:18.360 --> 00:04:22.280 +So, I can pull it up right here, + +00:04:22.280 --> 00:04:24.440 +and I can now start to explore it. + +00:04:24.440 --> 00:04:26.440 +So, for example, this code base sounds…, + +00:04:26.440 --> 00:04:27.080 +it seems interesting. + +00:04:27.080 --> 00:04:28.996 +I'm going to want to + +00:04:28.996 --> 00:04:31.520 +store a link to this in my code. + +00:04:31.520 --> 00:04:34.840 +I'm going to run `org-store-link`, + +00:04:34.840 --> 00:04:37.960 +and I can come in here and say, + +00:04:37.960 --> 00:04:48.280 +let's explore structure. Local link, + +00:04:48.280 --> 00:04:50.640 +and here I'm going to put that right there. + +00:04:50.640 --> 00:04:52.960 +Now, at any given time I can come into this note + +00:04:52.960 --> 00:04:54.600 +and be thrown right into the structure. + +00:04:54.600 --> 00:04:58.880 +I want to go and now start investigating the code, + +00:04:58.880 --> 00:05:02.474 +but before doing that + +00:05:02.474 --> 00:05:08.280 +I'm going to take an extra step + +00:05:08.280 --> 00:05:13.560 +and customize the Org capture system. + +00:05:13.560 --> 00:05:16.297 +I'm going to create a playground node here, + +00:05:16.297 --> 00:05:17.320 +where I can do whatever. + +00:05:17.320 --> 00:05:20.680 +Now, what does this template do? + +00:05:20.680 --> 00:05:22.960 +Well, it's just going to create a new template. + +00:05:22.960 --> 00:05:24.640 +And whenever I hit the s key, + +00:05:24.640 --> 00:05:31.680 +it is going to go ahead and add a new heading + +00:05:31.680 --> 00:05:36.280 +to which I will enter, + +00:05:36.280 --> 00:05:38.326 +and it's going to grab a link + +00:05:38.326 --> 00:05:39.720 +to wherever I'm pointing at, + +00:05:39.720 --> 00:05:41.760 +and any highlighted code + +00:05:41.760 --> 00:05:44.560 +will also be inserted into a source block, + +00:05:44.560 --> 00:05:49.407 +and eventually, drop my cursor + +00:05:49.407 --> 00:05:52.107 +where I can work on it. + +00:05:52.107 --> 00:05:55.000 +So, we can grab our template, + +00:05:55.000 --> 00:05:57.400 +and the one thing I'm going to need to add it here + +00:05:57.400 --> 00:05:59.360 +is to say what file this goes to. + +00:05:59.360 --> 00:06:03.760 +I'm going to copy the name of this file, + +00:06:03.760 --> 00:06:08.040 +and put it right in there. + +00:06:08.040 --> 00:06:10.680 +I'm going to go ahead now run this template. + +00:06:10.680 --> 00:06:14.400 +Now, we can explore our code. + +00:06:14.400 --> 00:06:16.440 +For example, I can look in the server, + +00:06:16.440 --> 00:06:18.400 +and say, "Oh yeah, this slide looks interesting. + +00:06:18.400 --> 00:06:21.040 +Go ahead and capture that." + +00:06:21.040 --> 00:06:23.800 +There you see our template. + +00:06:23.800 --> 00:06:26.000 +You see, yeah, this is Next.js app, + +00:06:26.000 --> 00:06:29.320 +and you can see it got added right in here + +00:06:29.320 --> 00:06:33.080 +right next to my other code. + +00:06:33.080 --> 00:06:34.640 +So, that's interesting. + +00:06:34.640 --> 00:06:36.920 +I can always go ahead and click that link, + +00:06:36.920 --> 00:06:40.560 +and get thrown directly to where in the code I was. + +00:06:40.560 --> 00:06:43.240 +I'm kind of building up my own dashboard + +00:06:43.240 --> 00:06:45.040 +as I explore this project + +00:06:45.040 --> 00:06:49.160 +of interesting points within the project. + +00:06:49.160 --> 00:06:52.440 +One of the things I noticed here + +00:06:52.440 --> 00:06:57.440 +by looking at the file structure is that + +00:06:57.440 --> 00:07:02.040 +there is an area for certificates. + +00:07:02.040 --> 00:07:05.625 +That's a little unusual, so we'll make a note + +00:07:05.625 --> 00:07:08.007 +of that by again running `org-store-link`. + +00:07:08.007 --> 00:07:12.707 +This comes with certificates, + +00:07:12.707 --> 00:07:18.007 +so we'll put that there. + +00:07:18.007 --> 00:07:21.607 +One of the good standbys is, + +00:07:21.607 --> 00:07:23.540 +just to use our regular shell commands. + +00:07:23.540 --> 00:07:26.774 +So, we will go ahead and say, + +00:07:26.774 --> 00:07:29.807 +the default directory for this is our project. + +00:07:29.807 --> 00:07:31.640 +And we can go ahead and say, + +00:07:31.640 --> 00:07:38.520 +`cat certificates/localhost.key`, + +00:07:38.520 --> 00:07:43.760 +and then we'll output the first five lines of it, + +00:07:43.760 --> 00:07:45.848 +just to make sure it's a regular certificate. + +00:07:45.848 --> 00:07:49.360 +Now, notice this got broken up a little bit. + +00:07:49.360 --> 00:07:51.720 +This is due to Emacs auto formatting. + +00:07:51.720 --> 00:07:55.866 +We can come in here, and tell it to + +00:07:55.866 --> 00:07:57.400 +format it as code, + +00:07:57.400 --> 00:07:59.880 +which will be the same as this block right here. + +00:07:59.880 --> 00:08:02.320 +Now, there are other options available. + +00:08:02.320 --> 00:08:05.453 +If, for example, we don't want [it] + +00:08:05.453 --> 00:08:06.480 +to be a shell block, + +00:08:06.480 --> 00:08:09.560 +we wanted a Python block for some reason, + +00:08:09.560 --> 00:08:15.320 +we do `:wrap src python`, and execute that, + +00:08:15.320 --> 00:08:18.440 +and it's now wrapped as a Python block, + +00:08:18.440 --> 00:08:21.480 +but I like it as a shell. + +00:08:21.480 --> 00:08:24.240 +Let's, for example, go down into pages here + +00:08:24.240 --> 00:08:25.800 +and look at this document file. + +00:08:25.800 --> 00:08:29.160 +We're saying, "Okay. Well, this looks interesting + +00:08:29.160 --> 00:08:32.474 +maybe highlight that," and we'll go ahead + +00:08:32.474 --> 00:08:36.240 +and capture that template + +00:08:36.240 --> 00:08:39.400 +and say, grab all this code and paste it in here. + +00:08:39.400 --> 00:08:42.440 +Now, there is a bug at the moment, + +00:08:42.440 --> 00:08:46.280 +where if you highlight more than one lines of code, + +00:08:46.280 --> 00:08:50.760 +the link will not work, and that honestly + +00:08:50.760 --> 00:08:54.540 +might be something I look into fixing. + +00:08:54.540 --> 00:08:57.507 +One of the things that might be useful here + +00:08:57.507 --> 00:08:59.274 +would be to check out + +00:08:59.274 --> 00:09:02.107 +how this file has evolved over time. + +00:09:02.107 --> 00:09:05.340 +To do that, I'm going to use Magit. + +00:09:05.340 --> 00:09:09.640 +I'll pull up a log. + +00:09:09.640 --> 00:09:11.400 +Look, there's only a single change. + +00:09:11.400 --> 00:09:13.040 +I'm going to run a command + +00:09:13.040 --> 00:09:16.840 +called `orgit-store-link`, + +00:09:16.840 --> 00:09:22.174 +and now I can come in here and say, + +00:09:22.174 --> 00:09:26.207 +"It's only changed once." + +00:09:26.207 --> 00:09:30.274 +Go ahead and insert that link. + +00:09:30.507 --> 00:09:33.340 +Now, this file… + +00:09:33.340 --> 00:09:32.960 +the arguments here are kind of weird, + +00:09:35.800 --> 00:09:38.520 +and in fact, if I click this, + +00:09:38.520 --> 00:09:42.040 +it will actually go to the full log of that branch. + +00:09:42.040 --> 00:09:45.760 +However, we can fix that pretty easily. + +00:09:45.760 --> 00:09:49.120 +Grab the path of our file, + +00:09:49.120 --> 00:09:53.874 +and this right here is really just the arguments + +00:09:53.874 --> 00:09:56.280 +that are passed into the log command. + +00:09:56.280 --> 00:09:58.880 +So, here we go, we put that in there, + +00:09:58.880 --> 00:10:04.960 +and there we go. We get the full file history. + +00:10:04.960 --> 00:10:09.280 +Now, I want to actually build the program. + +00:10:09.280 --> 00:10:16.520 +So, "Build the app." + +00:10:16.520 --> 00:10:18.800 +Now, I could of course run it as a shell, right. + +00:10:18.800 --> 00:10:22.560 +`npm ci`. The problem with that is that + +00:10:22.560 --> 00:10:26.400 +Emacs is single-threaded. So, if I were to do that, + +00:10:26.400 --> 00:10:30.400 +the entire time while it was running, + +00:10:30.400 --> 00:10:33.120 +it would be locking out my Emacs. + +00:10:33.120 --> 00:10:35.740 +Additionally, I might not actually want + +00:10:35.740 --> 00:10:38.707 +all that scroll--`npm ci` produces a lot of it-- + +00:10:38.707 --> 00:10:40.080 +actually in my document. + +00:10:40.080 --> 00:10:43.840 +So instead, what we could do is + +00:10:43.840 --> 00:10:46.800 +use an Emacs Lisp function, + +00:10:46.800 --> 00:10:49.640 +and it's called `async-shell-command`. + +00:10:49.640 --> 00:10:52.880 +And when you run something in async-shell-command, + +00:10:52.880 --> 00:10:58.007 +it's going to a comint buffer with a process + +00:10:58.007 --> 00:11:00.107 +attached to it, and run it in there. + +00:11:00.107 --> 00:11:04.907 +I will need to set the directory here first, + +00:11:04.907 --> 00:11:07.560 +and since, again, this is going to be + +00:11:07.560 --> 00:11:08.960 +opening up in a new buffer. + +00:11:08.960 --> 00:11:09.960 +I don't need to see that. + +00:11:09.960 --> 00:11:11.407 +I'm going to run it. + +00:11:11.407 --> 00:11:13.680 +And what's going to happen is + +00:11:13.680 --> 00:11:17.120 +this is actually not going to work. + +00:11:17.120 --> 00:11:18.160 +And it doesn't work, + +00:11:18.160 --> 00:11:20.320 +Not for any particular reason I can control. + +00:11:20.320 --> 00:11:24.880 +It's unfortunately that the repo is broken, + +00:11:24.880 --> 00:11:26.307 +but that is a totally valid + +00:11:26.307 --> 00:11:29.040 +result of our investigation. + +00:11:29.040 --> 00:11:33.107 +One of the things that I really love + +00:11:33.107 --> 00:11:37.640 +to do with Org mode is to actually use it for + +00:11:37.640 --> 00:11:38.240 +literate programming, + +00:11:38.240 --> 00:11:43.080 +because Org mode has a pretty capable + +00:11:43.080 --> 00:11:46.000 +code generation facility built into it. + +00:11:46.000 --> 00:11:47.440 +It's called tangling. + +00:11:47.440 --> 00:11:51.720 +So, if I go ahead and take my document... + +00:11:51.720 --> 00:11:54.107 +This is for a little Arduino project, + +00:11:54.107 --> 00:11:56.907 +where I was figuring out to spin things around + +00:11:56.907 --> 00:12:00.074 +using an old Roomba motor. + +00:12:00.074 --> 00:12:05.280 +I can go ahead and write a script like this, + +00:12:05.280 --> 00:12:09.400 +and then notice, I use the tangle variable + +00:12:09.400 --> 00:12:11.520 +that is just going to determine + +00:12:11.520 --> 00:12:13.560 +where that file gets written + +00:12:13.560 --> 00:12:17.680 +when we call the command `org-babel-tangle`. + +00:12:17.680 --> 00:12:20.080 +So, if I go ahead and run this, + +00:12:20.080 --> 00:12:21.800 +you can see down in the minibuffer, + +00:12:21.800 --> 00:12:23.040 +it's going to write to + +00:12:23.040 --> 00:12:26.707 +`/tmp/go-batsy-playground/go-batsy-playground.ino`. + +00:12:26.707 --> 00:12:27.840 +That's where this right here would write, + +00:12:29.240 --> 00:12:33.480 +and then I could run commands on it. + +00:12:33.480 --> 00:12:36.574 +Then I want to start being able to use this + +00:12:36.574 --> 00:12:38.600 +to build out a program. + +00:12:38.600 --> 00:12:42.000 +I'm going ahead and writing in prose + +00:12:42.000 --> 00:12:43.440 +and interspersing it with code. + +00:12:43.440 --> 00:12:47.160 +So, it's the inverse of code, + +00:12:47.160 --> 00:12:49.374 +in which you intersperse comments, [here] + +00:12:49.374 --> 00:12:51.640 +you write prose, and then you intersperse code + +00:12:51.640 --> 00:12:54.920 +where as needed. + +00:12:54.920 --> 00:12:58.120 +Tangle is implicitly defined up at the higher level + +00:12:58.120 --> 00:12:59.640 +in this property block right here, + +00:12:59.640 --> 00:13:02.600 +which I will talk about in a little bit. + +00:13:02.600 --> 00:13:04.720 +But if you want to see what properties + +00:13:04.720 --> 00:13:07.400 +are available at any given time, + +00:13:07.400 --> 00:13:10.140 +you can hit `org-babel-view-src-block-info` + +00:13:10.140 --> 00:13:14.274 +right there, and you can see that tangle is enabled. + +00:13:14.274 --> 00:13:16.440 +All of these blocks have the exact same tangle. + +00:13:16.440 --> 00:13:20.800 +If I run and see what it is, it's just going to + +00:13:20.800 --> 00:13:23.680 +write to this directory to `go-batsy.ino`. + +00:13:23.680 --> 00:13:28.920 +`org-babel-tangle` is going to go ahead + +00:13:28.920 --> 00:13:30.640 +and tangle all these source code blocks, + +00:13:30.640 --> 00:13:33.174 +and I can go ahead and look at my file + +00:13:33.174 --> 00:13:34.440 +and here it is. + +00:13:34.440 --> 00:13:36.240 +This is the full Arduino file + +00:13:36.240 --> 00:13:37.360 +that was generated from there. + +00:13:37.360 --> 00:13:40.807 +I start writing code here, + +00:13:40.807 --> 00:13:43.320 +and I'm basically doing it in a prose way. + +00:13:43.320 --> 00:13:44.640 +As I'm thinking about it, + +00:13:44.640 --> 00:13:46.080 +I write down what I'm going to do. + +00:13:46.080 --> 00:13:49.240 +Now these braces, we haven't seen these before. + +00:13:49.240 --> 00:13:50.440 +This is an aspect of Org called `noweb`, + +00:13:52.680 --> 00:13:55.374 +which again is not too much of a + +00:13:55.374 --> 00:13:56.400 +templating system too. + +00:13:56.400 --> 00:13:58.960 +But it does one thing, which is insert code, + +00:13:58.960 --> 00:14:00.200 +which turns out to be enough. + +00:14:00.200 --> 00:14:03.640 +So, this right here basically says, + +00:14:03.640 --> 00:14:08.507 +take that block with that exact name + +00:14:08.507 --> 00:14:09.960 +and just insert here. + +00:14:09.960 --> 00:14:13.760 +If you want to see exactly what a block expands to, + +00:14:13.760 --> 00:14:15.160 +you're going to come in here. + +00:14:15.160 --> 00:14:18.320 +You're going to run `org-babel-expand-src-block`, + +00:14:18.320 --> 00:14:21.000 +and there we go. That's what this block expands to. + +00:14:21.000 --> 00:14:22.080 +That's what all those places + +00:14:22.080 --> 00:14:24.807 +of this little bits and pieces expand to. + +00:14:24.807 --> 00:14:26.120 +So, that becomes really useful, and notice + +00:14:28.120 --> 00:14:29.960 +basically we just take these little blocks + +00:14:29.960 --> 00:14:32.520 +that are not going to be tangled directly + +00:14:32.520 --> 00:14:33.920 +but it will be in this other block. + +00:14:33.920 --> 00:14:38.074 +And we turn off their tangling. + +00:14:38.074 --> 00:14:40.680 +Now that you have some sort of tangling, + +00:14:40.680 --> 00:14:42.880 +you want to be able to interact with those files + +00:14:42.880 --> 00:14:46.707 +that are written to that directory. + +00:14:46.707 --> 00:14:48.960 +So, right here I have an area + +00:14:48.960 --> 00:14:52.760 +where I can do things like run a compiler. + +00:14:52.760 --> 00:14:55.160 +Now what does that compiler do? + +00:14:55.160 --> 00:14:57.840 +Well, this right here references + +00:14:57.841 --> 00:15:01.874 +a source code block that appears in another Org file. + +00:15:01.874 --> 00:15:04.520 +And I find that when doing these sort of things + +00:15:04.520 --> 00:15:06.007 +it can be useful to have a little + +00:15:06.007 --> 00:15:08.000 +utility Org directory. + +00:15:08.000 --> 00:15:10.374 +So, here it is, `org/ci.org`. + +00:15:10.374 --> 00:15:11.640 +This is just part of my repo. + +00:15:11.640 --> 00:15:14.140 +We open up, and here we go. + +00:15:14.140 --> 00:15:15.200 +I have a compile function. + +00:15:15.200 --> 00:15:18.360 +Basically, it's doing some stuff + +00:15:18.360 --> 00:15:20.480 +to clean up things correctly. + +00:15:20.480 --> 00:15:23.520 +But then using that same `async-shell-command` + +00:15:23.520 --> 00:15:26.280 +to open things up and a new buffer. + +00:15:26.280 --> 00:15:28.674 +In this case, named after + +00:15:28.674 --> 00:15:31.200 +whatever heading it was under. + +00:15:31.200 --> 00:15:35.160 +And then we're going to go ahead and inside of it + +00:15:35.160 --> 00:15:39.874 +run Arduino CLI command to compile, + +00:15:39.874 --> 00:15:43.560 +and pass that into `watchexec`. + +00:15:43.560 --> 00:15:46.120 +which is a little Rust program + +00:15:46.120 --> 00:15:49.520 +that watches inode[??] files for any changes, + +00:15:49.520 --> 00:15:51.240 +and when they detect them, we will run this. + +00:15:51.240 --> 00:15:56.160 +If I were to, for example, add a line here, + +00:15:56.160 --> 00:15:59.360 +and now run `org-babel-tangle`, + +00:15:59.360 --> 00:16:02.400 +you can see watchexec immediately + +00:16:02.400 --> 00:16:04.480 +picks it up and restarts it. + +00:16:04.480 --> 00:16:07.474 +Now it's kind of a pain to remember + +00:16:07.475 --> 00:16:09.680 +to run `org-babel-tangle` all the time. + +00:16:09.680 --> 00:16:13.807 +So, I can come here and click this button. + +00:16:13.807 --> 00:16:17.040 +It asks me to execute it there. + +00:16:17.040 --> 00:16:18.280 +And what does that do? + +00:16:18.280 --> 00:16:23.280 +Here you go. It's just a very simple hyperlink, + +00:16:23.280 --> 00:16:25.600 +but to the Elisp protocol. + +00:16:25.600 --> 00:16:30.600 +The Elisp protocol just adds a hook that says, + +00:16:30.600 --> 00:16:35.107 +whenever a document is saved, run `org-babel-tangle`. + +00:16:35.107 --> 00:16:37.600 +And now that I've run that, I can go ahead, + +00:16:37.600 --> 00:16:39.307 +come in here, and delete that. + +00:16:39.307 --> 00:16:42.340 +And look at that. It tangles automatically for me. + +00:16:42.340 --> 00:16:45.040 +Because I don't want to actually have this + +00:16:45.040 --> 00:16:49.480 +playground script tangle to my real file, + +00:16:49.480 --> 00:16:51.440 +I need this concept of + +00:16:51.440 --> 00:16:52.760 +some sort of workspace directory. + +00:16:52.760 --> 00:16:54.880 +And a workspace directory + +00:16:54.880 --> 00:16:58.280 +what I really want is a variable that is tied to + +00:16:58.280 --> 00:17:02.674 +where in my document hierarchy this appears. + +00:17:02.674 --> 00:17:06.680 +I want a dynamically scoped variable + +00:17:06.680 --> 00:17:08.240 +that's scoped to my document. + +00:17:08.240 --> 00:17:12.560 +And you can do that. For example, in this case, + +00:17:12.560 --> 00:17:15.280 +I have in my properties + +00:17:15.280 --> 00:17:20.080 +a key value declared `workspace-directory`, + +00:17:20.080 --> 00:17:22.080 +[it] goes into a temp directory. + +00:17:22.080 --> 00:17:24.480 +And here, by running `org-get-entry` + +00:17:24.480 --> 00:17:25.800 +starting at the current point, + +00:17:25.800 --> 00:17:27.507 +find `workspace-directory` + +00:17:27.507 --> 00:17:28.760 +with a second parameter 1. + +00:17:28.760 --> 00:17:31.520 +You can see down in the minibuffer, + +00:17:31.520 --> 00:17:37.174 +goes to `/tmp/go-batsy-playground/`. + +00:17:37.174 --> 00:17:39.720 +This right here is going to override + +00:17:42.040 --> 00:17:44.307 +the `workspace-directory` at the top level, + +00:17:44.307 --> 00:17:47.607 +which is dot. Dot means here. + +00:17:47.607 --> 00:17:48.880 +That's what makes sure + +00:17:48.880 --> 00:17:50.680 +that the rest of these tangle to + +00:17:50.680 --> 00:17:54.560 +that go-batsy file right relevant to here. + +00:17:54.560 --> 00:17:55.740 +And that does mean that we need + +00:17:55.740 --> 00:17:58.207 +a little bit more complex thing here. + +00:17:58.207 --> 00:18:01.760 +So, we're saying go ahead and `org-entry-get` + +00:18:01.760 --> 00:18:04.800 +the `workspace-directory`. + +00:18:04.800 --> 00:18:06.807 +If anyone hasn't seen this syntax, + +00:18:06.807 --> 00:18:16.040 +this dash arrow is from the dash.el library, + +00:18:16.040 --> 00:18:19.240 +which is basically a big library of all + +00:18:19.240 --> 00:18:20.940 +the utility functions that you wish + +00:18:20.940 --> 00:18:22.880 +Emacs Lisp had. They're well-named. + +00:18:22.880 --> 00:18:24.480 +I highly, highly recommend it. + +00:18:24.480 --> 00:18:26.080 +This is the threading operator. + +00:18:26.080 --> 00:18:28.200 +So, we're just basically taking it, + +00:18:28.200 --> 00:18:29.760 +getting the `workspace-directory`, + +00:18:29.760 --> 00:18:32.307 +if it happens to be dot, then we're just going to + +00:18:32.307 --> 00:18:33.320 +return the current directory, + +00:18:33.320 --> 00:18:36.000 +otherwise whatever directory said. + +00:18:36.000 --> 00:18:39.240 +And then I want to just take a moment + +00:18:39.240 --> 00:18:41.280 +and look at the rest of this structure. + +00:18:41.280 --> 00:18:43.080 +So, `workspace-directory` we talked about. + +00:18:43.080 --> 00:18:46.774 +`header-args` if you noticed, none of my + +00:18:46.774 --> 00:18:48.707 +code blocks for the most part + +00:18:48.707 --> 00:18:50.840 +have any header arguments. + +00:18:50.840 --> 00:18:53.174 +You can drop the `header-args` property, + +00:18:53.174 --> 00:18:55.607 +which is going to be header arguments + +00:18:55.607 --> 00:18:57.840 +that are added automatically + +00:18:57.840 --> 00:19:03.407 +to all source code blocks under this heading. + +00:19:03.407 --> 00:19:05.407 +`header-args+`. Well, + +00:19:05.407 --> 00:19:06.540 +sometimes you don't want to type… + +00:19:06.540 --> 00:19:07.507 +you have a bunch of args, + +00:19:07.507 --> 00:19:08.240 +you don't want to type them out + +00:19:08.240 --> 00:19:09.440 +in this one big line. + +00:19:09.440 --> 00:19:11.040 +So, you basically are adding a new header-arg + +00:19:13.320 --> 00:19:15.407 +to the existing list of header. + +00:19:15.407 --> 00:19:18.160 +And then you can have header-args that are specific + +00:19:18.160 --> 00:19:20.440 +to certain languages, like, for example, + +00:19:20.440 --> 00:19:21.560 +this `default-directory` var is going to be set + +00:19:23.720 --> 00:19:25.200 +for all Emacs Lisps. + +00:19:25.200 --> 00:19:29.574 +And for all Arduinos, evaluation will be disabled, + +00:19:29.574 --> 00:19:32.440 +and tangling will be automatically enabled. + +00:19:32.440 --> 00:19:35.307 +These are just some of the workflows that become + +00:19:35.307 --> 00:19:38.320 +useful when you're actually doing the coding. + +00:19:38.320 --> 00:19:41.374 +[Future George]: Oh, hello again! + +00:19:41.374 --> 00:19:45.307 +Me from the six months from now. + +00:19:45.307 --> 00:19:49.107 +[George]: Cool. + +00:19:49.107 --> 00:19:51.000 +[Future George]: The talk got over, people liked it, + +00:19:51.000 --> 00:19:53.040 +thought the pacing was all over the place. + +00:19:53.040 --> 00:19:56.360 +[George]: Yeah, I had to cut two thirds of it, + +00:19:56.360 --> 00:19:59.800 +going to be filling in those gaps in the Etherpad. + +00:19:59.800 --> 00:20:03.520 +[Future George]: And the editing was uneven, at best. + +00:20:03.520 --> 00:20:05.507 +[George]: I got way better at it + +00:20:05.507 --> 00:20:06.680 +as I worked on it, didn't I? + +00:20:06.680 --> 00:20:09.960 +Kdenlive is pretty cool. + +00:20:09.960 --> 00:20:13.540 +But yeah, I wanted to take a shot at + +00:20:13.540 --> 00:20:16.040 +something different, and I figured if anyone can + +00:20:16.040 --> 00:20:17.760 +appreciate trying something different, + +00:20:17.760 --> 00:20:20.120 +it's EmacsConf, right? + +00:20:20.120 --> 00:20:21.520 +I hope people found it useful. + +00:20:21.520 --> 00:20:22.600 +[Future George]: Yeah, some did. + +00:20:22.600 --> 00:20:26.920 +Oh, I should tell you about the coming Orca war. -- cgit v1.2.3