summaryrefslogtreecommitdiffstats
path: root/2022/captions/emacsconf-2022-orgvm--orgvm-a-simple-http-server-for-org--corwin-brust--main.vtt
blob: 7ee7fca6a56e2efc58964c3f884324d7b152c42f (plain) (blame)
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
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
WEBVTT captioned by sachac

NOTE Introduction

00:00:36.000 --> 00:00:42.480
And so this little application--

00:00:42.480 --> 00:00:42.503
well, I'll skip that and just kind of

00:00:42.504 --> 00:00:49.142
jump right into my thesis for those of you

00:00:49.143 --> 00:00:53.360
that might be planning to duck out for the RMS talk,

00:00:53.360 --> 00:00:55.520
starting in a little bit.

00:00:55.520 --> 00:00:55.545
So essentially, my thesis here is really that

00:00:55.546 --> 00:00:59.378
the Emacs toolchain can easily be combined

00:00:59.379 --> 00:01:08.793
with other skills and used in kind of

00:01:08.794 --> 00:01:13.280
a Unix paradigm of having sort of different tools

00:01:13.280 --> 00:01:14.960
to do different steps.

00:01:14.960 --> 00:01:17.760
We might actually use the same tool

00:01:17.760 --> 00:01:19.240
to implement a couple of steps.

00:01:19.240 --> 00:01:22.080
But with that paradigm, each step

00:01:22.080 --> 00:01:22.086
is an individual item that can be sort of

00:01:22.087 --> 00:01:26.400
dropped in and replaced.

00:01:26.400 --> 00:01:26.420
So over the course of the talk,

00:01:26.421 --> 00:01:31.080
hopefully I'll come back to that thesis.

NOTE What is orgvm?

00:01:31.080 --> 00:01:31.086
But I'll now jump back and start walking through

00:01:31.087 --> 00:01:37.040
what is orgvm?

00:01:37.040 --> 00:01:39.560
So this is a very simple proof of concept program.

00:01:39.560 --> 00:01:39.586
We'll just jump over to perhaps

00:01:39.587 --> 00:01:45.520
a prettier view of the source code for it.

00:01:45.520 --> 00:01:49.200
This is implemented-- oops.

00:01:49.200 --> 00:01:53.160
There's some cruft, I think, in my local.

00:01:53.160 --> 00:01:56.560
All right, so this config block at the top...

00:01:56.560 --> 00:01:58.120
And we'll be jumping back and forth

00:01:58.120 --> 00:02:01.880
between the code and the documentation.

NOTE Nodejs

00:02:01.880 --> 00:02:04.080
So the first thing I want to point out

00:02:04.080 --> 00:02:05.960
is that this is written in Node.js,

00:02:05.960 --> 00:02:08.600
but I think you'll find it'd be pretty trivial to implement

00:02:08.600 --> 00:02:10.840
in any language.

00:02:10.840 --> 00:02:13.960
Certainly, you're more than welcome to use this.

00:02:13.960 --> 00:02:17.920
I'd be happy to accept your patches or feature requests

00:02:17.920 --> 00:02:20.080
and things like that.

00:02:20.080 --> 00:02:21.680
Of course, bug reports.

00:02:21.680 --> 00:02:25.760
But I'd also encourage others to roll their own.

00:02:25.760 --> 00:02:28.760
You might well come up with a different version of this

00:02:28.760 --> 00:02:29.600
that's even cooler.

00:02:29.600 --> 00:02:32.160
And we can learn from each other.

00:02:32.160 --> 00:02:34.200
If you heard one of my talks before,

00:02:34.200 --> 00:02:36.200
you probably recognize a common theme.

00:02:36.200 --> 00:02:40.320
I'm a big fan of head-first development

00:02:40.320 --> 00:02:40.336
as a way to get invested in both

00:02:40.337 --> 00:02:44.120
the tool chain and a culture.

00:02:44.120 --> 00:02:49.560
All right, so let's come back to orgvm.

NOTE The itch I was trying to scratch

00:02:49.560 --> 00:02:49.586
First of all, we'll start with

00:02:49.587 --> 00:02:52.840
the itch I was trying to scratch.

00:02:52.840 --> 00:02:58.240
I wanted to be able to quickly use a web browser

00:02:58.240 --> 00:03:00.680
to browse my Org documents.

00:03:00.680 --> 00:03:01.420
It's particularly handy when the documents

00:03:01.421 --> 00:03:05.640
are full of cross links to each other.

00:03:05.640 --> 00:03:10.080
That meant I wanted to automatically export,

00:03:10.080 --> 00:03:12.280
particularly to HTML.

00:03:12.280 --> 00:03:17.280
But it made sense for me to include Markdown, PDF,

00:03:17.280 --> 00:03:18.880
or whatever format I want.

00:03:18.880 --> 00:03:22.760
Because many times, I'm going to look at that file

00:03:22.760 --> 00:03:29.480
and then pop it into an email or upload it somewhere.

00:03:29.480 --> 00:03:33.240
And then finally, it should be, therefore,

00:03:33.240 --> 00:03:33.753
pretty easy to download the document

00:03:33.754 --> 00:03:38.320
rather than view it, once I'm done.

NOTE Demo

00:03:38.320 --> 00:03:42.200
So let's just run a quick demo.

00:03:42.200 --> 00:03:44.760
You'll see I'm still a Windows user.

00:03:44.760 --> 00:03:45.960
Yeah, I'm working on it.

00:03:45.960 --> 00:03:52.320
So all right, first thing that we're going to do

00:03:52.320 --> 00:03:53.320
is fire up the program.

00:03:53.320 --> 00:04:00.200
Actually, for simplicity, let's just

00:04:00.200 --> 00:04:01.760
admit we live in a DOS world.

00:04:01.760 --> 00:04:19.760
And as you can see, there's not much to it

00:04:19.760 --> 00:04:21.520
to get the application running.

00:04:22.680 --> 00:04:25.960
So with that done, then, I can run out to my localhost.

00:04:25.960 --> 00:04:36.780
And we'll just start by plugging in the name of an Org file.

00:04:37.560 --> 00:04:37.586
So I've got a little Org file that I prepared

00:04:37.587 --> 00:04:49.040
that just kind of provides a proof of concept to this.

00:04:49.040 --> 00:04:53.560
And you can see, as imagined, we're automatically

00:04:53.560 --> 00:04:54.640
turning that Org file...

00:04:54.640 --> 00:04:56.320
Let's just take a quick look at it.

00:04:56.320 --> 00:05:10.280
And here's that file now.

00:05:10.280 --> 00:05:11.960
You can see, nothing up my sleeve.

00:05:11.960 --> 00:05:11.961
This is a very basic Org file

00:05:11.962 --> 00:05:16.560
that I use for testing this program.

00:05:16.560 --> 00:05:17.640
Images work.

00:05:17.640 --> 00:05:21.836
We've got some nicely syntax-highlighted code blocks

00:05:21.837 --> 00:05:25.560
in a couple different languages,

00:05:25.560 --> 00:05:29.760
and not really that much going on there.

NOTE Needs a relatively recent version of Emacs

00:05:29.760 --> 00:05:33.760
All right, let's come back to the documentation.

00:05:33.760 --> 00:05:36.680
I pretty well covered this, I think.

00:05:36.680 --> 00:05:39.720
But you'll need a relatively recent version of Emacs.

00:05:39.720 --> 00:05:43.640
I haven't taken any pains to make this backward compatible.

