summaryrefslogblamecommitdiffstats
path: root/2023/captions/emacsconf-2023-parallel--parallel-text-replacement--lovro-valentino-picotti--answers.vtt
blob: 0fc2d8efa49a32aea5a0005a797aeb5ea38d4261 (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






























































































































































































































































































































































































































































































































































































































































































































































































                                                          
WEBVTT


00:00:08.620 --> 00:00:09.120
[Speaker 0]: And I think we are live.

00:00:09.620 --> 00:00:09.960
Hello again, everyone.

00:00:10.940 --> 00:00:11.440
And hi, Lovro. How are you doing?

00:00:15.339 --> 00:00:15.839
[Speaker 1]: Just a second. Should I join the other room?

00:00:18.460 --> 00:00:18.740
[Speaker 0]: Oh, no, no, you can stay here.

00:00:20.860 --> 00:00:21.360
[Speaker 1]: I can stay in the backstage.

00:00:24.140 --> 00:00:24.320
[Speaker 0]: Everything is fine. I don't think you are

00:00:25.520 --> 00:00:25.760
technically in the backstage right now you're

00:00:26.750 --> 00:00:26.820
just in Big Blue Button with us.

00:00:30.040 --> 00:00:30.160
[Speaker 1]: Oh thanks. Oh because I have 2 of them open I

00:00:30.920 --> 00:00:31.280
thought there were 2 different rooms.

00:00:32.720 --> 00:00:33.220
1 is the backstage and the other,

00:00:38.239 --> 00:00:38.360
[Speaker 0]: whichever, I can hear you and so can the

00:00:39.840 --> 00:00:40.080
stream, so don't worry too much about which

00:00:41.140 --> 00:00:41.220
is the backstage and which is the front page.

00:00:41.540 --> 00:00:41.760
[Speaker 1]: I have no idea. Well, great,

00:00:43.660 --> 00:00:43.940
great. Okay, yeah. Yeah,

00:00:45.280 --> 00:00:45.480
I'm doing great, just to answer your

00:00:45.480 --> 00:00:45.980
question.

00:00:47.379 --> 00:00:47.640
[Speaker 0]: Okay, great, great, Okay,

00:00:49.900 --> 00:00:50.280
well splendid. So, I've pasted a link again

00:00:51.520 --> 00:00:51.760
on IRC if you want to ask your questions,

00:00:53.000 --> 00:00:53.200
and I'd invite you to do so,

00:00:54.620 --> 00:00:55.040
because we have about 9 minutes of laborious

00:00:56.580 --> 00:00:57.080
time to answer as many of them as possible.

00:00:58.360 --> 00:00:58.860
And I'm going to start with the first 1.

00:01:01.100 --> 00:01:01.600
This looks great and was very well-presented.

00:01:03.240 --> 00:01:03.420
Do you have plans to upstream this

00:01:04.239 --> 00:01:04.739
functionality into Emacs?

00:01:08.000 --> 00:01:08.200
[Speaker 1]: That's a good idea. That's something we

00:01:08.860 --> 00:01:09.360
thought about as well.

00:01:11.640 --> 00:01:12.140
Currently, we haven't really contacted anyone

00:01:16.160 --> 00:01:16.660
to do this. Also, the current implementation,

00:01:19.760 --> 00:01:20.080
so as I mentioned in the presentation towards

00:01:22.120 --> 00:01:22.300
the end, so we use a little bit of advice to

00:01:24.240 --> 00:01:24.520
sort of patch some functionality of query

00:01:26.479 --> 00:01:26.600
replace because not everything was easy to

00:01:28.680 --> 00:01:29.180
implement. The core functionality luckily

00:01:32.220 --> 00:01:32.340
was, But there's a couple of fixes we need to

00:01:34.200 --> 00:01:34.340
apply to the message function in order to

00:01:36.380 --> 00:01:36.820
display a nice message in the echo buffer

00:01:39.140 --> 00:01:39.320
because this doesn't happen on its own when

00:01:41.100 --> 00:01:41.580
we're using this trick with this big regex

00:01:45.360 --> 00:01:45.720
and whatnot. So I don't think that the code

00:01:47.080 --> 00:01:47.580
as it is would be upstreamable.

00:01:50.600 --> 00:01:51.100
I think probably if we wanted to upstream it,

00:01:54.140 --> 00:01:54.280
we would have to do some proper work on

00:01:57.180 --> 00:01:57.340
refactoring query place itself in order to

00:01:58.780 --> 00:01:58.979
integrate all of this functionality just

00:02:01.880 --> 00:02:02.380
directly without any patching left and right.

00:02:05.680 --> 00:02:06.120
But yeah, definitely something I've given

00:02:10.080 --> 00:02:10.259
some thought, but so far no progress on it.

00:02:11.640 --> 00:02:11.980
I haven't actually started doing anything

00:02:12.240 --> 00:02:12.740
about it.

00:02:17.440 --> 00:02:17.780
[Speaker 0]: Right, So I'm curious now,

00:02:19.640 --> 00:02:19.900
you developed the feature and then you moved

00:02:21.600 --> 00:02:21.740
on to the presentation or did you want to do

00:02:23.080 --> 00:02:23.200
a presentation for EmacsConf and then you

00:02:24.140 --> 00:02:24.640
worked on something like this?

00:02:26.360 --> 00:02:26.860
Which was it first, the chicken or the egg?

00:02:28.220 --> 00:02:28.720
[Speaker 1]: Yeah, it was the former.

00:02:31.320 --> 00:02:31.820
So this is a problem I've been aware of for,

00:02:33.340 --> 00:02:33.840
I mean, probably a couple of years.

00:02:35.280 --> 00:02:35.640
And, you know, I talked to my friend

00:02:37.600 --> 00:02:37.840
Valentino about it and we had like a little

00:02:39.240 --> 00:02:39.740
discussion, you know, how would we do this?

00:02:41.880 --> 00:02:42.380
And then I remember back when I was

00:02:44.140 --> 00:02:44.260
researching about this problem and the

00:02:45.100 --> 00:02:45.600
various Emacs Lisp solutions,

00:02:47.780 --> 00:02:47.960
all I could find were these solutions that

00:02:49.400 --> 00:02:49.600
would, you know, just shy away from

00:02:50.640 --> 00:02:50.920
implementing the RegEx case,

00:02:52.340 --> 00:02:52.840
which is a really complicated 1.

00:02:54.720 --> 00:02:55.220
And, after some discussion,

00:02:56.140 --> 00:02:56.580
my friend and I decided,

00:02:58.080 --> 00:02:58.320
okay, what the hell? Let's,

00:02:59.280 --> 00:02:59.480
let's try and implement this.

00:03:01.800 --> 00:03:02.300
How hard can it be? And yeah,

00:03:03.280 --> 00:03:03.780
basically in 1 afternoon,

00:03:06.300 --> 00:03:06.500
the idea, our little trick and the whole

00:03:07.440 --> 00:03:07.940
implementation was born.

00:03:11.480 --> 00:03:11.680
And then I think that was maybe around a year

00:03:12.540 --> 00:03:13.040
ago, maybe a bit less.

00:03:14.480 --> 00:03:14.680
And then through the months,

00:03:15.920 --> 00:03:16.420
we just thought, oh yeah,

00:03:17.420 --> 00:03:17.640
maybe we could present this,

00:03:18.960 --> 00:03:19.200
maybe it would be interesting for people to

00:03:20.660 --> 00:03:20.920
see and that's how we came up with the idea

00:03:22.440 --> 00:03:22.940
to present at EmacsConf.

00:03:27.900 --> 00:03:28.180
[Speaker 0]: Okay, great. I don't see other people asking

00:03:30.240 --> 00:03:30.540
questions. So people, it's nice if I ask

00:03:31.100 --> 00:03:31.600
questions but you know,

00:03:33.160 --> 00:03:33.340
the point is kind of for you to ask the

00:03:35.140 --> 00:03:35.280
questions. I see someone who's joined us on

00:03:36.780 --> 00:03:37.120
BBB. Peter, would you like to ask a question

00:03:41.720 --> 00:03:41.980
maybe? Otherwise I see another person writing

00:03:43.040 --> 00:03:43.260
a question on the pad,

00:03:44.540 --> 00:03:44.700
so we can either move for this 1.

00:03:46.640 --> 00:03:46.800
So I'll leave Peter to figure out if they

00:03:47.680 --> 00:03:47.960
want to ask a question.

00:03:49.160 --> 00:03:49.660
So I'm moving on to the next question.

00:03:57.900 --> 00:03:58.180
[Speaker 2]: I can jump in. That's a really well done talk

00:04:01.780 --> 00:04:02.120
and you really clearly laid out the problem

00:04:03.000 --> 00:04:03.500
and the solution there.

00:04:05.600 --> 00:04:05.740
While I was watching it,

00:04:10.740 --> 00:04:11.040
I was thinking maybe the nice way to name it

00:04:13.140 --> 00:04:13.440
is just to name it query replace and query

00:04:15.700 --> 00:04:16.019
replace regext, you know,

00:04:18.480 --> 00:04:18.980
overloading the original functions and then

00:04:23.000 --> 00:04:23.460
using a prefix number,

00:04:26.880 --> 00:04:27.380
like control number to indicate how many

00:04:29.280 --> 00:04:29.780
replacements you're going to do.

00:04:31.640 --> 00:04:32.140
But maybe that doesn't work with the

00:04:36.680 --> 00:04:37.120
recursive editing stuff,

00:04:37.960 --> 00:04:38.180
which I don't use much.

00:04:40.440 --> 00:04:40.940
So I don't have a good method.

00:04:43.260 --> 00:04:43.760
[Speaker 1]: I think it would definitely work.

00:04:46.260 --> 00:04:46.440
Well, the question is,

00:04:47.880 --> 00:04:48.380
if we just overwrite the definitions,

00:04:51.700 --> 00:04:52.200
then, oh, well, I guess we could do that.

00:04:53.410 --> 00:04:53.560
Nothing stops us. I mean,

00:04:54.800 --> 00:04:54.880
we're in Emacs. We could definitely do that.

00:04:55.680 --> 00:04:55.920
And then if you give, like,

00:04:57.540 --> 00:04:57.720
a prefix argument, maybe it just drops you

00:04:59.060 --> 00:04:59.560
back to the original query replace.

00:05:01.000 --> 00:05:01.160
Yeah, that's an idea. For now,

00:05:02.440 --> 00:05:02.920
we decided, OK, let's just keep everything

00:05:05.000 --> 00:05:05.240
explicitly separate just to avoid any

00:05:05.240 --> 00:05:05.740
confusion.

00:05:09.220 --> 00:05:09.400
[Speaker 2]: Yeah, I think that's the right thing to do

00:05:11.820 --> 00:05:12.320
for now. What I'm actually thinking is that

00:05:13.620 --> 00:05:13.940
when you do query replace,

00:05:15.600 --> 00:05:16.100
it just does the regular query replace.

00:05:17.220 --> 00:05:17.440
And if you're going to do,

00:05:20.140 --> 00:05:20.640
say, 3 parallel replacements,

00:05:21.340 --> 00:05:21.840
then you do Control-U,

00:05:25.580 --> 00:05:26.080
query replace. Sorry. Control-3,

00:05:28.580 --> 00:05:28.860
query replace. And then that way you don't

00:05:33.400 --> 00:05:33.760
have The final prompt that you give nothing

00:05:33.760 --> 00:05:34.260
to.

00:05:36.880 --> 00:05:37.380
[Speaker 1]: Exactly, that's actually not a bad idea.

00:05:39.720 --> 00:05:40.080
I think I like that. Yeah,

00:05:40.800 --> 00:05:41.300
that's not a bad idea.

00:05:44.760 --> 00:05:44.920
[Speaker 0]: It's always a quagmire whether to ask for an

00:05:47.080 --> 00:05:47.580
argument or to use the universal argument.

00:05:51.060 --> 00:05:51.380
When you're working with Emacs and especially

00:05:52.640 --> 00:05:52.960
the UX side of things in the package,

00:05:54.900 --> 00:05:55.020
it's so complicated to figure out which 1 you

00:05:56.880 --> 00:05:57.380
want to do. In this particular case,

00:06:00.340 --> 00:06:00.840
I think it's the better option to use the

00:06:02.800 --> 00:06:03.120
universal argument or any kind of argument

00:06:04.040 --> 00:06:04.540
with a control number before.

00:06:10.240 --> 00:06:10.440
All right, we have about 3 more minutes of

00:06:12.440 --> 00:06:12.720
questions. Peter, if you don't mind,

00:06:14.440 --> 00:06:14.940
I'll keep reading the questions in the chat.

00:06:19.440 --> 00:06:19.940
Did you use pair programming while developing

00:06:21.100 --> 00:06:21.600
it, it being a package,

00:06:22.440 --> 00:06:22.940
or did you work independently,

00:06:24.840 --> 00:06:25.340
alternating and reviewing with Valentino?

00:06:28.320 --> 00:06:28.440
[Speaker 1]: It was definitely a pair programming kind of

00:06:29.440 --> 00:06:29.940
thing. So if I remember correctly,

00:06:32.760 --> 00:06:33.260
I was sitting at the computer and Valentino

00:06:36.020 --> 00:06:36.520
was in front of a whiteboard and we were just

00:06:38.400 --> 00:06:38.900
dissecting this regex and a bunch of examples

00:06:41.680 --> 00:06:41.820
and trying to get these capture groups and

00:06:44.240 --> 00:06:44.440
stuff that we have to remap internally to get

00:06:46.560 --> 00:06:46.880
these offsets right and avoid off by 1 error

00:06:48.160 --> 00:06:48.420
and stuff like that. So yeah,

00:06:49.280 --> 00:06:49.780
definitely a team effort.

00:06:53.660 --> 00:06:54.160
[Speaker 0]: Okay, great. Moving on to the next question.

00:06:55.240 --> 00:06:55.740
What is your background in programming?

00:06:57.440 --> 00:06:57.620
Was it difficult to implement following the

00:06:59.700 --> 00:07:00.040
same API and architecture as what is already

00:07:00.200 --> 00:07:00.700
in Emacs?

00:07:05.400 --> 00:07:05.680
[Speaker 1]: So maybe just a quick back story.

00:07:06.960 --> 00:07:07.440
Both Valentino and I are actually PhD

00:07:08.300 --> 00:07:08.680
students in computer science,

00:07:09.960 --> 00:07:10.460
and we literally share an office.

00:07:12.960 --> 00:07:13.180
So that's how we even started talking about

00:07:14.480 --> 00:07:14.900
this whole thing. And we both use Emacs,

00:07:18.380 --> 00:07:18.640
of course. But I don't think this was too

00:07:20.740 --> 00:07:20.880
hard to implement because luckily all of the

00:07:22.300 --> 00:07:22.540
interactive functionality like this

00:07:23.600 --> 00:07:24.100
complicated undo, skipping,

00:07:25.680 --> 00:07:26.180
execute until the end and so on,

00:07:27.980 --> 00:07:28.380
all of this is really just already provided

00:07:29.860 --> 00:07:30.360
by the Emacs queer replace implementation.

00:07:34.160 --> 00:07:34.360
So sort of what we do is we just invoke it as

00:07:36.080 --> 00:07:36.220
a function and delegate to it.

00:07:37.800 --> 00:07:38.000
And we came up with this clever trick to

00:07:42.380 --> 00:07:42.560
basically delegate this multi-replacement to

00:07:45.160 --> 00:07:45.660
this 1 single function that's already there.

00:07:47.980 --> 00:07:48.480
So it wasn't too complicated.

00:07:54.780 --> 00:07:54.960
[Speaker 0]: Alright. And we have about 2 minutes of time

00:07:55.560 --> 00:07:56.040
for the last question.

00:07:58.040 --> 00:07:58.260
What did you learn about Emacs programming or

00:08:00.020 --> 00:08:00.100
programming in general while working on this

00:08:02.320 --> 00:08:02.820
project? A very wide question for me.

00:08:05.840 --> 00:08:06.340
[Speaker 1]: Maybe 1 thing I would like to add to the

00:08:09.220 --> 00:08:09.440
previous just answer is I don't want to say

00:08:10.160 --> 00:08:10.660
like you know we're PhDs,

00:08:12.780 --> 00:08:13.260
a PhD is required for this or anything,

00:08:15.800 --> 00:08:15.920
not at all. It's mostly just for a little bit

00:08:19.220 --> 00:08:19.720
of context, but I think obviously,

00:08:20.640 --> 00:08:21.020
even if you're not a PhD,

00:08:22.360 --> 00:08:22.540
I mean, you don't even require like

00:08:24.960 --> 00:08:25.460
university, you know, education or anything.

00:08:27.540 --> 00:08:28.040
It wasn't overly difficult to implement,

00:08:30.680 --> 00:08:31.080
sort of just read some code that's already

00:08:33.539 --> 00:08:34.039
there and you know follow what you see and

00:08:35.860 --> 00:08:36.020
poke Emacs a little bit and do a little bit

00:08:38.140 --> 00:08:38.320
of debugging on the internals and you can

00:08:40.280 --> 00:08:40.440
definitely get it. So definitely not a

00:08:42.240 --> 00:08:42.400
prerequisite to have a degree or anything to

00:08:45.480 --> 00:08:45.600
do any of this stuff. Okay so Coming back to

00:08:48.420 --> 00:08:48.560
[Speaker 0]: Yeah, I'm going to amend a little bit the

00:08:49.680 --> 00:08:49.960
question because we only have 1 minute.

00:08:51.600 --> 00:08:52.100
So just 1 thing in 10 seconds,

00:08:52.490 --> 00:08:52.540
[Speaker 2]: what did you

00:08:53.040 --> 00:08:53.540
[Speaker 0]: learn about this?

00:08:54.240 --> 00:08:54.380
[Speaker 1]: your last question. What did I learn about

00:08:56.420 --> 00:08:56.920
Emacs programming? That Emacs is so flexible

00:08:59.160 --> 00:08:59.360
that I can go and I can patch literally its

00:09:01.480 --> 00:09:01.880
message function. And that is how we achieve

00:09:03.680 --> 00:09:04.180
the nice message function in the echo buffer.

00:09:06.720 --> 00:09:06.980
So I can literally go and patch something as

00:09:07.560 --> 00:09:08.060
crucial as message.

00:09:09.920 --> 00:09:10.420
[Speaker 0]: It's great. That's a lovely 1.

00:09:12.260 --> 00:09:12.380
And I think, again, we're going back to the

00:09:13.660 --> 00:09:13.780
philosophy of Emacs. Everything is

00:09:15.200 --> 00:09:15.520
programmable and even changing the message

00:09:16.640 --> 00:09:16.800
function is great. All right,

00:09:17.440 --> 00:09:17.640
well, thank you so much,

00:09:19.540 --> 00:09:19.660
Lovro, and thanks to Valentino as well,

00:09:21.820 --> 00:09:21.960
who's not here, but who's contributed to this

00:09:23.900 --> 00:09:24.400
talk. Any last word?

00:09:29.540 --> 00:09:29.800
[Speaker 1]: Well, just if you're gonna build any

00:09:31.980 --> 00:09:32.160
solutions, try to make them as foolproof and

00:09:34.360 --> 00:09:34.540
as 100% as possible so we get more of these

00:09:36.280 --> 00:09:36.420
goodies that are nice and robust for

00:09:37.000 --> 00:09:37.500
everybody to use.

00:09:39.400 --> 00:09:39.620
[Speaker 0]: All right, lovely. Well,

00:09:40.240 --> 00:09:40.580
thank you so much, Lover,

00:09:41.940 --> 00:09:42.380
for your presentation and your answer.

00:09:44.340 --> 00:09:44.640
We'll be moving on to the next talk in just

00:09:47.260 --> 00:09:47.720
about 5 seconds, and I'll see you after.

00:09:47.900 --> 00:09:48.400
Bye, Lovro!

00:09:49.760 --> 00:09:50.260
[Speaker 1]: Yep, bye bye!

00:10:01.440 --> 00:10:01.560
[Speaker 0]: So I'm just waiting to make sure my VNC is a

00:10:02.840 --> 00:10:03.000
little slow. Okay, we switch to the next

00:10:03.480 --> 00:10:03.740
talk. All right, Lover,

00:10:04.960 --> 00:10:05.460
I'm gonna need to go get ready now.

00:10:09.060 --> 00:10:09.560
Yep. Bye-bye, and thanks for your talk.

00:10:11.160 --> 00:10:11.660
[Speaker 1]: Bye, thank you, see you.

00:10:15.060 --> 00:10:15.560
[Speaker 2]: You