summaryrefslogtreecommitdiffstats
path: root/2021/captions/test.md
blob: d6beb5153dffcdf6b6af175f7cb1a42641826942 (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
<a name="transcript"></a>
# Transcript

[[!template text="Hi! My name is Eduardo Ochs." start="00:00:00.240" video="mainVideo" id=subtitle]]
[[!template text="I'm the author of" start="00:00:01.839" video="mainVideo" id=subtitle]]
[[!template text="an Emacs package called eev," start="00:00:02.639" video="mainVideo" id=subtitle]]
[[!template text="and this talk is about" start="00:00:04.319" video="mainVideo" id=subtitle]]
[[!template text="a new feature of eev" start="00:00:05.279" video="mainVideo" id=subtitle]]
[[!template text="called &quot;test blocks&quot;." start="00:00:06.480" video="mainVideo" id=subtitle]]
[[!template text="Let's start by a demo." start="00:00:08.400" video="mainVideo" id=subtitle]]
[[!template text="This is a file in Lua that defines" start="00:00:10.320" video="mainVideo" id=subtitle]]
[[!template text="these two functions here," start="00:00:12.320" video="mainVideo" id=subtitle]]
[[!template text="and if we type &lt;f8&gt; several times here," start="00:00:14.160" video="mainVideo" id=subtitle]]
[[!template text="the &lt;f8&gt;s create a Lua REPL here" start="00:00:18.000" video="mainVideo" id=subtitle]]
[[!template text="and then they send these lines" start="00:00:20.720" video="mainVideo" id=subtitle]]
[[!template text="to the REPL, where this line here" start="00:00:22.240" video="mainVideo" id=subtitle]]
[[!template text="loads this file into the REPL," start="00:00:25.840" video="mainVideo" id=subtitle]]
[[!template text="and these other lines here" start="00:00:27.840" video="mainVideo" id=subtitle]]
[[!template text="are tests for these lines." start="00:00:29.679" video="mainVideo" id=subtitle]]
[[!template text="There's a lot of information here," start="00:00:33.200" video="mainVideo" id=subtitle]]
[[!template text="so let me organize them" start="00:00:34.719" video="mainVideo" id=subtitle]]
[[!template text="in a more visual way." start="00:00:36.160" video="mainVideo" id=subtitle]]
[[!template text="This is our file in Lua." start="00:00:40.480" video="mainVideo" id=subtitle]]
[[!template text="Lua sees this thing" start="00:00:42.960" video="mainVideo" id=subtitle]]
[[!template text="as a multi-line comment," start="00:00:44.559" video="mainVideo" id=subtitle]]
[[!template text="but we are going to see it" start="00:00:46.160" video="mainVideo" id=subtitle]]
[[!template text="as a test block." start="00:00:47.520" video="mainVideo" id=subtitle]]
[[!template text="And eev mode is active," start="00:00:48.879" video="mainVideo" id=subtitle]]
[[!template text="so &lt;f8&gt; does the right thing." start="00:00:50.879" video="mainVideo" id=subtitle]]
[[!template text="These three lines here" start="00:00:54.480" video="mainVideo" id=subtitle]]
[[!template text="set up the target buffer" start="00:00:56.800" video="mainVideo" id=subtitle]]
[[!template text="running a Lua REPL." start="00:00:58.320" video="mainVideo" id=subtitle]]
[[!template text="You can see the the prompt" start="00:01:00.000" video="mainVideo" id=subtitle]]
[[!template text="of the REPL here," start="00:01:02.079" video="mainVideo" id=subtitle]]
[[!template text="and these lines here" start="00:01:03.520" video="mainVideo" id=subtitle]]
[[!template text="are sent to the REPL." start="00:01:04.640" video="mainVideo" id=subtitle]]
[[!template text="When we type &lt;f8&gt;" start="00:01:07.200" video="mainVideo" id=subtitle]]
[[!template text="on a line that starts" start="00:01:08.960" video="mainVideo" id=subtitle]]
[[!template text="with a red star," start="00:01:10.720" video="mainVideo" id=subtitle]]
[[!template text="like these lines here," start="00:01:11.680" video="mainVideo" id=subtitle]]
[[!template text="what &lt;f8&gt; does is that" start="00:01:13.600" video="mainVideo" id=subtitle]]
[[!template text="it sends the rest of the line--" start="00:01:15.119" video="mainVideo" id=subtitle]]
[[!template text="sorry, it executes" start="00:01:17.537" video="mainVideo" id=subtitle]]
[[!template text="the rest of the line as Lisp." start="00:01:18.880" video="mainVideo" id=subtitle]]
[[!template text="So the three &lt;f8&gt;s here" start="00:01:21.119" video="mainVideo" id=subtitle]]
[[!template text="executes these lines as Lisp," start="00:01:23.920" video="mainVideo" id=subtitle]]
[[!template text="and they set up the target buffer here." start="00:01:26.000" video="mainVideo" id=subtitle]]
[[!template text="When we type &lt;f8&gt;" start="00:01:29.520" video="mainVideo" id=subtitle]]
[[!template text="on a line that does not start" start="00:01:31.119" video="mainVideo" id=subtitle]]
[[!template text="with a red star," start="00:01:32.720" video="mainVideo" id=subtitle]]
[[!template text="the &lt;f8&gt; sends the line" start="00:01:34.159" video="mainVideo" id=subtitle]]
[[!template text="to the target buffer and moves down." start="00:01:35.680" video="mainVideo" id=subtitle]]
[[!template text="This line loads this file" start="00:01:38.799" video="mainVideo" id=subtitle]]
[[!template text="in the REPL, and these lines are tests." start="00:01:40.619" video="mainVideo" id=subtitle]]
[[!template text="So we just saw how to use" start="00:01:45.200" video="mainVideo" id=subtitle]]
[[!template text="an existing test block;" start="00:01:46.799" video="mainVideo" id=subtitle]]
[[!template text="let's now see how to create" start="00:01:48.240" video="mainVideo" id=subtitle]]
[[!template text="a new test block." start="00:01:49.840" video="mainVideo" id=subtitle]]
[[!template text="We just have to run this:" start="00:01:51.280" video="mainVideo" id=subtitle]]
[[!template text="M-x ee-insert-test-block -" start="00:01:52.640" video="mainVideo" id=subtitle]]
[[!template text="or M-x eeit." start="00:01:55.680" video="mainVideo" id=subtitle]]
[[!template text="The result depends on the major mode." start="00:01:58.079" video="mainVideo" id=subtitle]]
[[!template text="Let's understand that" start="00:02:01.439" video="mainVideo" id=subtitle]]
[[!template text="by looking at the source code." start="00:02:03.920" video="mainVideo" id=subtitle]]
[[!template text="eeit is an alias to this function here," start="00:02:06.079" video="mainVideo" id=subtitle]]
[[!template text="and this function is just" start="00:02:08.720" video="mainVideo" id=subtitle]]
[[!template text="five lines of code plus a docstring..." start="00:02:09.920" video="mainVideo" id=subtitle]]
[[!template text="and the docstring explains" start="00:02:12.800" video="mainVideo" id=subtitle]]
[[!template text="that if the major mode is foo-mode," start="00:02:14.160" video="mainVideo" id=subtitle]]
[[!template text="then this function tries to call" start="00:02:15.920" video="mainVideo" id=subtitle]]
[[!template text="a function called ee-insert-test-foo-mode" start="00:02:18.800" video="mainVideo" id=subtitle]]
[[!template text="if that function exists," start="00:02:21.360" video="mainVideo" id=subtitle]]
[[!template text="and that, if that function does not exist," start="00:02:24.800" video="mainVideo" id=subtitle]]
[[!template text="then it yields an error." start="00:02:27.280" video="mainVideo" id=subtitle]]
[[!template text="And here's an example" start="00:02:29.680" video="mainVideo" id=subtitle]]
[[!template text="of one such function." start="00:02:31.120" video="mainVideo" id=subtitle]]
[[!template text="That's a function that inserts" start="00:02:32.560" video="mainVideo" id=subtitle]]
[[!template text="a test block in haskell-mode." start="00:02:34.800" video="mainVideo" id=subtitle]]
[[!template text="Here we can see two functions like this:" start="00:02:37.280" video="mainVideo" id=subtitle]]
[[!template text="one for haskell-mode and one for js-mode." start="00:02:40.959" video="mainVideo" id=subtitle]]
[[!template text="These functions look quite similar," start="00:02:46.080" video="mainVideo" id=subtitle]]
[[!template text="but their effects look quite different." start="00:02:48.560" video="mainVideo" id=subtitle]]
[[!template text="To make this comparison here," start="00:02:52.720" video="mainVideo" id=subtitle]]
[[!template text="I started by writing--" start="00:02:54.800" video="mainVideo" id=subtitle]]
[[!template text="by creating seven files," start="00:02:57.280" video="mainVideo" id=subtitle]]
[[!template text="each one in a different language." start="00:02:59.040" video="mainVideo" id=subtitle]]
[[!template text="Initially, each one of these files" start="00:03:01.120" video="mainVideo" id=subtitle]]
[[!template text="only had a comment" start="00:03:03.040" video="mainVideo" id=subtitle]]
[[!template text="with the name of the language..." start="00:03:04.159" video="mainVideo" id=subtitle]]
[[!template text="so: C, Haskell, Javascript, Org Mode, etc." start="00:03:06.403" video="mainVideo" id=subtitle]]
[[!template text="In each one of these files," start="00:03:10.560" video="mainVideo" id=subtitle]]
[[!template text="I typed M-x eeit to insert a test block." start="00:03:12.560" video="mainVideo" id=subtitle]]
[[!template text="So here we can see that" start="00:03:16.959" video="mainVideo" id=subtitle]]
[[!template text="these test blocks are different." start="00:03:18.319" video="mainVideo" id=subtitle]]
[[!template text="For example, the syntax" start="00:03:20.319" video="mainVideo" id=subtitle]]
[[!template text="for multi-line comments" start="00:03:21.440" video="mainVideo" id=subtitle]]
[[!template text="is different depending on the language." start="00:03:22.560" video="mainVideo" id=subtitle]]
[[!template text="This block here that selects" start="00:03:25.200" video="mainVideo" id=subtitle]]
[[!template text="which REPL to run is also different," start="00:03:27.440" video="mainVideo" id=subtitle]]
[[!template text="and this line here that tells the REPL" start="00:03:30.100" video="mainVideo" id=subtitle]]
[[!template text="to load the current file" start="00:03:34.080" video="mainVideo" id=subtitle]]
[[!template text="is also different," start="00:03:36.000" video="mainVideo" id=subtitle]]
[[!template text="depending on the language." start="00:03:37.680" video="mainVideo" id=subtitle]]
[[!template text="In some cases, I had to improvise a bit." start="00:03:39.680" video="mainVideo" id=subtitle]]
[[!template text="For example, to implement test blocks" start="00:03:41.840" video="mainVideo" id=subtitle]]
[[!template text="in shell mode, I had to use" start="00:03:45.360" video="mainVideo" id=subtitle]]
[[!template text="this weird syntax using a here-document." start="00:03:48.560" video="mainVideo" id=subtitle]]
[[!template text="In Tcl, I also had to improvise a bit," start="00:03:52.560" video="mainVideo" id=subtitle]]
[[!template text="and in some cases," start="00:03:55.040" video="mainVideo" id=subtitle]]
[[!template text="I had to improvise a lot." start="00:03:55.920" video="mainVideo" id=subtitle]]
[[!template text="For example, in Org Mode," start="00:03:57.840" video="mainVideo" id=subtitle]]
[[!template text="there isn't an obvious REPL to run," start="00:04:00.159" video="mainVideo" id=subtitle]]
[[!template text="and there isn't an obvious way" start="00:04:02.400" video="mainVideo" id=subtitle]]
[[!template text="to load the the current Org file" start="00:04:03.840" video="mainVideo" id=subtitle]]
[[!template text="into the REPL, so the default action" start="00:04:06.480" video="mainVideo" id=subtitle]]
[[!template text="of M-x eeit in Org Mode" start="00:04:09.360" video="mainVideo" id=subtitle]]
[[!template text="is just to insert this thing here," start="00:04:12.560" video="mainVideo" id=subtitle]]
[[!template text="that we can use to run a shell in a REPL." start="00:04:15.439" video="mainVideo" id=subtitle]]
[[!template text="So these functions are quite similar." start="00:04:22.320" video="mainVideo" id=subtitle]]
[[!template text="In the beginning," start="00:04:25.280" video="mainVideo" id=subtitle]]
[[!template text="I was writing all of them by hand..." start="00:04:26.240" video="mainVideo" id=subtitle]]
[[!template text="but then I got bored" start="00:04:27.919" video="mainVideo" id=subtitle]]
[[!template text="and I wrote a function" start="00:04:29.120" video="mainVideo" id=subtitle]]
[[!template text="to help me write functions like that." start="00:04:30.160" video="mainVideo" id=subtitle]]
[[!template text="This function is called find-eeit-links," start="00:04:33.840" video="mainVideo" id=subtitle]]
[[!template text="and it creates a temporary buffer," start="00:04:37.280" video="mainVideo" id=subtitle]]
[[!template text="and the contents of this temporary buffer" start="00:04:39.919" video="mainVideo" id=subtitle]]
[[!template text="depends on the major mode. For example," start="00:04:42.080" video="mainVideo" id=subtitle]]
[[!template text="if the current mode is python-mode," start="00:04:44.320" video="mainVideo" id=subtitle]]
[[!template text="then running this function here" start="00:04:45.680" video="mainVideo" id=subtitle]]
[[!template text="creates a temporary buffer" start="00:04:48.880" video="mainVideo" id=subtitle]]
[[!template text="that lets me write the support" start="00:04:50.160" video="mainVideo" id=subtitle]]
[[!template text="for test blocks in python-mode," start="00:04:53.120" video="mainVideo" id=subtitle]]
[[!template text="or rewrite the function" start="00:04:55.440" video="mainVideo" id=subtitle]]
[[!template text="that supports test blocks" start="00:04:57.440" video="mainVideo" id=subtitle]]
[[!template text="in python-mode." start="00:04:59.040" video="mainVideo" id=subtitle]]
[[!template text="So if I'm in python-mode and I run this," start="00:05:00.880" video="mainVideo" id=subtitle]]
[[!template text="I get a temporary buffer like this," start="00:05:03.600" video="mainVideo" id=subtitle]]
[[!template text="in which this thing is my template" start="00:05:06.639" video="mainVideo" id=subtitle]]
[[!template text="for the function. Usually, this string" start="00:05:08.639" video="mainVideo" id=subtitle]]
[[!template text="is totally wrong," start="00:05:11.039" video="mainVideo" id=subtitle]]
[[!template text="I have to rewrite this string," start="00:05:11.919" video="mainVideo" id=subtitle]]
[[!template text="but the rest is right." start="00:05:13.919" video="mainVideo" id=subtitle]]
[[!template text="You can see python-mode here" start="00:05:14.960" video="mainVideo" id=subtitle]]
[[!template text="in the name of the function." start="00:05:16.960" video="mainVideo" id=subtitle]]
[[!template text="So we have to edit this" start="00:05:18.479" video="mainVideo" id=subtitle]]
[[!template text="and save that to our ~/.emacs." start="00:05:20.080" video="mainVideo" id=subtitle]]
[[!template text="By the way, these things here" start="00:05:22.840" video="mainVideo" id=subtitle]]
[[!template text="hyperlinks to many different things..." start="00:05:26.080" video="mainVideo" id=subtitle]]
[[!template text="This Elisp hyperlink here" start="00:05:28.880" video="mainVideo" id=subtitle]]
[[!template text="points to the source code," start="00:05:31.600" video="mainVideo" id=subtitle]]
[[!template text="to the section in which these functions" start="00:05:32.880" video="mainVideo" id=subtitle]]
[[!template text="are defined. So you can see this here," start="00:05:36.880" video="mainVideo" id=subtitle]]
[[!template text="the function that supports C," start="00:05:39.919" video="mainVideo" id=subtitle]]
[[!template text="the function for Haskell," start="00:05:41.759" video="mainVideo" id=subtitle]]
[[!template text="the function for Javascript, etc..." start="00:05:42.800" video="mainVideo" id=subtitle]]
[[!template text="and that's it!" start="00:05:46.400" video="mainVideo" id=subtitle]]
[[!template text="This is a five-minute talk," start="00:05:47.520" video="mainVideo" id=subtitle]]
[[!template text="so I can't say much..." start="00:05:49.440" video="mainVideo" id=subtitle]]
[[!template text="If you want more information," start="00:05:50.960" video="mainVideo" id=subtitle]]
[[!template text="or if you want to see real-world examples," start="00:05:52.320" video="mainVideo" id=subtitle]]
[[!template text="how I use test blocks, etc. etc.," start="00:05:54.800" video="mainVideo" id=subtitle]]
[[!template text="see this page here..." start="00:05:57.280" video="mainVideo" id=subtitle]]
[[!template text="and I do not have time to explain this" start="00:05:58.639" video="mainVideo" id=subtitle]]
[[!template text="&quot;By the way&quot; here." start="00:06:01.253" video="mainVideo" id=subtitle]]
[[!template text="So that's it! Thanks! =)" start="00:06:02.560" video="mainVideo" id=subtitle]]
[[!template text="captions by Eduardo Ochs" start="00:06:03.333" video="mainVideo" id=subtitle]]