00:05:43.640 --> 00:05:46.000
To be fair, I haven't tested it extensively.

00:05:46.000 --> 00:05:50.320
It may well work on Emacs 26 or older versions.

00:05:50.320 --> 00:05:55.120
I'm personally running 27.1 and 28,

00:05:55.120 --> 00:05:57.080
as well as recent builds of 29.

00:05:57.080 --> 00:06:02.560
There's some quick start instructions here,

00:06:02.560 --> 00:06:03.900
which I'm going to take as read.

00:06:03.900 --> 00:06:08.600
You probably saw the key element of this,

00:06:08.601 --> 00:06:11.920
which involves starting the program.

00:06:11.920 --> 00:06:13.520
You do-- I will call out Yale.

00:06:13.520 --> 00:06:15.320
If you're trying to play with this yourself,

00:06:15.320 --> 00:06:20.080
don't forget to run the npm install command.

00:06:20.080 --> 00:06:20.086
That'll bring in express.js,

00:06:20.087 --> 00:06:24.920
which the JavaScript we're about to look at is built on.

NOTE Usage patterns

00:06:24.920 --> 00:06:33.480
So let's just take a look at the usage patterns real quick.

00:06:33.480 --> 00:06:35.920
To use this, we're simply giving the document name

00:06:35.920 --> 00:06:42.760
without the .org extension in whatever file path--

00:06:42.760 --> 00:06:46.960
or I'm sorry, whatever we've configured the server

00:06:46.960 --> 00:06:50.800
to run on, in this case, port 3000.

00:06:50.800 --> 00:06:52.960
I also want to call attention to the fact

00:06:52.960 --> 00:06:55.880
that nothing in this program protects you

00:06:55.880 --> 00:06:57.240
from damaging yourself.

00:06:57.240 --> 00:07:00.560
This isn't meant as a production capability.

00:07:00.560 --> 00:07:00.586
This is something that's used to publish

00:07:00.587 --> 00:07:04.840
your own note files

00:07:04.840 --> 00:07:06.520
and roll them out to yourself.

00:07:06.520 --> 00:07:08.680
That's something I'll definitely look at adding,

00:07:08.680 --> 00:07:12.240
but I want people to be careful of it

00:07:12.240 --> 00:07:14.720
while this is in an alpha state.

00:07:14.720 --> 00:07:22.960
So the default response is HTML, and we saw that here.

00:07:22.960 --> 00:07:26.240
But we also can modify the response format.

00:07:26.240 --> 00:07:29.800
We're currently supporting HTML, Markdown, and PDF.

00:07:29.800 --> 00:07:34.280
And that's really enough to select a different format.

00:07:34.280 --> 00:07:48.040
That's really nothing more than adding type. Okay.

00:07:48.040 --> 00:07:50.680
Not sure what's going on there.

00:07:50.680 --> 00:07:57.080
Okay, well, there goes my demo.

00:07:57.080 --> 00:07:59.440
Shows me for doing my talk live.

00:08:03.920 --> 00:08:06.960
But this, fortunately, this error message

00:08:06.960 --> 00:08:08.840
is a nice segue to the part of the talk

00:08:08.840 --> 00:08:10.240
that I'd really like to focus on,

00:08:10.240 --> 00:08:13.520
hopefully bringing me back to that thesis.

NOTE Emacs Lisp

00:08:13.520 --> 00:08:17.760
So as we start to look at code, what we're looking for

00:08:17.760 --> 00:08:21.640
is really this Emacs Lisp that's getting generated here.

00:08:21.640 --> 00:08:24.000
And you'll notice that's the stuff

00:08:24.000 --> 00:08:27.600
I thought was important to produce as diagnostics

00:08:27.600 --> 00:08:29.840
for the programs running as well.

00:08:29.840 --> 00:08:34.000
So, spoiler, this Elisp is dynamically

00:08:34.000 --> 00:08:35.400
generated by the program.

00:08:35.400 --> 00:08:38.160
And that's really the core of the way

00:08:38.160 --> 00:08:42.680
orgvm or my orgvm works.

00:08:42.680 --> 00:08:47.360
So this should look pretty similar to the view of the code

00:08:47.360 --> 00:08:48.880
we had a moment ago.

00:08:48.880 --> 00:08:51.840
You can see I've got some bases.

00:08:51.840 --> 00:08:53.680
This is all hard-coded into the program,

00:08:53.680 --> 00:08:56.720
nothing fancy going on here.

00:08:56.720 --> 00:09:00.280
The debug is simply controlling that diagnostic output

00:09:00.280 --> 00:09:01.560
that we looked at.

00:09:01.560 --> 00:09:04.240
There's some other, hopefully fairly self-explanatory

00:09:04.240 --> 00:09:09.160
programs or properties, where to find Emacs and so forth.

NOTE Variables

00:09:09.160 --> 00:09:16.320
And then finally, we come in to the meat of it,

00:09:16.320 --> 00:09:16.336
the variables that are used to control what Elisp

00:09:16.337 --> 00:09:24.280
we can generate dynamically.

00:09:24.280 --> 00:09:27.400
So here, we're controlling the extension

00:09:27.400 --> 00:09:29.360
that it should look for Org files.

00:09:29.360 --> 00:09:31.560
Hopefully not too many people out there

00:09:31.560 --> 00:09:34.080
with a weird extension for the Org files,

00:09:34.080 --> 00:09:37.920
but this should support that.

00:09:37.920 --> 00:09:40.120
I'm afraid that is something I've been known to do.

00:09:40.120 --> 00:09:49.520
Then we define a list of additional export types.

00:09:49.520 --> 00:09:50.760
Here's one that ought to work.

00:09:50.760 --> 00:09:53.200
Let's take a look at type=org.

00:09:54.720 --> 00:09:59.320
And, aha, it's giving us the file.

00:09:59.320 --> 00:10:00.680
So I'm not going to open that up,

00:10:00.680 --> 00:10:02.420
but now we can see that that's definitely working,

00:10:02.421 --> 00:10:09.200
for certain versions of working.

00:10:09.200 --> 00:10:14.280
So this list of type parameters is

00:10:14.280 --> 00:10:15.720
controlling the supported types.

00:10:15.720 --> 00:10:18.550
Hopefully it should be fairly easy to add in different ones.

00:10:18.800 --> 00:10:21.480
The fancy footwork here is just a list

00:10:21.480 --> 00:10:23.480
of the types that we're going to be using.

00:10:23.480 --> 00:10:29.320
The fancy footwork here involves, first of all,

00:10:29.320 --> 00:10:32.240
there's the extension and the MIME type.

00:10:32.240 --> 00:10:32.253
That's, as you might guess, used to control

00:10:32.254 --> 00:10:38.720
the response content type.

NOTE Replace

00:10:38.720 --> 00:10:40.920
We also have this replace variable.

00:10:40.920 --> 00:10:44.000
This prevents-- there's an optimization

00:10:44.000 --> 00:10:48.836
to send an existing PDF or HTML file

00:10:48.837 --> 00:10:50.463
if that's already there,

00:10:50.464 --> 00:10:51.003
but only if the original source Org file

00:10:51.004 --> 00:10:56.240
hasn't been modified since.

00:10:56.240 --> 00:10:59.920
This `replace` effectively can turn that off.

00:10:59.920 --> 00:11:03.040
If I remove the `replace: true` attribute,

00:11:03.040 --> 00:11:07.600
then I'll be prevented from overwriting that.

