blob: b10e834a74f9a26bf6c82c7da4253db34729b8fb (
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
|
WEBVTT
00:00.240 --> 00:00:02.639
hi my name is eduardox i'm the author of
00:02.639 --> 00:00:05.040
an mx package called ev and this talk is
00:05.040 --> 00:00:07.200
about a new feature of ev called test
00:07.200 --> 00:00:08.400
blocks
00:08.400 --> 00:00:10.320
let's start by demo
00:10.320 --> 00:00:12.559
this is a file in lua that defines these
00:12.559 --> 00:00:14.160
two functions here
00:14.160 --> 00:00:16.720
and with it if we type f8 several times
00:16.720 --> 00:00:18.000
here
00:18.000 --> 00:00:20.880
the f8s create a lower apple here and
00:20.880 --> 00:00:24.400
then they send these lines to the rebel
00:24.400 --> 00:00:27.039
where this line here loads this file
00:27.039 --> 00:00:29.679
into the repo and these other lines here
00:29.679 --> 00:00:33.200
are tests for these lines
00:33.200 --> 00:00:35.120
there's a lot of information here so let
00:35.120 --> 00:00:40.480
me organize them in a more visual way
00:40.480 --> 00:00:42.960
this is our file in lua
00:42.960 --> 00:00:45.760
lua sees this thing as a as a multi-line
00:45.760 --> 00:00:47.760
comment but we are going to see it as a
00:47.760 --> 00:00:51.920
test block and eev mode is active and so
00:51.920 --> 00:00:54.480
f8 does the right thing
00:54.480 --> 00:00:57.360
uh these three lines here set up the
00:57.360 --> 00:01:00.079
target buffer running a lower apple you
01:00.079 --> 00:01:03.520
can see the the prompt of the rebel here
01:03.520 --> 00:01:05.360
and these lines here are sent to the
01:05.360 --> 00:01:07.200
rebel
01:07.200 --> 00:01:09.680
and when we type f8 on the line that
01:09.680 --> 00:01:10.720
starts
01:10.720 --> 00:01:13.600
with the red star like these lines here
01:13.600 --> 00:01:15.759
what if it does is that it sends the
01:15.759 --> 00:01:18.240
rest of the line sorry it
01:18.240 --> 00:01:21.119
executes the rest of the line as lisp
01:21.119 --> 00:01:23.920
so it executes the three effects here
01:23.920 --> 00:01:26.240
executes these lines as lisp and they
01:26.240 --> 00:01:29.520
set up the target buffer here
01:29.520 --> 00:01:31.759
and when we type f8 on the line that
01:31.759 --> 00:01:34.159
does not start with the red star
01:34.159 --> 00:01:36.640
the f8 sends the line to the target
01:36.640 --> 00:01:38.799
buffer and moves down
01:38.799 --> 00:01:41.040
and this line loads this file under
01:41.040 --> 00:01:45.200
apple and these lines are tests
01:45.200 --> 00:01:47.520
so we just saw how to use an existing
01:47.520 --> 00:01:50.000
test block let's now see how to create a
01:50.000 --> 00:01:52.640
new test block we just have to run this
01:52.640 --> 00:01:55.680
meta x e insert test block
01:55.680 --> 00:01:58.079
or meta x euat
01:58.079 --> 00:02:01.439
and the result depends on the major mode
02:01.439 --> 00:02:03.920
uh let's see let's understand that that
02:03.920 --> 00:02:06.079
by looking at the source code
02:06.079 --> 00:02:08.720
eeit is an alias to this function here
02:08.720 --> 00:02:10.640
and this function is just five lines of
02:10.640 --> 00:02:12.800
code plus a dot string
02:12.800 --> 00:02:14.560
and the dot string explains that if the
02:14.560 --> 00:02:16.480
major mode is full mode then this
02:16.480 --> 00:02:18.800
function tries to call
02:18.800 --> 00:02:21.360
a function called e insert test plot
02:21.360 --> 00:02:24.800
test full mode if that function exists
02:24.800 --> 00:02:27.280
and that if that function does not exist
02:27.280 --> 00:02:29.680
then it yields an error
02:29.680 --> 00:02:32.080
and here's an example of one such
02:32.080 --> 00:02:34.239
function that's a function that
02:34.239 --> 00:02:37.280
inserts a test block in haskell mode
02:37.280 --> 00:02:40.319
and here we can see two functions like
02:40.319 --> 00:02:42.480
this one for haskell mode and one for
02:42.480 --> 00:02:46.080
javascript mode
02:46.080 --> 00:02:48.560
uh these functions look quite similar
02:48.560 --> 00:02:49.440
but
02:49.440 --> 00:02:52.720
their effects look quite different
02:52.720 --> 00:02:55.760
to make this comparison here i started
02:55.760 --> 00:02:57.280
by writing
02:57.280 --> 00:02:59.680
by creating seven files each one in a
02:59.680 --> 00:03:01.120
different language
03:01.120 --> 00:03:03.040
and initially each one of these files
03:03.040 --> 00:03:04.959
only had a comment with the name of the
03:04.959 --> 00:03:08.239
language so c haskell javascript org
03:08.239 --> 00:03:10.560
mode etc
03:10.560 --> 00:03:13.040
and in each one of these files i typed
03:13.040 --> 00:03:16.959
meta x eeit to insert the test block
03:16.959 --> 00:03:18.800
so here we can see that these test
03:18.800 --> 00:03:20.319
blocks are different
03:20.319 --> 00:03:22.080
for example the syntax for multi-line
03:22.080 --> 00:03:24.000
comments is different depending on the
03:24.000 --> 00:03:25.200
language
03:25.200 --> 00:03:27.760
uh this block here that selects which
03:27.760 --> 00:03:30.319
rebel to run is also different
03:30.319 --> 00:03:33.200
this line here that shows how that
03:33.200 --> 00:03:34.879
tells the repo to
03:34.879 --> 00:03:37.680
load the current file is also different
03:37.680 --> 00:03:39.680
depending on the language
03:39.680 --> 00:03:41.840
in some cases i had to improvise a bit
03:41.840 --> 00:03:43.360
for example
03:43.360 --> 00:03:46.400
uh to implement test blocks in shell
03:46.400 --> 00:03:48.560
mode i had to use this
03:48.560 --> 00:03:52.560
this with syntax using a rear document
03:52.560 --> 00:03:55.280
in tcl i also had to improvise a bit and
03:55.280 --> 00:03:57.840
in some cases i had to improvise a lot
03:57.840 --> 00:04:01.120
for example in org mode there isn't an
04:01.120 --> 00:04:03.360
obvious rebel to run and there isn't an
04:03.360 --> 00:04:05.280
obvious way to load the
04:05.280 --> 00:04:08.080
the current org file into the repo so
04:08.080 --> 00:04:11.680
the default action of meta x eeit
04:11.680 --> 00:04:14.400
in log mode is just to insert this thing
04:14.400 --> 00:04:15.439
here
04:15.439 --> 00:04:17.519
that we can use to run a
04:17.519 --> 00:04:22.320
shell in a rebel
04:22.320 --> 00:04:23.199
so
04:23.199 --> 00:04:25.680
these functions are quite similar and in
04:25.680 --> 00:04:27.440
the beginning i was writing all of them
04:27.440 --> 00:04:29.680
by hand but then i got bored and i wrote
04:29.680 --> 00:04:32.320
a function to help you write functions
04:32.320 --> 00:04:33.840
like that
04:33.840 --> 00:04:35.759
this function is called
04:35.759 --> 00:04:38.080
find e-uit-links and it creates a
04:38.080 --> 00:04:39.919
temporary buffer
04:39.919 --> 00:04:41.680
and the contents of this temporary
04:41.680 --> 00:04:43.440
buffer depends on the major mode for
04:43.440 --> 00:04:45.680
example if the current mode is python
04:45.680 --> 00:04:48.880
mode then running this function here
04:48.880 --> 00:04:51.840
creates a temporary buffer that lets me
04:51.840 --> 00:04:53.840
write the support for
04:53.840 --> 00:04:56.880
test blocks into python mode or rewrite
04:56.880 --> 00:04:59.040
the function that supports test blocks
04:59.040 --> 00:05:00.880
and python mode
05:00.880 --> 00:05:03.600
so if i'm in python mode and i run this
05:03.600 --> 00:05:06.639
i get a temporary buffer like this
05:06.639 --> 00:05:08.800
in which this thing is my template for
05:08.800 --> 00:05:11.120
the function usually this thing is
05:11.120 --> 00:05:13.039
totally wrong i have to rewrite to this
05:13.039 --> 00:05:13.919
string
05:13.919 --> 00:05:16.400
but the rest is right you can see python
05:16.400 --> 00:05:18.720
mode here in the name of the function so
05:18.720 --> 00:05:21.360
we have to edit this and save that to
05:21.360 --> 00:05:22.840
our home
05:22.840 --> 00:05:25.520
slash.mx and by the way these things
05:25.520 --> 00:05:28.880
here hyperlinks to many different things
05:28.880 --> 00:05:31.600
this elias piper link here
05:31.600 --> 00:05:34.160
points to the source code to the section
05:34.160 --> 00:05:35.280
in which
05:35.280 --> 00:05:36.400
these
05:36.400 --> 00:05:38.400
functions are defined
05:38.400 --> 00:05:40.320
so you can see this here the function
05:40.320 --> 00:05:41.759
that supports c
05:41.759 --> 00:05:43.440
the function for haskell the function
05:43.440 --> 00:05:46.400
for javascript etc
05:46.400 --> 00:05:49.440
and that's it this is a five-minute talk
05:49.440 --> 00:05:50.960
so i can't say much
05:50.960 --> 00:05:52.639
if you want more information or if you
05:52.639 --> 00:05:55.120
want to see real world examples how i
05:55.120 --> 00:05:58.000
use test blocks etc etc see this page
05:58.000 --> 00:06:00.479
here and i do not have time to explain
06:00.479 --> 00:06:02.560
this by the way here
06:02.560 --> 06:06.080
so that's it thanks
|