summaryrefslogblamecommitdiffstats
path: root/2022/captions/emacsconf-2022-workflows--org-workflows-for-developers--george-mauer--main.vtt
blob: 58d88b2f782f643c51b44f4c5873c12355724616 (plain) (tree)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
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.