00:11:07.600 --> 00:11:10.320
In other words, I'll always send a cached version.

00:11:10.320 --> 00:11:13.878
That might be helpful if, for example,

00:11:13.879 --> 00:11:15.065
you've got hand-tuned PDFs

00:11:15.066 --> 00:11:17.200
and you don't want to accidentally overwrite them.

NOTE Getting into the code some more

00:11:19.120 --> 00:11:23.480
All right, let's get into the code a little bit more.

00:11:23.480 --> 00:11:28.280
I'm going to skip past the really good stuff

00:11:28.280 --> 00:11:28.295
and jump into the boring parts

00:11:28.296 --> 00:11:34.240
so that we have them as context.

00:11:34.240 --> 00:11:37.160
Here's the default path.

00:11:37.160 --> 00:11:41.880
And it is going to send me the readme from the project--

00:11:41.880 --> 00:11:47.120
from the project repo if I don't specify a path.

00:11:47.120 --> 00:11:51.240
And then we have a couple of different endpoints

00:11:51.240 --> 00:11:52.480
that we support.

00:11:52.480 --> 00:11:55.560
We'll come back to this first one.

00:11:55.560 --> 00:11:55.586
For now, let's start with the more normal one,

00:11:55.587 --> 00:12:01.760
which is just giving us a file name.

00:12:01.760 --> 00:12:04.160
So we can see we start by figuring out

00:12:04.160 --> 00:12:08.520
what the physical file name should be called.

00:12:08.520 --> 00:12:10.280
And assuming that that exists--

00:12:15.600 --> 00:12:17.080
sorry, I've confused myself.

00:12:17.080 --> 00:12:23.000
So this is the caching or the optimization

00:12:23.000 --> 00:12:25.640
that I mentioned, sending the existing file.

00:12:25.640 --> 00:12:31.360
This file exists is where the optimization is

00:12:31.360 --> 00:12:38.680
that regenerates the file if the source

00:12:38.680 --> 00:12:41.840
or document for the HTML generator has changed.

00:12:45.080 --> 00:12:46.760
Again, this is a short talk, so I'm not

00:12:46.760 --> 00:12:49.320
going to go into all the nuances of this JavaScript code.

00:12:49.320 --> 00:12:52.800
It's pretty far from an Emacs-related thing.

00:12:52.800 --> 00:12:56.040
So with that said, then, the rest of this program

00:12:56.040 --> 00:12:59.360
is really mostly just handling the different errors:

00:12:59.360 --> 00:13:01.000
"I didn't understand that type."

00:13:01.000 --> 00:13:02.080
"I don't know the document."

00:13:02.080 --> 00:13:03.040
"I failed."

00:13:03.040 --> 00:13:06.480
Otherwise, there's the caching.

NOTE Generating Elisp

00:13:06.480 --> 00:13:14.520
And here's really where things get interesting,

00:13:14.520 --> 00:13:19.200
where we've generated some Elisp,

00:13:19.200 --> 00:13:22.280
and then we're calling Emacs with that Elisp.

00:13:22.280 --> 00:13:24.760
If everything works, we'll send the file.

00:13:24.760 --> 00:13:27.800
If it doesn't, we'll send the 500.

00:13:27.800 --> 00:13:30.920
And we've already seen the 500, so we know that works.

00:13:30.920 --> 00:13:33.760
All right, let's get to the interesting part.

00:13:33.760 --> 00:13:37.320
Sorry, one more footnote.

NOTE Org blocks

00:13:37.320 --> 00:13:39.320
There is a capability built in that will

00:13:39.320 --> 00:13:41.040
allow us to execute an Org block.

00:13:41.040 --> 00:13:42.840
Let's see if that's working in our local.

00:13:44.800 --> 00:13:47.200
I'll remind myself how to do it.

00:13:47.200 --> 00:13:49.560
It's run.

00:13:49.560 --> 00:13:53.320
I think it's called test.

00:13:53.320 --> 00:13:56.360
And that's returning a 500.

00:13:56.360 --> 00:13:58.400
I'm suspecting that's running because I'm running

00:13:58.400 --> 00:13:59.760
in command instead of bash.

00:13:59.760 --> 00:14:06.040
Oh, yeah, so the failure is happening

00:14:06.040 --> 00:14:07.720
after I generate the Elisp.

00:14:07.720 --> 00:14:10.280
I'm pretty confident that is what the actual problem is.

00:14:10.280 --> 00:14:12.760
If we have time, I'll jump back over there

00:14:12.760 --> 00:14:19.280
and relaunch it in mingw bash.

00:14:19.280 --> 00:14:21.440
And we can see it actually work.

00:14:21.440 --> 00:14:24.200
But this works pretty well for me on my work laptop.

00:14:24.200 --> 00:14:25.860
I didn't have to make any changes to it.

00:14:25.860 --> 00:14:28.120
So I have a fairly high amount of confidence,

00:14:28.120 --> 00:14:32.400
at least in trivial cases, this works pretty well.

NOTE Building some Lisp

00:14:32.400 --> 00:14:37.800
All right, so what I actually wanted to talk about today--

00:14:37.800 --> 00:14:41.730
and I'm going to be kind of hand-waving around

00:14:41.731 --> 00:14:46.480
this ES5 class that I've got and kind of the way that works.

00:14:46.480 --> 00:14:49.840
Hopefully, this will be pretty familiar to you

00:14:49.840 --> 00:14:53.440
if you are a JavaScript programmer.

00:14:53.440 --> 00:14:58.660
The interesting stuff comes when we want to build some Lisp.

00:15:01.960 --> 00:15:01.961
Here, you can see that I really don't have

00:15:01.962 --> 00:15:11.280
a whole lot of code around formatting LISP.

00:15:11.280 --> 00:15:14.360
You can see that I've special-cased

00:15:14.360 --> 00:15:19.840
whether the arguments that were passed

00:15:19.840 --> 00:15:20.880
happen to be a function.

00:15:20.880 --> 00:15:25.480
If they are, I'm going to call that function.

00:15:25.480 --> 00:15:31.720
And then the result will be formatted as Lisp.

00:15:31.720 --> 00:15:35.040
So this would be a recursive call here.

00:15:35.040 --> 00:15:40.960
Otherwise, I'm just going to return the arguments.

00:15:40.960 --> 00:15:48.440
Sorry, otherwise, I will slap a pair of parentheses

00:15:48.440 --> 00:15:57.878
around the result of walking that list if I get...

00:15:57.879 --> 00:15:57.880
formatting each element of the list of arguments

00:15:57.880 --> 00:16:02.600
that this `formatLisp` process calls

00:16:02.600 --> 00:16:04.920
and separating them with spaces.

00:16:04.920 --> 00:16:10.880
So in short form, this program walks through a list.

00:16:10.880 --> 00:16:14.000
If the list it receives is a function,

00:16:14.000 --> 00:16:16.080
it calls that function.

00:16:16.080 --> 00:16:19.320
Once that's handled or otherwise,

00:16:19.320 --> 00:16:22.720
we simply walk the list, taking the arguments,

00:16:22.720 --> 00:16:26.000
concatenating them on strings, and finally,

00:16:26.000 --> 00:16:28.560
wrap the results in parentheses.

00:16:28.560 --> 00:16:31.760
So what I didn't mention there but might be obvious

00:16:31.760 --> 00:16:36.120
is if I have a nested list, the inner list

00:16:36.120 --> 00:16:38.600
will be subjected to the same treatment.

00:16:38.600 --> 00:16:43.000
So this is a recursive sort of algorithm.

NOTE How Elisp gets encoded

00:16:43.000 --> 00:16:51.520
All right, so now when I go to export,

00:16:51.520 --> 00:16:53.520
actually, in the interest of time,

00:16:53.520 --> 00:16:55.800
I'm going to avoid walking through that piece of code

00:16:55.800 --> 00:16:58.840
and let's focus instead on the more interesting part

00:16:58.840 --> 00:17:02.360
of how that Lisp gets encoded.

00:17:02.360 --> 00:17:07.520
So coming back to the PDF is a good example here,

00:17:07.520 --> 00:17:10.320
because it's got a special case.

00:17:10.320 --> 00:17:10.336
You can see I've specified this `exportFun`

00:17:10.337 --> 00:17:15.320
or export function.

00:17:15.320 --> 00:17:19.560
That's a property none of these other types have.

00:17:22.400 --> 00:17:27.280
And you can see it contains some Elisp telling us

00:17:27.280 --> 00:17:29.760
how to call the export for it.

00:17:29.760 --> 00:17:32.680
Let's go see how that's used.

00:17:32.680 --> 00:17:35.720
At the very end of what I just skipped over,

00:17:35.720 --> 00:17:40.600
the detailed "how the Org export process works,"

00:17:40.600 --> 00:17:45.040
you'll see that I am ending with a step

00:17:45.040 --> 00:17:48.000
to call the export function.

00:17:48.000 --> 00:17:48.003
Here, I look to see whether I have

00:17:48.004 --> 00:17:55.400
an export function property.

00:17:55.400 --> 00:18:00.920
If I do, I call that function.

00:18:00.920 --> 00:18:00.920
And if I don't, I build this list with the default

00:18:00.921 --> 00:18:07.071
`org-export-to-file` function

00:18:07.072 --> 00:18:15.640
using the filename and an output filename.

00:18:15.640 --> 00:18:18.480
So this, hopefully, is pretty familiar to anybody

00:18:18.480 --> 00:18:18.503
that's manually messed around

00:18:18.504 --> 00:18:23.560
with calling `org-export-to-file`.

00:18:23.560 --> 00:18:25.800
If it isn't, you can pretty well trust me for it.

00:18:25.800 --> 00:18:28.280
There's nothing very special going on.

00:18:28.280 --> 00:18:30.760
This looks rather like...

00:18:30.760 --> 00:18:37.240
Poor example there.

00:18:37.240 --> 00:18:38.960
Let's go back to our markdown.

00:18:46.320 --> 00:18:47.720
And there, we can see--

00:18:47.720 --> 00:18:49.840
[Leo]: I'm going to make a quick announcement.

00:18:49.840 --> 00:18:50.760
Can you hear me?

00:18:50.760 --> 00:18:52.480
[Corwin]: Yes, go for it.

00:18:52.480 --> 00:18:54.280
[Leo]: OK, let me just show my face.

00:18:54.280 --> 00:18:55.400
Oh, I'm not showing my face.

00:18:55.400 --> 00:18:55.640
Damn it.

00:18:55.640 --> 00:18:57.000
OK, I'll make the announcement.

00:18:57.000 --> 00:18:58.600
You won't see my face quite yet.

00:18:58.600 --> 00:19:00.360
We are about to get started.

00:19:00.360 --> 00:19:02.440
Well, we actually just got started on dev

00:19:02.440 --> 00:19:06.040
with the talk by RMS.

00:19:06.040 --> 00:19:08.920
So if you want to hop over to watch the talk by RMS,

00:19:08.920 --> 00:19:09.760
feel free to do so.

00:19:09.760 --> 00:19:12.240
Otherwise, we will be continuing on Gen with Corwin

00:19:12.240 --> 00:19:12.253
to finish his talk and have a Q&A.

00:19:12.254 --> 00:19:16.080
Corwin, you can feel free to go now.

00:19:16.080 --> 00:19:18.560
[Corwin]: Okay, bye, everybody.

00:19:18.560 --> 00:19:22.795
And for those sticking around,

00:19:22.796 --> 00:19:25.040
I'm just going to keep pressing on with this.

NOTE How the export works

00:19:25.040 --> 00:19:30.240
In fact, I'm going to dive back into the part

00:19:30.240 --> 00:19:35.400
that I skipped here, which is the rest of how

00:19:35.400 --> 00:19:37.400
this export functionality works.

00:19:37.400 --> 00:19:41.400
So just to make sure the dot is tied together,

00:19:41.400 --> 00:19:44.440
the core of how this program works

00:19:44.440 --> 00:19:49.320
is generating some Elisp and then passing it

00:19:49.320 --> 00:19:51.680
to Emacs in batch mode.

00:19:51.680 --> 00:19:53.280
So if that wasn't perfectly clear,

00:19:53.280 --> 00:19:57.240
that's really what's going on with this program.

00:19:57.240 --> 00:19:59.240
The rest of the implementation is just

00:19:59.240 --> 00:20:01.840
a way to do that or certain features that

00:20:01.840 --> 00:20:08.440
are supported in that generated Elisp, if you will.

00:20:08.440 --> 00:20:11.720
So this is, you could say, the minimum implementation

00:20:11.720 --> 00:20:11.753
I could come up with to create a web server

00:20:11.754 --> 00:20:17.320
for my local Org documents.

00:20:17.320 --> 00:20:24.440
And I will also interrupt myself to just pull up

00:20:24.440 --> 00:20:28.040
the Etherpad real quick.

00:20:28.040 --> 00:20:29.600
Actually, if somebody is listening

00:20:29.600 --> 00:20:34.720
and can share a link to that, I closed my browser window

00:20:34.720 --> 00:20:36.400
with my links in it.

00:20:36.400 --> 00:20:44.520
But sure, I'm happy to take questions at any point, Leo,

00:20:44.520 --> 00:20:48.480
if there are any questions for me.

00:20:48.480 --> 00:20:49.720
Are you hanging out with me,

00:20:49.720 --> 00:20:53.360
instead of watching RMS? You can go.

00:20:53.360 --> 00:20:54.600
I'm teasing.

00:20:54.600 --> 00:20:58.840
[Leo]: No, I mean, we know that some people can

00:20:58.840 --> 00:21:00.000
have both streams open.

00:21:00.000 --> 00:21:01.560
It's fine.

00:21:01.560 --> 00:21:03.320
And right now, it's not the Q&A with RMS.

00:21:03.320 --> 00:21:04.640
It's just the presentation.

00:21:04.640 --> 00:21:07.040
So feel free to hang out a little longer

00:21:07.040 --> 00:21:09.080
if you just want the live stuff.

00:21:09.080 --> 00:21:09.960
Don't worry about it.

00:21:09.960 --> 00:21:10.760
You're fine.

00:21:10.760 --> 00:21:13.720
[Corwin]: Yeah, and forgive me, everybody,

00:21:13.720 --> 00:21:16.280
if you were hoping for a quick, succinct talk.

00:21:16.280 --> 00:21:18.960
I happen to know I was going to be opposite RMS,

00:21:18.960 --> 00:21:23.240
so I awarded myself the liberty of rambling.

00:21:23.240 --> 00:21:26.840
So if you do have a question, something that I alluded to

00:21:26.840 --> 00:21:29.800
and haven't come back to yet, you should, by all means,

00:21:29.800 --> 00:21:30.320
prompt me.

00:21:30.320 --> 00:21:33.800
[Leo]: Corwin, I might do--

00:21:33.800 --> 00:21:35.400
I'm just giving you a little heads up.

00:21:35.400 --> 00:21:38.640
I might need to go help at some point of dev.

00:21:38.640 --> 00:21:43.120
So if I need to do so, I will let you know right now

00:21:43.120 --> 00:21:44.280
inside the BBB room,

00:21:44.280 --> 00:21:46.160
and you'll be on your own to manage the chat.

00:21:46.160 --> 00:21:47.960
And you can just talk backstage to us

00:21:47.960 --> 00:21:50.240
to manage what we do with the stream, OK?

00:21:50.240 --> 00:21:52.160
[Corwin]: Yep, that should be no problem at all.

00:21:52.160 --> 00:21:53.760
I've got my pad up now.

00:21:53.760 --> 00:21:55.160
Thank you, ??.

00:21:55.160 --> 00:21:58.040
And I'm sorry about butchering your name there.

00:21:58.040 --> 00:22:03.360
And yep, I've got my chat open.

00:22:03.360 --> 00:22:06.400
And I think I'm pretty well set to self-manage.

00:22:06.400 --> 00:22:07.640
Oh, I don't have a camera on.

00:22:07.640 --> 00:22:09.360
So you can't see me giving you the thumbs up.

00:22:09.360 --> 00:22:09.860
[Leo]: Okay, good.

NOTE Walking through the code

00:22:09.860 --> 00:22:16.000
All right, so let's just walk through,

00:22:16.000 --> 00:22:18.400
because it's sort of an interesting code.

00:22:18.400 --> 00:22:20.560
Let's just take a look real quick

00:22:20.560 --> 00:22:24.720
at how we generated our Elisp here,

00:22:24.720 --> 00:22:26.520
because it is--

00:22:26.520 --> 00:22:27.640
there we go.

00:22:27.640 --> 00:22:29.240
It is a little bit interesting.

00:22:29.240 --> 00:22:32.040
So here is the method.

00:22:32.040 --> 00:22:34.080
So I didn't get into detail on this.

00:22:34.080 --> 00:22:34.086
But there's an ES5 class that represents

00:22:34.087 --> 00:22:38.920
an Org mode document.

00:22:38.920 --> 00:22:38.920
It has the static debug property that,

00:22:38.921 --> 00:22:42.400
as you might imagine,

00:22:42.400 --> 00:22:45.480
can be overridden by that debug setting

00:22:45.480 --> 00:22:48.440
we looked at in the defaults.

00:22:48.440 --> 00:22:51.440
We also have a static variable that--

00:22:51.440 --> 00:22:57.440
a static property that does nothing more than getting

00:22:57.440 --> 00:23:00.360
the path to Emacs out of those defaults.

00:23:00.360 --> 00:23:02.120
Similarly, we have a class method

00:23:02.120 --> 00:23:09.520
to spawn out an Emacs, as I mentioned, in batch mode,

00:23:09.520 --> 00:23:12.720
eval-ing some arbitrary Lisp that's passed in.

00:23:12.720 --> 00:23:20.480
All right, so the type--

00:23:20.480 --> 00:23:23.080
this is where things start to get interesting.

00:23:23.080 --> 00:23:26.480
So this is an implementation detail,

00:23:26.480 --> 00:23:30.040
but-- that it's written as a static method.

00:23:30.040 --> 00:23:32.160
But essentially, what's going on here

00:23:32.160 --> 00:23:34.840
is looking up from that type list

00:23:34.840 --> 00:23:37.480
to try to find a type that's passed in,

00:23:37.480 --> 00:23:41.240
and that's returning one of these blocks.

00:23:41.240 --> 00:23:44.800
Let's say I requested HTML, which would be the default.

00:23:44.800 --> 00:23:48.760
Then I'm going to get this set of properties back.

00:23:50.760 --> 00:23:51.260
All right.

00:23:51.260 --> 00:24:04.200
Essentially, this program generates a program

00:24:04.200 --> 00:24:10.840
or a little block of executable elisp.

00:24:10.840 --> 00:24:15.920
However, in some cases, where if the `load-path` has

00:24:15.920 --> 00:24:20.920
been customized in that type block,

00:24:20.920 --> 00:24:25.000
or I think that's the only case I supported.

00:24:25.000 --> 00:24:28.960
There was another complexity I removed.

00:24:28.960 --> 00:24:32.000
So in that case, then I can simply

00:24:32.000 --> 00:24:33.560
replace that program with a let.

00:24:33.560 --> 00:24:41.680
Either way, I'm going to have everything I generate

00:24:41.680 --> 00:24:45.840
be encapsulated in a single block.

00:24:45.840 --> 00:24:49.240
The-- then I'm calling that formatLisp process

00:24:49.240 --> 00:24:52.760
that we talked about, appending to that--

00:24:52.760 --> 00:25:01.680
or inserting into, you could say, the outer scope.

00:25:01.680 --> 00:25:05.000
And we start by finding the file.

00:25:05.000 --> 00:25:11.400
We then load any libraries that might be needed.

00:25:11.400 --> 00:25:13.520
In some cases, the type might not

00:25:13.520 --> 00:25:15.160
have any external libraries.

00:25:15.160 --> 00:25:18.440
So we just-- so that's a no-op.

00:25:18.440 --> 00:25:24.120
And then finally, we're going to execute

00:25:24.120 --> 00:25:27.160
that logic I mentioned before about selecting

00:25:27.160 --> 00:25:30.160
either the default org-export-to-file,

00:25:30.160 --> 00:25:36.200
or else whatever Elisp we've staged for exporting

00:25:36.200 --> 00:25:38.160
that particular file type.

00:25:38.160 --> 00:25:43.112
And again, in the case of PDF, there's a special function

00:25:43.113 --> 00:25:46.240
that's used to trigger that export.

00:25:46.240 --> 00:25:49.160
Or you may be aware that that's a little more complicated.

00:25:49.160 --> 00:25:50.840
There's intermediate forms there.

00:25:50.840 --> 00:25:56.760
All right.

00:25:56.760 --> 00:26:01.320
So just reminding myself if there's anything else

00:26:01.320 --> 00:26:03.760
I have to cover on background.

00:26:03.760 --> 00:26:07.440
And I think that pretty well covers the basics.

NOTE Executing the source block

00:26:07.440 --> 00:26:09.880
All right, let's look at that source block execute.

00:26:09.880 --> 00:26:14.600
This is the other use of the format list function.

00:26:14.600 --> 00:26:16.800
So here, rather than looking at the type

00:26:16.800 --> 00:26:24.720
and passing that through our Org export method,

00:26:24.720 --> 00:26:29.080
and then that type is used to get the list

00:26:29.080 --> 00:26:30.840
that we want to create.

00:26:30.840 --> 00:26:37.600
In the case of source block execute,

00:26:37.600 --> 00:26:40.520
we're kind of rolling it a lot more by hand.

00:26:40.520 --> 00:26:43.920
So this gives us a good chance to sort of unwind

00:26:43.920 --> 00:26:49.600
how that list looks when it's staged as JavaScript data.

00:26:49.600 --> 00:26:52.760
So here again, I wrap everything in a `progn`.

00:26:52.760 --> 00:26:58.480
I start by preventing an interactive prompt

00:26:58.480 --> 00:27:01.240
for the Babel execution.

00:27:01.240 --> 00:27:04.960
And then we load languages.

00:27:04.960 --> 00:27:12.240
This relates to another piece of our configuration

00:27:12.240 --> 00:27:17.600
where we've specified a set of languages

00:27:17.600 --> 00:27:19.920
that it's OK to execute.

00:27:19.920 --> 00:27:24.120
So if that type isn't in this list,

00:27:24.120 --> 00:27:28.800
then we won't be able to execute it in line

00:27:28.800 --> 00:27:32.720
through our trivial little web server.

00:27:32.720 --> 00:27:33.640
All right.

00:27:33.640 --> 00:27:40.600
With that done, then, loading the selected language,

00:27:40.600 --> 00:27:43.960
we then once again open the file.

00:27:43.960 --> 00:27:46.360
And we're-- whoops.

00:27:46.360 --> 00:27:51.800
Let-bind a return value, which is

00:27:51.800 --> 00:27:55.166
calculated by using Org source block execute [`org-sbe`]

00:27:55.167 --> 00:27:58.040
on the name of the block that's given.

00:27:58.040 --> 00:28:05.160
And then we use a temp buffer to write that out

00:28:05.160 --> 00:28:06.640
to a temporary file.

00:28:06.640 --> 00:28:08.440
This is actually a little clumsy,

00:28:08.440 --> 00:28:12.720
but I haven't put the effort in to have this written out

00:28:12.720 --> 00:28:17.480
to the standard output cleanly instead of using a temp file.

00:28:17.840 --> 00:28:20.480
So under-- this is another example of where it may not

00:28:20.480 --> 00:28:22.520
be production-- well, it definitely

00:28:22.520 --> 00:28:27.680
is not production-worthy code in that under heavy load,

00:28:27.680 --> 00:28:30.166
this would certainly break with collisions

00:28:30.167 --> 00:28:32.040
on the Babel file,

00:28:32.040 --> 00:28:34.120
the name of the Babel file.

00:28:34.120 --> 00:28:37.480
In any case, once we've staged up our Elisp, which is--

00:28:37.480 --> 00:28:42.560
this is basically variable interpolation,

00:28:42.560 --> 00:28:47.680
then we just call Emacs on that.

00:28:47.680 --> 00:28:49.720
And if we look down to where that's called,

00:28:49.720 --> 00:28:54.640
you can see that the Org Babel filename calculated here.

00:29:12.795 --> 00:29:15.000
[Leo]: Is there a problem?

00:29:15.000 --> 00:29:15.760
[Corwin]: No, I'm fine.

00:29:15.760 --> 00:29:18.000
I'm just lost in my code.

00:29:18.000 --> 00:29:19.040
[Leo]: OK, cool.

00:29:19.040 --> 00:29:21.160
Uh-oh means, oh, I need to intervene.

00:29:21.160 --> 00:29:22.240
What is going on?

00:29:22.240 --> 00:29:23.200
Carry on, please.

00:29:23.200 --> 00:29:24.120
[Corwin]: No, I'm fine, Leo.

00:29:24.120 --> 00:29:25.480
Thank you.

00:29:25.480 --> 00:29:27.280
All right, so then--

00:29:27.280 --> 00:29:28.680
so you can see we get--

00:29:28.680 --> 00:29:35.537
we send the Babel file here,

00:29:35.538 --> 00:29:41.640
which is calculated manually.

00:29:41.640 --> 00:29:45.440
A bit sloppy there, since I have essentially the same--

00:29:45.440 --> 00:29:47.000
I have two different places where

00:29:47.000 --> 00:29:52.480
I'm calculating the Org doc file in two different ways.

00:29:52.480 --> 00:29:54.720
Have I encouraged you to write your own yet?

00:29:54.720 --> 00:29:56.440
Or send patches.

00:29:56.440 --> 00:30:01.240
All right, so that's pretty much the nuts and bolts

00:30:01.240 --> 00:30:02.400
of this program.

00:30:02.400 --> 00:30:06.720
Let's go back to just seeing if we can't make it run.

00:30:22.120 --> 00:30:22.620
All right.

00:30:22.620 --> 00:30:45.880
All right, well, I apologize for not

00:30:45.880 --> 00:30:49.560
having taken the time to stage my demo this morning.

00:30:49.560 --> 00:30:52.680
I'm going to try to make it better for you.

00:30:52.680 --> 00:30:59.920
But apparently, it's going to be non-trivial

00:30:59.920 --> 00:31:04.520
to make the program work.

00:31:04.520 --> 00:31:07.160
Let's just-- before I completely give up,

00:31:07.160 --> 00:31:13.320
let's go ahead and try our Babel execute.

00:31:13.320 --> 00:31:14.800
And that, too, is failing.

00:31:14.800 --> 00:31:18.040
So there's something unhappy in my local world.

00:31:18.040 --> 00:31:19.040
There it goes.

00:31:19.040 --> 00:31:26.600
But in any case, let's go ahead and just take a look at

00:31:26.600 --> 00:31:28.000
that.

00:31:28.000 --> 00:31:30.640
Let's see.

00:31:30.640 --> 00:31:31.600
Control Enter.

00:31:36.628 --> 00:31:40.200
Let's take a look at that generated .el

00:31:40.200 --> 00:31:42.840
and compare it to-- whoa--

00:31:42.840 --> 00:31:44.000
and compare it to--

00:31:44.000 --> 00:31:52.400
I'm just going to format this manually,

00:31:52.400 --> 00:31:56.000
because I've forgotten my key bindings to auto-format it.

00:31:56.000 --> 00:32:02.240
There we go.

00:32:02.240 --> 00:32:07.960
All right.

00:32:07.960 --> 00:32:13.120
So now we can see, as promised, there's really

00:32:13.120 --> 00:32:16.200
nothing going on here other than the interpolation

00:32:16.200 --> 00:32:18.640
of the variables in.

00:32:18.640 --> 00:32:24.360
We're inserting-- we're using an insert and write file

00:32:24.360 --> 00:32:27.800
method, which is, again, rather sloppy,

00:32:27.800 --> 00:32:32.040
to generate the text file.

00:32:32.040 --> 00:32:32.880
All right.

00:32:32.880 --> 00:32:34.760
Let's come back to our documentation

00:32:34.760 --> 00:32:39.760
and see if we can put a bow on the project.

NOTE Conclusion

00:32:39.760 --> 00:32:43.760
So I hope I've convinced you that this was actually

00:32:43.760 --> 00:32:45.480
rather easy to do.

00:32:45.480 --> 00:32:52.440
The entirety of my index.js file is 262 lines,

00:32:52.440 --> 00:32:59.810
and that includes a good 40 of whitespace and configuration.

00:33:03.760 --> 00:33:06.505
It has only one dependency, the Express,

00:33:06.506 --> 00:33:08.240
which really builds the web server.

00:33:08.240 --> 00:33:11.520
Any language you'd rather implement this in

00:33:11.520 --> 00:33:14.120
will have a similar capability for building

00:33:14.120 --> 00:33:16.280
some type of trivial web server.

00:33:16.280 --> 00:33:18.400
And I think you may find--

00:33:18.400 --> 00:33:22.640
I certainly found that a large portion of the code base

00:33:22.640 --> 00:33:28.080
is really making the errors meaningful,

00:33:28.080 --> 00:33:32.420
in that, in some cases, sending an appropriate HTTP status

00:33:32.420 --> 00:33:34.360
based on what happened.

00:33:34.360 --> 00:33:38.002
In other cases-- let's see if

00:33:38.003 --> 00:33:42.640
I've got an explicit `throw` left in here--

00:33:42.640 --> 00:33:45.840
in other cases, just trapping different types

00:33:45.840 --> 00:33:47.440
of failure conditions.

00:33:47.440 --> 00:33:54.000
I'm going to look at my pad, and I do see a question here.

00:33:54.000 --> 00:33:55.120
So let me jump in here.

NOTE Questions and answers

00:33:58.880 --> 00:34:00.640
[Leo]: Corwin, just to make sure, are you switching to Q&A?

00:34:00.640 --> 00:34:02.380
Are you finished with your presentation?

00:34:02.380 --> 00:34:05.260
[Corwin]: Well, as I said, I'm happy to take Q&A throughout.

00:34:05.260 --> 00:34:08.420
But yes, let's say yes to that.

00:34:08.420 --> 00:34:10.900
[Leo]: Okay, so Corwin, what I'm going to need to do now--

00:34:10.900 --> 00:34:12.140
you are in charge of the room.

00:34:12.140 --> 00:34:14.060
We are going to open up the room so

00:34:14.060 --> 00:34:17.220
that if people have questions watching right now on Gen,

00:34:17.220 --> 00:34:18.700
feel free to come in.

00:34:18.700 --> 00:34:22.780
And there was something else I needed to say.

00:34:22.780 --> 00:34:24.620
Yes, Corwin, if there's any problem,

00:34:24.620 --> 00:34:25.700
whisper to us on Mumble.

00:34:25.700 --> 00:34:27.500
So you might want to unmute Mumble

00:34:27.500 --> 00:34:29.620
and be able to listen to us over there.

00:34:29.620 --> 00:34:32.480
[Corwin]: I can't do that, Leo.

00:34:32.480 --> 00:34:36.440
If I unmute, Mumble is going to bleed through.

00:34:36.440 --> 00:34:36.960
[Leo]: Okay, sure.

00:34:36.960 --> 00:34:39.416
Well, if you have any problem,

00:34:39.417 --> 00:34:41.160
type in #emacsconf-org channel,

00:34:41.160 --> 00:34:42.520
and we'll be with you, OK?

00:34:42.520 --> 00:34:43.520
[Corwin]: Or I'll PM somebody.

00:34:43.520 --> 00:34:45.760
But I don't anticipate having any problems.

00:34:45.760 --> 00:34:49.040
I'll put something in -org when I run out of steam here.

00:34:49.040 --> 00:34:50.400
How's that?

00:34:50.400 --> 00:34:51.160
[Leo]: Amazing, cool.

00:34:51.160 --> 00:34:53.320
So I will have to leave the room, though.

00:34:53.320 --> 00:34:56.800
I'm leaving the recording going so that we have your Q&A.

00:34:56.800 --> 00:34:58.080
And whenever you're available--

00:34:58.080 --> 00:35:02.180
[Corwin]: I'll shut off the recording when I close the room.

00:35:02.180 --> 00:35:02.980
[Leo]: Okay, great.

00:35:02.980 --> 00:35:04.460
Good luck, Corwin.

00:35:04.460 --> 00:35:06.500
[Corwin]: Thank you.

00:35:06.500 --> 00:35:09.780
All right, and if you're still with me, well, thanks.

00:35:09.780 --> 00:35:13.620
I appreciate that.

00:35:13.620 --> 00:35:16.740
I did offer to be opposite RMS.

00:35:16.740 --> 00:35:20.060
And I'm in no way offended if people do want to jump over,

00:35:20.060 --> 00:35:23.540
especially as that starts to shift over to Q&A.

00:35:23.540 --> 00:35:26.980
I'm taking Leo's leaving as a pretty good indication

00:35:26.980 --> 00:35:28.780
that that's happening now-ish.

00:35:28.780 --> 00:35:31.385
So I totally understand

00:35:31.386 --> 00:35:35.020
if folks are more excited to do that.

00:35:35.020 --> 00:35:37.940
Meanwhile, let me just jump over to the question

00:35:37.940 --> 00:35:38.660
that I received.

00:35:38.660 --> 00:35:46.460
I'll show the pad here so that I save myself

00:35:46.460 --> 00:35:47.860
reading the question out.

00:35:47.860 --> 00:35:48.940
But I'll paraphrase it.

NOTE Why am I not running the web server in Emacs?

00:35:48.940 --> 00:35:52.660
Why am I not running the web server in Emacs?

00:35:52.660 --> 00:35:54.380
That would be a great way to do it.

00:35:54.380 --> 00:35:56.340
I chose to build it in Node.js

00:35:56.341 --> 00:35:58.460
because that was trivially easy for me.

NOTE Is this using org-info-js?

00:36:22.140 --> 00:36:24.780
And then finally, am I using org-info-js?

00:36:24.780 --> 00:36:27.540
No, I learned about this essentially at this conference.

00:36:27.540 --> 00:36:30.660
So that's something I'll be learning more about.

00:36:30.660 --> 00:36:32.460
And it could well influence this project.

00:36:34.900 --> 00:36:56.180
All right, and thanks for the questions.

00:36:59.020 --> 00:37:02.820
All right, I'm going to slow my roll just a little bit here

00:37:02.820 --> 00:37:06.980
because I think I kind of have all the time in the world.

00:37:06.980 --> 00:37:11.540
I will be wrapping up within about 15 or 20 minutes

00:37:11.540 --> 00:37:15.620
at the latest just to avoid stressing out

00:37:15.620 --> 00:37:18.827
my fellow organizers, especially Leo and Sacha

00:37:18.828 --> 00:37:22.260
that have the bulk of the heavy lifting this year,

00:37:22.260 --> 00:37:26.820
and Amin, and really, thanks all to everybody.

00:37:26.820 --> 00:37:29.540
God, the nicest part of doing my own talk

00:37:29.540 --> 00:37:31.980
is that I get to say that.

00:37:31.980 --> 00:37:35.460
It's just so much fun to contribute to EmacsConf.

NOTE EmacsConf

00:37:35.460 --> 00:37:38.740
And if you're at all interested, there's

00:37:38.740 --> 00:37:43.100
plenty of completely backstage, behind the curtain role.

00:37:43.100 --> 00:37:45.340
Behind the curtain roles doesn't mean

00:37:45.340 --> 00:37:47.865
you have to be somebody that likes

00:37:47.866 --> 00:37:50.060
talking or being on webcam.

00:37:50.060 --> 00:37:52.300
Sorry that my camera isn't working this year.

00:37:52.300 --> 00:37:53.980
I spent quite a while fussing with that

00:37:53.980 --> 00:37:56.740
and lost all my time to get my prerec working.

00:37:56.740 --> 00:38:10.140
All right, so trying to think where I can take us

00:38:10.140 --> 00:38:11.540
without my demo working.

00:38:11.540 --> 00:38:14.540
I was really hoping to show the Org Babel piece.

00:38:14.540 --> 00:38:15.580
That's really fun.

NOTE How I'm using this at work

00:38:15.580 --> 00:38:20.420
So let me just mention briefly how I'm using this at work.

00:38:20.420 --> 00:38:25.980
So at work, I'll have some type of Org document.

00:38:25.980 --> 00:38:27.700
And usually, it's a project.

00:38:27.700 --> 00:38:32.900
So the title of the document is My Project.

00:38:32.900 --> 00:38:37.820
And then I'll have a requirements section.

00:38:37.820 --> 00:38:43.540
And I'll have a meeting notes section.

00:38:43.540 --> 00:38:44.980
That's probably the key thing.

00:38:44.980 --> 00:38:49.540
And then as the project goes on, I'll start having--

00:38:49.540 --> 00:38:50.740
I'm a solutions architect.

00:38:50.740 --> 00:38:55.420
So my job is formalizing design in large part.

00:38:55.420 --> 00:39:01.740
So then I'll have a design documents section.

00:39:01.740 --> 00:39:05.020
And this is where I'll be doing a lot of my work.

00:39:05.020 --> 00:39:07.220
So I'll start out saying--

00:39:26.620 --> 00:39:29.340
And maybe Bob is a subject matter expert

00:39:29.340 --> 00:39:32.460
whose buy-in I need to have on how we're going

00:39:32.460 --> 00:39:34.820
to do the high-level design.

00:39:34.820 --> 00:39:37.296
Maybe a lead engineer or a dev manager

00:39:37.297 --> 00:39:39.460
or something like that.

00:39:39.460 --> 00:39:42.653
All right, as my work goes on,

00:39:42.654 --> 00:39:47.620
then this will start getting into more detail.

00:40:16.620 --> 00:40:18.660
And things of this nature.

00:40:18.660 --> 00:40:20.180
As things get further and further,

00:40:20.180 --> 00:40:21.740
I'll actually have documentation

00:40:21.740 --> 00:40:22.820
that I'm adding in here.

00:40:22.820 --> 00:40:28.900
Oh, I see.

00:40:28.900 --> 00:40:29.740
It's a big mess.

00:40:29.740 --> 00:40:32.140
All right, well, we'll just reuse this.

00:40:32.140 --> 00:40:40.380
So I can insert those all in line.

00:40:40.380 --> 00:40:42.157
And now for the fun part,

00:40:42.158 --> 00:40:44.460
let's see if the most trivial case

00:40:44.460 --> 00:40:45.460
is working here.

00:40:49.940 --> 00:40:51.180
No.

00:40:51.180 --> 00:40:52.900
All right, completely broken.

00:40:52.900 --> 00:40:57.260
Let me drag.

00:40:57.260 --> 00:41:05.180
All right, well, apologies again for the poor quality

00:41:05.180 --> 00:41:06.260
of my demo today.

00:41:06.260 --> 00:41:13.900
And let me just look real quick at my Etherpad once more.

00:41:13.900 --> 00:41:16.820
And I'll glance at BBB to see if there's anybody

00:41:16.820 --> 00:41:18.140
jumping in with questions.

00:41:18.140 --> 00:41:23.740
And then I'll go back to IRC and look for questions there.

00:41:23.740 --> 00:41:33.180
OK, and I don't see any additional questions on the pad.

00:41:33.180 --> 00:41:35.780
I'm just going to scan IRC real quick.

00:41:35.780 --> 00:41:42.460
I suspect that the TreeSitter comment isn't for me.

00:41:44.900 --> 00:41:56.620
All right, and I'm not seeing a lot of questions there.

00:41:56.620 --> 00:42:04.340
So I'm just going to vamp for just a minute or two.

NOTE Volunteering for EmacsConf

00:42:04.340 --> 00:42:07.980
As I mentioned, I'm a conference volunteer.

00:42:07.980 --> 00:42:09.700
This is my third year volunteering

00:42:09.700 --> 00:42:11.940
with the conference.

00:42:11.940 --> 00:42:15.140
And probably if you take one thing away from my talk,

00:42:15.140 --> 00:42:17.740
it should be I really like volunteering

00:42:17.740 --> 00:42:18.500
for the conference.

00:42:18.500 --> 00:42:19.900
It's fun.

00:42:19.900 --> 00:42:23.500
It makes me feel sort of close to the pulse.

00:42:23.500 --> 00:42:27.296
And it gives me a chance to just interact with people

00:42:27.297 --> 00:42:30.106
that have very different perspectives on Emacs,

00:42:30.107 --> 00:42:32.740
which is something that I really value a lot.

00:42:32.740 --> 00:42:40.220
Emacs, like anything else sort of in the internet world,

00:42:40.220 --> 00:42:42.940
has a real echo chamber factor.

00:42:42.940 --> 00:42:46.504
If you do or don't like use-package,

00:42:46.505 --> 00:42:49.135
you probably interact with a lot of people

00:42:49.136 --> 00:42:53.500
that feel the same way about that.

00:42:53.500 --> 00:42:57.420
And so I really recommend volunteering for EmacsConf

00:42:57.420 --> 00:43:01.340
as a way to sort of mix it up and get

00:43:01.340 --> 00:43:03.858
to know people that may not use Emacs

00:43:03.859 --> 00:43:05.540
the same way that you do.

NOTE It's easy to build a program that uses Emacs in the pipeline

00:43:08.380 --> 00:43:10.420
Or perhaps more on topic, though,

00:43:10.420 --> 00:43:14.300
the log line for this talk is it's really quite easy

00:43:14.300 --> 00:43:20.760
to build a program that uses Emacs in a pipeline capability.

00:43:20.980 --> 00:43:23.780
I think there's a ton of opportunity in this space.

00:43:23.780 --> 00:43:27.700
This particular example is just a trivial web server

00:43:27.700 --> 00:43:30.780
written using Node.js.

00:43:30.780 --> 00:43:31.545
But as was pointed out, we could have used elnode

00:43:31.546 --> 00:43:40.060
as a web server

00:43:40.060 --> 00:43:44.060
and done the entire thing within Emacs Lisp.

00:43:44.060 --> 00:43:48.765
Or really, almost any technology

00:43:48.766 --> 00:43:52.900
would get us this capability.

00:43:52.900 --> 00:43:54.660
From an implementation standpoint,

00:43:54.660 --> 00:43:56.847
I had a lot of fun building

00:43:56.848 --> 00:43:59.580
this trivial little Elisp parser,

00:43:59.580 --> 00:44:03.220
and I'm rather pleased with the fact

00:44:03.220 --> 00:44:07.340
that the entirety of that--

00:44:07.340 --> 00:44:14.180
the entire algorithm for turning JavaScript or JSON data,

00:44:14.180 --> 00:44:20.420
we could say, into Elisp is really a one-liner,

00:44:20.420 --> 00:44:25.820
albeit a nasty one-liner. That was pretty cool

00:44:25.820 --> 00:44:28.180
to discover how simple that was.

00:44:28.180 --> 00:44:31.220
So in my mind, that opens up a lot of possibility.

00:44:31.220 --> 00:44:32.889
If it's this easy in JavaScript,

00:44:32.890 --> 00:44:34.708
I wouldn't expect it to be hard,

00:44:34.709 --> 00:44:36.860
any more difficult in your favorite language.

00:44:36.860 --> 00:44:41.140
Glance one more time to see if there

00:44:41.140 --> 00:44:42.940
happen to be any other questions.

00:44:42.940 --> 00:44:47.300
And not seeing any, I'm going to go ahead and start

00:44:47.300 --> 00:44:49.500
wrapping up my chat now.

00:44:49.500 --> 00:44:51.620
It will take me a couple of minutes to do that.

00:44:51.620 --> 00:44:54.580
So if you do have any other questions that you

00:44:54.580 --> 00:44:56.460
want to drop into the pad or any comments,

00:44:56.460 --> 00:44:59.740
you're more than welcome to hit me with those

00:44:59.740 --> 00:45:03.820
as I coordinate closing this chat, this talk,

00:45:03.820 --> 00:45:06.100
with the organizer team.