summaryrefslogtreecommitdiffstats
path: root/2023/info/overlay-after.md
blob: 773295479f9204dec981018e0736ce2688a26293 (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
<!-- Automatically generated by emacsconf-publish-after-page -->


<a name="overlay-mainVideo-transcript"></a>
# Transcript


Introduction

[[!template new="1" text="""Hi, I'm Jeff Trull, and today I'm going to talk to you""" start="00:00:00.000" video="mainVideo-overlay" id="subtitle"]]
[[!template text="""about improving C++ compiler diagnostics""" start="00:00:04.898" video="mainVideo-overlay" id="subtitle"]]
[[!template text="""using overlays and other features from Emacs.""" start="00:00:08.460" video="mainVideo-overlay" id="subtitle"]]
[[!template text="""First an overview of my talk.""" start="00:00:13.600" video="mainVideo-overlay" id="subtitle"]]
[[!template text="""I'm going to cover what overlays are""" start="00:00:15.840" video="mainVideo-overlay" id="subtitle"]]
[[!template text="""and how you can use them in code,""" start="00:00:17.657" video="mainVideo-overlay" id="subtitle"]]
[[!template text="""then I'm going to talk about C++""" start="00:00:19.326" video="mainVideo-overlay" id="subtitle"]]
[[!template text="""and why its compiler errors can be so onerous.""" start="00:00:21.479" video="mainVideo-overlay" id="subtitle"]]
[[!template text="""Finally, we'll take that information""" start="00:00:24.480" video="mainVideo-overlay" id="subtitle"]]
[[!template text="""and build a new minor mode""" start="00:00:26.751" video="mainVideo-overlay" id="subtitle"]]
[[!template text="""using overlays and other Emacs features.""" start="00:00:28.448" video="mainVideo-overlay" id="subtitle"]]

Overlays and what they can do

[[!template new="1" text="""First of all, overlays.""" start="00:00:33.560" video="mainVideo-overlay" id="subtitle"]]
[[!template text="""What are they?""" start="00:00:35.520" video="mainVideo-overlay" id="subtitle"]]
[[!template text="""They are objects consisting of a buffer range""" start="00:00:36.680" video="mainVideo-overlay" id="subtitle"]]
[[!template text="""and a set of properties.""" start="00:00:39.125" video="mainVideo-overlay" id="subtitle"]]
[[!template text="""That means that they cover a region in a buffer.""" start="00:00:40.400" video="mainVideo-overlay" id="subtitle"]]
[[!template text="""The properties can be a certain set""" start="00:00:43.120" video="mainVideo-overlay" id="subtitle"]]
[[!template text="""of special property names,""" start="00:00:45.534" video="mainVideo-overlay" id="subtitle"]]
[[!template text="""in which case they can be used to cause""" start="00:00:47.345" video="mainVideo-overlay" id="subtitle"]]
[[!template text="""special effects in the buffer,""" start="00:00:50.289" video="mainVideo-overlay" id="subtitle"]]
[[!template text="""but they never change the underlying text.""" start="00:00:52.570" video="mainVideo-overlay" id="subtitle"]]
[[!template text="""You can use them for things like hiding things.""" start="00:00:55.660" video="mainVideo-overlay" id="subtitle"]]
[[!template text="""So, for example, overlays are working right now""" start="00:00:59.900" video="mainVideo-overlay" id="subtitle"]]
[[!template text="""in this window. `org-present`,""" start="00:01:02.887" video="mainVideo-overlay" id="subtitle"]]
[[!template text="""the technology I'm using for this presentation,""" start="00:01:04.661" video="mainVideo-overlay" id="subtitle"]]
[[!template text="""is hiding the asterisk before every headline,""" start="00:01:07.596" video="mainVideo-overlay" id="subtitle"]]
[[!template text="""as well as the things called emphasis markers;""" start="00:01:10.032" video="mainVideo-overlay" id="subtitle"]]
[[!template text="""that is, those things that make things look""" start="00:01:12.521" video="mainVideo-overlay" id="subtitle"]]
[[!template text="""monospaced for verbatim, or italic, or bold.""" start="00:01:16.270" video="mainVideo-overlay" id="subtitle"]]
[[!template text="""The special characters we use to mark off those sections""" start="00:01:20.700" video="mainVideo-overlay" id="subtitle"]]
[[!template text="""are also hidden by `org-present` using overlays.""" start="00:01:24.422" video="mainVideo-overlay" id="subtitle"]]
[[!template text="""But those things are still in the buffer""" start="00:01:28.940" video="mainVideo-overlay" id="subtitle"]]
[[!template text="""and they're still visible to code.""" start="00:01:30.602" video="mainVideo-overlay" id="subtitle"]]
[[!template text="""So if I run this little snippet of code down here,""" start="00:01:31.980" video="mainVideo-overlay" id="subtitle"]]
[[!template text="""it's going to go up to the headline &quot;Overlays""" start="00:01:34.922" video="mainVideo-overlay" id="subtitle"]]
[[!template text="""and what they can do,&quot; and it's going to tell us""" start="00:01:37.404" video="mainVideo-overlay" id="subtitle"]]
[[!template text="""what's there in the buffer.""" start="00:01:40.052" video="mainVideo-overlay" id="subtitle"]]
[[!template text="""Let's go down and run this.""" start="00:01:41.540" video="mainVideo-overlay" id="subtitle"]]
[[!template text="""So according to this code, the contents of the buffer""" start="00:01:45.100" video="mainVideo-overlay" id="subtitle"]]
[[!template text="""to the left of the headline is a star in a space,""" start="00:01:48.958" video="mainVideo-overlay" id="subtitle"]]
[[!template text="""which means that even though we can't see that star,""" start="00:01:51.991" video="mainVideo-overlay" id="subtitle"]]
[[!template text="""it's still there, because it's hidden by an overlay.""" start="00:01:55.205" video="mainVideo-overlay" id="subtitle"]]
[[!template text="""And that's kind of the essence of what overlays are.""" start="00:01:58.220" video="mainVideo-overlay" id="subtitle"]]

Simple overlay example - creating an overlay

[[!template new="1" text="""Let's do a simple overlay example.""" start="00:02:02.500" video="mainVideo-overlay" id="subtitle"]]
[[!template text="""We have some text on the right here,""" start="00:02:04.780" video="mainVideo-overlay" id="subtitle"]]
[[!template text="""which is a famous poem by William Carlos Williams,""" start="00:02:06.720" video="mainVideo-overlay" id="subtitle"]]
[[!template text="""which has been the subject of many memes.""" start="00:02:09.340" video="mainVideo-overlay" id="subtitle"]]
[[!template text="""Let's create an overlay that covers it.""" start="00:02:12.180" video="mainVideo-overlay" id="subtitle"]]
[[!template text="""I'll go down here and use this snippet of code here.""" start="00:02:17.860" video="mainVideo-overlay" id="subtitle"]]
[[!template text="""We'll go up to the top, and we'll mark everything""" start="00:02:20.700" video="mainVideo-overlay" id="subtitle"]]
[[!template text="""between `#+BEGIN_VERSE` and `#+END_VERSE`.""" start="00:02:25.919" video="mainVideo-overlay" id="subtitle"]]
[[!template text="""You can see we've created an overlay""" start="00:02:29.540" video="mainVideo-overlay" id="subtitle"]]
[[!template text="""from position 74 to 224.""" start="00:02:33.277" video="mainVideo-overlay" id="subtitle"]]

Adding properties

[[!template new="1" text="""Now we can take that overlay that we already created""" start="00:02:35.700" video="mainVideo-overlay" id="subtitle"]]
[[!template text="""and add a property, in this case a `face` property,""" start="00:02:38.064" video="mainVideo-overlay" id="subtitle"]]
[[!template text="""to change the appearance of the text.""" start="00:02:41.212" video="mainVideo-overlay" id="subtitle"]]
[[!template text="""This is a poem, and it's currently using""" start="00:02:43.540" video="mainVideo-overlay" id="subtitle"]]
[[!template text="""a face that is monospaced,""" start="00:02:46.280" video="mainVideo-overlay" id="subtitle"]]
[[!template text="""and so it looks like a computer program,""" start="00:02:48.084" video="mainVideo-overlay" id="subtitle"]]
[[!template text="""even though it's a poem.""" start="00:02:50.492" video="mainVideo-overlay" id="subtitle"]]
[[!template text="""I think it would be nicer to use something""" start="00:02:51.900" video="mainVideo-overlay" id="subtitle"]]
[[!template text="""with variable-width font, maybe with some serifs.""" start="00:02:54.586" video="mainVideo-overlay" id="subtitle"]]
[[!template text="""So let's give that a try.""" start="00:02:57.980" video="mainVideo-overlay" id="subtitle"]]
[[!template text="""Now you can see that the poem looks quite a bit different.""" start="00:03:01.140" video="mainVideo-overlay" id="subtitle"]]
[[!template text="""It looks more like what we'd see in a book.""" start="00:03:03.700" video="mainVideo-overlay" id="subtitle"]]

Deleting an overlay

[[!template new="1" text="""We can also delete overlays.""" start="00:03:10.940" video="mainVideo-overlay" id="subtitle"]]
[[!template text="""So I've named this one.""" start="00:03:13.100" video="mainVideo-overlay" id="subtitle"]]
[[!template text="""So we can just go down and run `delete-overlay`""" start="00:03:15.140" video="mainVideo-overlay" id="subtitle"]]
[[!template text="""and get rid of it, and it'll go back to""" start="00:03:17.766" video="mainVideo-overlay" id="subtitle"]]
[[!template text="""the appearance it had before.""" start="00:03:20.049" video="mainVideo-overlay" id="subtitle"]]
[[!template text="""And there it is.""" start="00:03:22.660" video="mainVideo-overlay" id="subtitle"]]
[[!template text="""It's back to normal.""" start="00:03:23.660" video="mainVideo-overlay" id="subtitle"]]

Setting fonts the right way

[[!template new="1" text="""Now, if you're interested in changing all of the verses""" start="00:03:24.660" video="mainVideo-overlay" id="subtitle"]]
[[!template text="""inside an Org Mode file to a different face""" start="00:03:28.474" video="mainVideo-overlay" id="subtitle"]]
[[!template text="""or a different font family,""" start="00:03:31.109" video="mainVideo-overlay" id="subtitle"]]
[[!template text="""this isn't the way you'd really do it.""" start="00:03:32.786" video="mainVideo-overlay" id="subtitle"]]
[[!template text="""I'll just show you that real quick.""" start="00:03:35.060" video="mainVideo-overlay" id="subtitle"]]
[[!template text="""The right way is probably to change the `org-verse` face,""" start="00:03:37.520" video="mainVideo-overlay" id="subtitle"]]
[[!template text="""which is the face used for all of the verse blocks""" start="00:03:43.472" video="mainVideo-overlay" id="subtitle"]]
[[!template text="""inside your Org Mode file.""" start="00:03:48.869" video="mainVideo-overlay" id="subtitle"]]
[[!template text="""And so this is how you do it here:""" start="00:03:51.620" video="mainVideo-overlay" id="subtitle"]]
[[!template text="""`face-remap-add-relative`.""" start="00:03:55.100" video="mainVideo-overlay" id="subtitle"]]
[[!template text="""Let's give it a try.""" start="00:03:56.100" video="mainVideo-overlay" id="subtitle"]]
[[!template text="""It worked!""" start="00:03:58.340" video="mainVideo-overlay" id="subtitle"]]

More properties

[[!template new="1" text="""There are more advanced things that you can do""" start="00:03:59.540" video="mainVideo-overlay" id="subtitle"]]
[[!template text="""other than just changing fonts.""" start="00:04:01.806" video="mainVideo-overlay" id="subtitle"]]
[[!template text="""There's a whole long list of them in the manual,""" start="00:04:03.300" video="mainVideo-overlay" id="subtitle"]]
[[!template text="""but let's talk about the ones we're going to use today.""" start="00:04:05.544" video="mainVideo-overlay" id="subtitle"]]

Visibility

[[!template new="1" text="""You can make text invisible, just like `org-present` did.""" start="00:04:12.580" video="mainVideo-overlay" id="subtitle"]]
[[!template text="""The simplest way is to set the `invisible` property to true,""" start="00:04:17.380" video="mainVideo-overlay" id="subtitle"]]
[[!template text="""so here's a code snippet that will do that.""" start="00:04:21.820" video="mainVideo-overlay" id="subtitle"]]
[[!template text="""What we're going to do is""" start="00:04:24.500" video="mainVideo-overlay" id="subtitle"]]
[[!template text="""go and find the word &quot;plums&quot; inside the poem,""" start="00:04:26.160" video="mainVideo-overlay" id="subtitle"]]
[[!template text="""and then we're going to make it invisible""" start="00:04:28.967" video="mainVideo-overlay" id="subtitle"]]
[[!template text="""by creating an overlay that covers it,""" start="00:04:31.285" video="mainVideo-overlay" id="subtitle"]]
[[!template text="""and then setting the invisible property to true.""" start="00:04:33.437" video="mainVideo-overlay" id="subtitle"]]
[[!template text="""Boom!""" start="00:04:36.820" video="mainVideo-overlay" id="subtitle"]]
[[!template text="""It's gone.""" start="00:04:37.940" video="mainVideo-overlay" id="subtitle"]]
[[!template text="""We've eaten the plums.""" start="00:04:38.940" video="mainVideo-overlay" id="subtitle"]]
[[!template text="""Visibility is a huge topic and very complicated.""" start="00:04:39.940" video="mainVideo-overlay" id="subtitle"]]
[[!template text="""There are powerful mechanisms for using it.""" start="00:04:42.180" video="mainVideo-overlay" id="subtitle"]]
[[!template text="""I suggest reading the manual""" start="00:04:44.220" video="mainVideo-overlay" id="subtitle"]]
[[!template text="""if you'd like to know more about that.""" start="00:04:46.627" video="mainVideo-overlay" id="subtitle"]]

Adding text

[[!template new="1" text="""Another thing we can do with properties""" start="00:04:49.780" video="mainVideo-overlay" id="subtitle"]]
[[!template text="""is to add text either before or after an overlay.""" start="00:04:52.118" video="mainVideo-overlay" id="subtitle"]]
[[!template text="""Since we've made the word &quot;plums&quot; invisible,""" start="00:04:54.980" video="mainVideo-overlay" id="subtitle"]]
[[!template text="""or anything that you make invisible in the buffer,""" start="00:04:57.348" video="mainVideo-overlay" id="subtitle"]]
[[!template text="""if you add text then afterwards,""" start="00:05:00.575" video="mainVideo-overlay" id="subtitle"]]
[[!template text="""it looks like you've replaced the original words""" start="00:05:02.663" video="mainVideo-overlay" id="subtitle"]]
[[!template text="""with new words.""" start="00:05:05.700" video="mainVideo-overlay" id="subtitle"]]
[[!template text="""So let's add a property, a `before-string` property,""" start="00:05:08.220" video="mainVideo-overlay" id="subtitle"]]
[[!template text="""to the overlay that we used before""" start="00:05:12.047" video="mainVideo-overlay" id="subtitle"]]
[[!template text="""to make it seem as though we're eating cherries""" start="00:05:14.194" video="mainVideo-overlay" id="subtitle"]]
[[!template text="""instead of plums.""" start="00:05:17.138" video="mainVideo-overlay" id="subtitle"]]
[[!template text="""Boom!""" start="00:05:18.180" video="mainVideo-overlay" id="subtitle"]]
[[!template text="""There it is.""" start="00:05:19.580" video="mainVideo-overlay" id="subtitle"]]
[[!template text="""So that's how you can replace words using overlays.""" start="00:05:22.020" video="mainVideo-overlay" id="subtitle"]]

Custom properties

[[!template new="1" text="""You can also have custom properties""" start="00:05:27.820" video="mainVideo-overlay" id="subtitle"]]
[[!template text="""that you name and then use yourself.""" start="00:05:29.761" video="mainVideo-overlay" id="subtitle"]]
[[!template text="""For example, you can use it to mark regions in the buffer.""" start="00:05:31.700" video="mainVideo-overlay" id="subtitle"]]
[[!template text="""You can also use it to add information""" start="00:05:35.320" video="mainVideo-overlay" id="subtitle"]]
[[!template text="""to regions in the buffer for your own tracking""" start="00:05:38.009" video="mainVideo-overlay" id="subtitle"]]
[[!template text="""in a minor mode or something like that, which we will use.""" start="00:05:41.180" video="mainVideo-overlay" id="subtitle"]]

Notes on properties

[[!template new="1" text="""Finally, two notes on properties.""" start="00:05:45.380" video="mainVideo-overlay" id="subtitle"]]
[[!template text="""We've been talking about overlay properties,""" start="00:05:49.620" video="mainVideo-overlay" id="subtitle"]]
[[!template text="""but there's also something called text properties.""" start="00:05:51.951" video="mainVideo-overlay" id="subtitle"]]
[[!template text="""Text properties are attached to text in a buffer.""" start="00:05:54.540" video="mainVideo-overlay" id="subtitle"]]
[[!template text="""When you copy that text, the properties come along with it.""" start="00:05:57.460" video="mainVideo-overlay" id="subtitle"]]
[[!template text="""If you modify the properties,""" start="00:06:00.900" video="mainVideo-overlay" id="subtitle"]]
[[!template text="""the buffer is considered modified.""" start="00:06:03.057" video="mainVideo-overlay" id="subtitle"]]
[[!template text="""Org Mode makes heavy use of text properties,""" start="00:06:05.500" video="mainVideo-overlay" id="subtitle"]]
[[!template text="""as we can see by running this little code snippet here,""" start="00:06:08.460" video="mainVideo-overlay" id="subtitle"]]
[[!template text="""which is going to tell us the properties""" start="00:06:11.678" video="mainVideo-overlay" id="subtitle"]]
[[!template text="""and the string attached""" start="00:06:14.060" video="mainVideo-overlay" id="subtitle"]]
[[!template text="""to the &quot;Some poetry&quot; headline on the right.""" start="00:06:16.566" video="mainVideo-overlay" id="subtitle"]]
[[!template text="""There's also some controversy regarding performance.""" start="00:06:20.740" video="mainVideo-overlay" id="subtitle"]]
[[!template text="""It may be that text properties""" start="00:06:23.660" video="mainVideo-overlay" id="subtitle"]]
[[!template text="""perform better than overlay properties,""" start="00:06:25.521" video="mainVideo-overlay" id="subtitle"]]
[[!template text="""so do some research""" start="00:06:27.860" video="mainVideo-overlay" id="subtitle"]]
[[!template text="""if you're going to make heavy use of them.""" start="00:06:28.893" video="mainVideo-overlay" id="subtitle"]]
[[!template text="""I prefer overlays because they're just easier to use.""" start="00:06:31.060" video="mainVideo-overlay" id="subtitle"]]

Improving C++ compiler output

[[!template new="1" text="""C++ compiler output.""" start="00:06:36.100" video="mainVideo-overlay" id="subtitle"]]
[[!template text="""So my day job is C++ programmer,""" start="00:06:37.540" video="mainVideo-overlay" id="subtitle"]]
[[!template text="""and although I've been an Emacser for many years,""" start="00:06:41.171" video="mainVideo-overlay" id="subtitle"]]
[[!template text="""it can be a little bit of a chore dealing with errors.""" start="00:06:46.561" video="mainVideo-overlay" id="subtitle"]]
[[!template text="""The error messages that come out of the compiler""" start="00:06:52.860" video="mainVideo-overlay" id="subtitle"]]
[[!template text="""can be pretty hard to understand.""" start="00:06:55.681" video="mainVideo-overlay" id="subtitle"]]
[[!template text="""This has often been a barrier,""" start="00:06:57.580" video="mainVideo-overlay" id="subtitle"]]
[[!template text="""particularly for people who are new to C++.""" start="00:07:00.538" video="mainVideo-overlay" id="subtitle"]]
[[!template text="""So let's see what that's like.""" start="00:07:04.640" video="mainVideo-overlay" id="subtitle"]]
[[!template text="""I have an example""" start="00:07:09.040" video="mainVideo-overlay" id="subtitle"]]
[[!template text="""which is generously supplied by Ben Deane of Intel.""" start="00:07:10.560" video="mainVideo-overlay" id="subtitle"]]
[[!template text="""So let's see what it looks like""" start="00:07:14.780" video="mainVideo-overlay" id="subtitle"]]
[[!template text="""when you compile a C++ program""" start="00:07:17.083" video="mainVideo-overlay" id="subtitle"]]
[[!template text="""that has a difficult error in it.""" start="00:07:19.314" video="mainVideo-overlay" id="subtitle"]]
[[!template text="""Okay.""" start="00:07:24.400" video="mainVideo-overlay" id="subtitle"]]
[[!template text="""Okay.""" start="00:07:28.400" video="mainVideo-overlay" id="subtitle"]]
[[!template text="""So you see we have a lot of fairly verbose messages.""" start="00:07:31.400" video="mainVideo-overlay" id="subtitle"]]
[[!template text="""The most verbose one I think is probably here.""" start="00:07:35.680" video="mainVideo-overlay" id="subtitle"]]
[[!template text="""This one here.""" start="00:07:39.400" video="mainVideo-overlay" id="subtitle"]]
[[!template text="""These are pretty bad.""" start="00:07:41.000" video="mainVideo-overlay" id="subtitle"]]
[[!template text="""I think there might be bigger ones.""" start="00:07:42.000" video="mainVideo-overlay" id="subtitle"]]
[[!template text="""Oh, yeah. Here we go.""" start="00:07:43.000" video="mainVideo-overlay" id="subtitle"]]
[[!template text="""Here's my favorite one.""" start="00:07:43.721" video="mainVideo-overlay" id="subtitle"]]
[[!template text="""You can see... Let's look for specialization... Basically,""" start="00:07:44.961" video="mainVideo-overlay" id="subtitle"]]
[[!template text="""this whole section of the buffer here,""" start="00:07:51.064" video="mainVideo-overlay" id="subtitle"]]
[[!template text="""that is specifying the specific types""" start="00:07:55.179" video="mainVideo-overlay" id="subtitle"]]
[[!template text="""that a function template was instantiated with.""" start="00:07:58.229" video="mainVideo-overlay" id="subtitle"]]
[[!template text="""And it's a lot there.""" start="00:08:02.000" video="mainVideo-overlay" id="subtitle"]]
[[!template text="""So if you're trying to figure out""" start="00:08:04.000" video="mainVideo-overlay" id="subtitle"]]
[[!template text="""what's wrong with your program""" start="00:08:05.474" video="mainVideo-overlay" id="subtitle"]]
[[!template text="""and you're looking at something like this,""" start="00:08:06.818" video="mainVideo-overlay" id="subtitle"]]
[[!template text="""it can be really, really hard to understand.""" start="00:08:08.885" video="mainVideo-overlay" id="subtitle"]]
[[!template text="""Okay.""" start="00:08:11.000" video="mainVideo-overlay" id="subtitle"]]
[[!template text="""Back to our presentation.""" start="00:08:12.000" video="mainVideo-overlay" id="subtitle"]]

The problem with C++ error messages

[[!template new="1" text="""So it's often this way in C++""" start="00:08:17.680" video="mainVideo-overlay" id="subtitle"]]
[[!template text="""because we compose types from other types.""" start="00:08:20.064" video="mainVideo-overlay" id="subtitle"]]
[[!template text="""They can be long to begin with,""" start="00:08:23.400" video="mainVideo-overlay" id="subtitle"]]
[[!template text="""but then a couple of other factors come into play.""" start="00:08:26.217" video="mainVideo-overlay" id="subtitle"]]

Many standard class templates have defalut arguments

[[!template new="1" text="""First of all, we can have default template arguments.""" start="00:08:30.240" video="mainVideo-overlay" id="subtitle"]]
[[!template text="""These are arguments you didn't write,""" start="00:08:33.280" video="mainVideo-overlay" id="subtitle"]]
[[!template text="""but that are implicitly there""" start="00:08:35.364" video="mainVideo-overlay" id="subtitle"]]
[[!template text="""and can sometimes refer""" start="00:08:37.009" video="mainVideo-overlay" id="subtitle"]]
[[!template text="""to the arguments that you did write,""" start="00:08:38.326" video="mainVideo-overlay" id="subtitle"]]
[[!template text="""which causes them to get a bit bigger,""" start="00:08:40.301" video="mainVideo-overlay" id="subtitle"]]
[[!template text="""such as these allocator arguments here and here.""" start="00:08:42.441" video="mainVideo-overlay" id="subtitle"]]

Some types are aliases for longer things, too

[[!template new="1" text="""Then there are type aliases.""" start="00:08:47.520" video="mainVideo-overlay" id="subtitle"]]
[[!template text="""For example, `std::string` here expands to""" start="00:08:49.360" video="mainVideo-overlay" id="subtitle"]]
[[!template text="""a type with three template arguments.""" start="00:08:54.015" video="mainVideo-overlay" id="subtitle"]]
[[!template text="""So you can imagine, when we combine""" start="00:08:58.320" video="mainVideo-overlay" id="subtitle"]]
[[!template text="""those two things together,""" start="00:09:01.941" video="mainVideo-overlay" id="subtitle"]]
[[!template text="""our simple vector of maps from strings to ints""" start="00:09:04.734" video="mainVideo-overlay" id="subtitle"]]
[[!template text="""becomes this humongous thing here, which...""" start="00:09:09.764" video="mainVideo-overlay" id="subtitle"]]
[[!template text="""Let's run the comparison.""" start="00:09:14.258" video="mainVideo-overlay" id="subtitle"]]
[[!template text="""Yeah.""" start="00:09:18.360" video="mainVideo-overlay" id="subtitle"]]

Reporting type information accurately means long lines

[[!template new="1" text="""So in summary, to properly understand an error""" start="00:09:20.960" video="mainVideo-overlay" id="subtitle"]]
[[!template text="""when you're a C++ programmer""" start="00:09:24.925" video="mainVideo-overlay" id="subtitle"]]
[[!template text="""requires knowing the exact types""" start="00:09:27.371" video="mainVideo-overlay" id="subtitle"]]
[[!template text="""that were supplied to your function.""" start="00:09:29.719" video="mainVideo-overlay" id="subtitle"]]
[[!template text="""And types are built recursively,""" start="00:09:32.280" video="mainVideo-overlay" id="subtitle"]]
[[!template text="""and therefore the types can--""" start="00:09:34.431" video="mainVideo-overlay" id="subtitle"]]
[[!template text="""the correct exact name for the type""" start="00:09:36.647" video="mainVideo-overlay" id="subtitle"]]
[[!template text="""can just be really huge""" start="00:09:40.514" video="mainVideo-overlay" id="subtitle"]]
[[!template text="""and have many levels and layers to it.""" start="00:09:42.777" video="mainVideo-overlay" id="subtitle"]]
[[!template text="""So when I was trying to understand""" start="00:09:46.360" video="mainVideo-overlay" id="subtitle"]]
[[!template text="""the things I'd done wrong,""" start="00:09:48.114" video="mainVideo-overlay" id="subtitle"]]
[[!template text="""especially when I was a newer C++ programmer,""" start="00:09:49.467" video="mainVideo-overlay" id="subtitle"]]
[[!template text="""but honestly still even recently,""" start="00:09:52.402" video="mainVideo-overlay" id="subtitle"]]
[[!template text="""if I was having a really intractable problem,""" start="00:09:54.571" video="mainVideo-overlay" id="subtitle"]]
[[!template text="""I would just copy the entire error message out,""" start="00:09:57.440" video="mainVideo-overlay" id="subtitle"]]
[[!template text="""stick it in the scratch buffer,""" start="00:10:00.124" video="mainVideo-overlay" id="subtitle"]]
[[!template text="""and then manually reformat it""" start="00:10:01.736" video="mainVideo-overlay" id="subtitle"]]
[[!template text="""so I could see what it was telling me""" start="00:10:03.650" video="mainVideo-overlay" id="subtitle"]]
[[!template text="""I'd actually called the function""" start="00:10:05.564" video="mainVideo-overlay" id="subtitle"]]
[[!template text="""or whatever it was with, the exact type.""" start="00:10:07.262" video="mainVideo-overlay" id="subtitle"]]
[[!template text="""I had to sit there""" start="00:10:09.320" video="mainVideo-overlay" id="subtitle"]]
[[!template text="""and go through the whole thing.""" start="00:10:11.312" video="mainVideo-overlay" id="subtitle"]]
[[!template text="""But there's a better way.""" start="00:10:13.240" video="mainVideo-overlay" id="subtitle"]]
[[!template text="""Now, anyway.""" start="00:10:15.240" video="mainVideo-overlay" id="subtitle"]]

Emacs can help - Treat C++ type names as just another kind of balanced expression

[[!template new="1" text="""So what can Emacs do to help us with this problem?""" start="00:10:18.240" video="mainVideo-overlay" id="subtitle"]]
[[!template text="""First of all, if you think about a type name,""" start="00:10:23.960" video="mainVideo-overlay" id="subtitle"]]
[[!template text="""it's a lot like what we call S-expressions""" start="00:10:28.871" video="mainVideo-overlay" id="subtitle"]]
[[!template text="""or balanced expressions.""" start="00:10:33.080" video="mainVideo-overlay" id="subtitle"]]
[[!template text="""Lisp code itself is an S-expression.""" start="00:10:35.480" video="mainVideo-overlay" id="subtitle"]]
[[!template text="""It's basically things with parentheses""" start="00:10:38.400" video="mainVideo-overlay" id="subtitle"]]
[[!template text="""and little atoms or symbols in it,""" start="00:10:41.465" video="mainVideo-overlay" id="subtitle"]]
[[!template text="""or strings or numbers.""" start="00:10:44.215" video="mainVideo-overlay" id="subtitle"]]
[[!template text="""But parenthesized balanced expressions""" start="00:10:46.520" video="mainVideo-overlay" id="subtitle"]]
[[!template text="""are things that Emacs was actually built to deal with.""" start="00:10:50.232" video="mainVideo-overlay" id="subtitle"]]
[[!template text="""They were... I found an old manual from 1981,""" start="00:10:55.800" video="mainVideo-overlay" id="subtitle"]]
[[!template text="""and the two major modes that they recommended""" start="00:10:58.945" video="mainVideo-overlay" id="subtitle"]]
[[!template text="""or that they actually documented in the manual were""" start="00:11:02.160" video="mainVideo-overlay" id="subtitle"]]
[[!template text="""one, assembly language, and two, Lisp.""" start="00:11:05.766" video="mainVideo-overlay" id="subtitle"]]
[[!template text="""They mentioned that there were other modes,""" start="00:11:08.400" video="mainVideo-overlay" id="subtitle"]]
[[!template text="""but they didn't say anything about them.""" start="00:11:10.653" video="mainVideo-overlay" id="subtitle"]]
[[!template text="""So Lisp is something""" start="00:11:12.700" video="mainVideo-overlay" id="subtitle"]]
[[!template text="""with a really long history with Emacs.""" start="00:11:14.626" video="mainVideo-overlay" id="subtitle"]]
[[!template text="""Balanced expressions and manipulating them""" start="00:11:17.440" video="mainVideo-overlay" id="subtitle"]]
[[!template text="""and doing them efficiently""" start="00:11:19.977" video="mainVideo-overlay" id="subtitle"]]
[[!template text="""is just a thing that Emacs knows how to do,""" start="00:11:21.435" video="mainVideo-overlay" id="subtitle"]]
[[!template text="""and Emacs is good at it.""" start="00:11:24.156" video="mainVideo-overlay" id="subtitle"]]
[[!template text="""There's just a legacy""" start="00:11:25.640" video="mainVideo-overlay" id="subtitle"]]
[[!template text="""of algorithms and functions for doing it.""" start="00:11:27.706" video="mainVideo-overlay" id="subtitle"]]
[[!template text="""So we take types,""" start="00:11:31.320" video="mainVideo-overlay" id="subtitle"]]
[[!template text="""and we take the angle brackets in the types,""" start="00:11:33.183" video="mainVideo-overlay" id="subtitle"]]
[[!template text="""and we get the symbols right.""" start="00:11:37.840" video="mainVideo-overlay" id="subtitle"]]
[[!template text="""Then we can treat them""" start="00:11:40.840" video="mainVideo-overlay" id="subtitle"]]
[[!template text="""as though they were balanced expressions or S-expressions,""" start="00:11:41.815" video="mainVideo-overlay" id="subtitle"]]
[[!template text="""the same kind that Emacs is really good at handling.""" start="00:11:44.313" video="mainVideo-overlay" id="subtitle"]]

Add overlays to improve readability

[[!template new="1" text="""Secondly, we can use overlays""" start="00:11:49.320" video="mainVideo-overlay" id="subtitle"]]
[[!template text="""to improve the readability of errors.""" start="00:11:51.980" video="mainVideo-overlay" id="subtitle"]]
[[!template text="""We can take long lines and break and indent them""" start="00:11:55.260" video="mainVideo-overlay" id="subtitle"]]
[[!template text="""using `before-string`s, so the same thing""" start="00:11:58.013" video="mainVideo-overlay" id="subtitle"]]
[[!template text="""I used to add &quot;cherries&quot; into the poem.""" start="00:12:00.200" video="mainVideo-overlay" id="subtitle"]]
[[!template text="""We can use that to insert new lines""" start="00:12:03.440" video="mainVideo-overlay" id="subtitle"]]
[[!template text="""followed by indentation""" start="00:12:06.612" video="mainVideo-overlay" id="subtitle"]]
[[!template text="""and produce a much nicer-looking listing of a type.""" start="00:12:08.726" video="mainVideo-overlay" id="subtitle"]]
[[!template text="""We can also use the `invisible` property""" start="00:12:15.160" video="mainVideo-overlay" id="subtitle"]]
[[!template text="""to hide unwanted detail.""" start="00:12:19.642" video="mainVideo-overlay" id="subtitle"]]

Create a minor mode that runs during compilation

[[!template new="1" text="""Last of all, we can create a minor mode.""" start="00:12:22.400" video="mainVideo-overlay" id="subtitle"]]
[[!template text="""When we're compiling things in Emacs,""" start="00:12:24.960" video="mainVideo-overlay" id="subtitle"]]
[[!template text="""we often use `compilation-mode`.""" start="00:12:27.855" video="mainVideo-overlay" id="subtitle"]]
[[!template text="""`compilation-mode` allows you to install""" start="00:12:30.140" video="mainVideo-overlay" id="subtitle"]]
[[!template text="""compilation filters that run""" start="00:12:32.098" video="mainVideo-overlay" id="subtitle"]]
[[!template text="""when the compiler is producing output,""" start="00:12:33.554" video="mainVideo-overlay" id="subtitle"]]
[[!template text="""and at that time, then, we can add our overlays.""" start="00:12:36.435" video="mainVideo-overlay" id="subtitle"]]
[[!template text="""We can also add in minor-mode commands""" start="00:12:39.980" video="mainVideo-overlay" id="subtitle"]]
[[!template text="""that do whatever we want to the keymap.""" start="00:12:42.869" video="mainVideo-overlay" id="subtitle"]]
[[!template text="""In this case, we're going to show and hide""" start="00:12:45.758" video="mainVideo-overlay" id="subtitle"]]
[[!template text="""lower-level details interactively""" start="00:12:48.322" video="mainVideo-overlay" id="subtitle"]]
[[!template text="""so that we can see a simplified version""" start="00:12:50.177" video="mainVideo-overlay" id="subtitle"]]
[[!template text="""or a more detailed version of a type, depending on our needs.""" start="00:12:53.907" video="mainVideo-overlay" id="subtitle"]]

Parsing types as balanced expressions

[[!template new="1" text="""First of all, parsing types as balanced expressions.""" start="00:12:59.500" video="mainVideo-overlay" id="subtitle"]]
[[!template text="""We need to be able to quickly locate""" start="00:13:03.980" video="mainVideo-overlay" id="subtitle"]]
[[!template text="""the boundaries and the contents""" start="00:13:05.687" video="mainVideo-overlay" id="subtitle"]]
[[!template text="""of parenthesized expressions,""" start="00:13:07.163" video="mainVideo-overlay" id="subtitle"]]
[[!template text="""or in this case, expressions in angle brackets.""" start="00:13:08.500" video="mainVideo-overlay" id="subtitle"]]
[[!template text="""We use a syntax table inside Emacs""" start="00:13:12.100" video="mainVideo-overlay" id="subtitle"]]
[[!template text="""to allow movement functions like `forward-list`""" start="00:13:14.996" video="mainVideo-overlay" id="subtitle"]]
[[!template text="""to jump between matching angle brackets.""" start="00:13:18.801" video="mainVideo-overlay" id="subtitle"]]
[[!template text="""By default, they're just parentheses.""" start="00:13:21.100" video="mainVideo-overlay" id="subtitle"]]
[[!template text="""First of all, let's look at our syntax table.""" start="00:13:23.460" video="mainVideo-overlay" id="subtitle"]]
[[!template text="""We're going to add here syntax entries""" start="00:13:25.900" video="mainVideo-overlay" id="subtitle"]]
[[!template text="""to handle angle brackets as though they were parentheses.""" start="00:13:29.190" video="mainVideo-overlay" id="subtitle"]]
[[!template text="""Then we have a lot of types""" start="00:13:33.900" video="mainVideo-overlay" id="subtitle"]]
[[!template text="""that have colons in them, and those are namespaces in C++.""" start="00:13:37.248" video="mainVideo-overlay" id="subtitle"]]
[[!template text="""By default, Emacs does not recognize them""" start="00:13:42.980" video="mainVideo-overlay" id="subtitle"]]
[[!template text="""as parts of symbols, so we're going to tell Emacs""" start="00:13:45.767" video="mainVideo-overlay" id="subtitle"]]
[[!template text="""that a colon is something called a symbol constituent,""" start="00:13:49.135" video="mainVideo-overlay" id="subtitle"]]
[[!template text="""that it can be part of a name.""" start="00:13:52.840" video="mainVideo-overlay" id="subtitle"]]
[[!template text="""Once we do that, then we can use our functions""" start="00:13:54.860" video="mainVideo-overlay" id="subtitle"]]
[[!template text="""like `forward-list`, `backward-word`,""" start="00:13:57.614" video="mainVideo-overlay" id="subtitle"]]
[[!template text="""all of the navigation and movement functions that we have""" start="00:13:59.443" video="mainVideo-overlay" id="subtitle"]]
[[!template text="""that do things, that do more complicated things""" start="00:14:03.289" video="mainVideo-overlay" id="subtitle"]]
[[!template text="""like S-expressions and so on,""" start="00:14:06.624" video="mainVideo-overlay" id="subtitle"]]
[[!template text="""can be used now with our angle brackets""" start="00:14:08.708" video="mainVideo-overlay" id="subtitle"]]
[[!template text="""and inside of our types.""" start="00:14:11.486" video="mainVideo-overlay" id="subtitle"]]

Indent and fill with overlays - Use ancient "pretty printing" algorithms"

[[!template new="1" text="""The next thing we can do is""" start="00:14:16.100" video="mainVideo-overlay" id="subtitle"]]
[[!template text="""perform indent and fill with overlays.""" start="00:14:18.463" video="mainVideo-overlay" id="subtitle"]]
[[!template text="""We're going to use `before-string` properties""" start="00:14:21.540" video="mainVideo-overlay" id="subtitle"]]
[[!template text="""to break lines and create indentation""" start="00:14:23.736" video="mainVideo-overlay" id="subtitle"]]
[[!template text="""to make the output look a little better.""" start="00:14:25.631" video="mainVideo-overlay" id="subtitle"]]
[[!template text="""Today, we fill mostly text and we indent mostly code.""" start="00:14:28.900" video="mainVideo-overlay" id="subtitle"]]
[[!template text="""We fill text in order to prevent it""" start="00:14:35.320" video="mainVideo-overlay" id="subtitle"]]
[[!template text="""from running off the side of the right margin,""" start="00:14:37.308" video="mainVideo-overlay" id="subtitle"]]
[[!template text="""and we indent code to line up syntactic elements.""" start="00:14:39.903" video="mainVideo-overlay" id="subtitle"]]
[[!template text="""Back in the day, they had algorithms that could do both.""" start="00:14:43.940" video="mainVideo-overlay" id="subtitle"]]
[[!template text="""Those are what we're going to leverage.""" start="00:14:47.080" video="mainVideo-overlay" id="subtitle"]]

Overlays can mimic line breaks and indentation

[[!template new="1" text="""We can use the `before-string` property""" start="00:14:52.260" video="mainVideo-overlay" id="subtitle"]]
[[!template text="""to insert a new line in the correct number of spaces""" start="00:14:54.583" video="mainVideo-overlay" id="subtitle"]]
[[!template text="""to emulate indentation.""" start="00:14:57.760" video="mainVideo-overlay" id="subtitle"]]
[[!template text="""As a simplified example, here's some code""" start="00:15:00.240" video="mainVideo-overlay" id="subtitle"]]
[[!template text="""that will indent 4 upon each open angle bracket.""" start="00:15:03.526" video="mainVideo-overlay" id="subtitle"]]
[[!template text="""Let's give it a try.""" start="00:15:07.280" video="mainVideo-overlay" id="subtitle"]]

Hiding details - Marking depths with overlays

[[!template new="1" text="""The next thing we're going to need to do is hide details.""" start="00:15:14.520" video="mainVideo-overlay" id="subtitle"]]
[[!template text="""So we have nested types, and the user is going to want to""" start="00:15:18.280" video="mainVideo-overlay" id="subtitle"]]
[[!template text="""be able to reveal lower-level or hide lower-level parts""" start="00:15:22.689" video="mainVideo-overlay" id="subtitle"]]
[[!template text="""of the nested type interactively""" start="00:15:27.372" video="mainVideo-overlay" id="subtitle"]]
[[!template text="""once we've already reformatted the error messages.""" start="00:15:30.132" video="mainVideo-overlay" id="subtitle"]]
[[!template text="""Let's see how we can do that using invisible properties.""" start="00:15:35.480" video="mainVideo-overlay" id="subtitle"]]
[[!template text="""The first thing we're going to do is""" start="00:15:40.440" video="mainVideo-overlay" id="subtitle"]]
[[!template text="""mark depths within the type.""" start="00:15:43.993" video="mainVideo-overlay" id="subtitle"]]
[[!template text="""When we're originally analyzing and formatting""" start="00:15:46.680" video="mainVideo-overlay" id="subtitle"]]
[[!template text="""and doing the indentation and the line breaks,""" start="00:15:49.329" video="mainVideo-overlay" id="subtitle"]]
[[!template text="""at the same time, we're going to go through""" start="00:15:51.920" video="mainVideo-overlay" id="subtitle"]]
[[!template text="""and mark the nested levels inside the type names,""" start="00:15:55.072" video="mainVideo-overlay" id="subtitle"]]
[[!template text="""just as this diagram shows.""" start="00:15:58.818" video="mainVideo-overlay" id="subtitle"]]
[[!template text="""So depth 1, for example, will be everything""" start="00:16:00.840" video="mainVideo-overlay" id="subtitle"]]
[[!template text="""inside the first level of angle brackets.""" start="00:16:03.574" video="mainVideo-overlay" id="subtitle"]]
[[!template text="""Depth 2 will be everything inside the second level,""" start="00:16:06.120" video="mainVideo-overlay" id="subtitle"]]
[[!template text="""and so on.""" start="00:16:09.039" video="mainVideo-overlay" id="subtitle"]]
[[!template text="""And then later on, when the users request it,""" start="00:16:09.760" video="mainVideo-overlay" id="subtitle"]]
[[!template text="""we can go and look at the depth that they've selected""" start="00:16:12.071" video="mainVideo-overlay" id="subtitle"]]
[[!template text="""and then mark those sections invisible.""" start="00:16:16.304" video="mainVideo-overlay" id="subtitle"]]
[[!template text="""Let's see how that might work.""" start="00:16:19.360" video="mainVideo-overlay" id="subtitle"]]
[[!template text="""First of all, let's delete the overlays""" start="00:16:20.520" video="mainVideo-overlay" id="subtitle"]]
[[!template text="""that we already have that created the indentation.""" start="00:16:24.023" video="mainVideo-overlay" id="subtitle"]]
[[!template text="""Now we're going to go and do that marking""" start="00:16:28.400" video="mainVideo-overlay" id="subtitle"]]
[[!template text="""with the custom depth properties here.""" start="00:16:32.420" video="mainVideo-overlay" id="subtitle"]]
[[!template text="""To prove that I didn't pull a fast one,""" start="00:16:35.740" video="mainVideo-overlay" id="subtitle"]]
[[!template text="""let's go and see what `describe-char` tells us""" start="00:16:38.761" video="mainVideo-overlay" id="subtitle"]]
[[!template text="""about the depths inside here.""" start="00:16:42.083" video="mainVideo-overlay" id="subtitle"]]
[[!template text="""Let's start here.""" start="00:16:44.660" video="mainVideo-overlay" id="subtitle"]]
[[!template text="""Okay, so inside this part here, `std::string`,""" start="00:16:46.460" video="mainVideo-overlay" id="subtitle"]]
[[!template text="""There are two overlays.""" start="00:16:52.820" video="mainVideo-overlay" id="subtitle"]]
[[!template text="""One of them is of depth 1, and the other is of depth 2,""" start="00:16:54.980" video="mainVideo-overlay" id="subtitle"]]
[[!template text="""which makes sense, because depth 1 is going to be""" start="00:16:57.781" video="mainVideo-overlay" id="subtitle"]]
[[!template text="""from about here to here,""" start="00:17:00.602" video="mainVideo-overlay" id="subtitle"]]
[[!template text="""and depth 2 is going to be from about here to this area.""" start="00:17:02.012" video="mainVideo-overlay" id="subtitle"]]
[[!template text="""So it's reasonable that there should be two,""" start="00:17:07.660" video="mainVideo-overlay" id="subtitle"]]
[[!template text="""and that's what we expect.""" start="00:17:10.830" video="mainVideo-overlay" id="subtitle"]]

Hiding to a target depth

[[!template new="1" text="""Now that we've marked the nested types with their depths,""" start="00:17:12.660" video="mainVideo-overlay" id="subtitle"]]
[[!template text="""let's experiment with hiding details.""" start="00:17:17.354" video="mainVideo-overlay" id="subtitle"]]
[[!template text="""This fragment of code takes a user-supplied depth,""" start="00:17:21.380" video="mainVideo-overlay" id="subtitle"]]
[[!template text="""in this case 2, and will hide,""" start="00:17:26.774" video="mainVideo-overlay" id="subtitle"]]
[[!template text="""based on those markings""" start="00:17:29.086" video="mainVideo-overlay" id="subtitle"]]
[[!template text="""that we've already made on the overlays,""" start="00:17:30.876" video="mainVideo-overlay" id="subtitle"]]
[[!template text="""the custom depth properties.""" start="00:17:33.933" video="mainVideo-overlay" id="subtitle"]]
[[!template text="""We'll take those and apply your requested level of detail.""" start="00:17:36.020" video="mainVideo-overlay" id="subtitle"]]
[[!template text="""So let's try it out.""" start="00:17:40.020" video="mainVideo-overlay" id="subtitle"]]
[[!template text="""Depth 2.""" start="00:17:42.020" video="mainVideo-overlay" id="subtitle"]]
[[!template text="""All right, that hid everything under the `std::map`,""" start="00:17:43.020" video="mainVideo-overlay" id="subtitle"]]
[[!template text="""so the deepest level.""" start="00:17:46.006" video="mainVideo-overlay" id="subtitle"]]
[[!template text="""If we make it 1, we should get a level higher than that.""" start="00:17:47.260" video="mainVideo-overlay" id="subtitle"]]
[[!template text="""So now level 1 and below are hidden.""" start="00:17:52.140" video="mainVideo-overlay" id="subtitle"]]
[[!template text="""Now if we put it back to 3, it should reveal everything.""" start="00:17:54.540" video="mainVideo-overlay" id="subtitle"]]
[[!template text="""So that's what we're going to use in our minor mode.""" start="00:17:59.660" video="mainVideo-overlay" id="subtitle"]]

Demo

[[!template new="1" text="""Let's have a demo.""" start="00:18:04.900" video="mainVideo-overlay" id="subtitle"]]
[[!template text="""We're going to revisit the initial example""" start="00:18:05.900" video="mainVideo-overlay" id="subtitle"]]
[[!template text="""with the minor mode installed.""" start="00:18:08.539" video="mainVideo-overlay" id="subtitle"]]
[[!template text="""Now we're going to have a compilation filter""" start="00:18:10.380" video="mainVideo-overlay" id="subtitle"]]
[[!template text="""that will run on every chunk of output""" start="00:18:12.102" video="mainVideo-overlay" id="subtitle"]]
[[!template text="""produced by the compiler.""" start="00:18:13.594" video="mainVideo-overlay" id="subtitle"]]
[[!template text="""It's going to add those overlays""" start="00:18:15.780" video="mainVideo-overlay" id="subtitle"]]
[[!template text="""with the line breaks and the indentation.""" start="00:18:17.850" video="mainVideo-overlay" id="subtitle"]]
[[!template text="""It's also going to add overlays""" start="00:18:20.420" video="mainVideo-overlay" id="subtitle"]]
[[!template text="""that mark up the nested types""" start="00:18:22.207" video="mainVideo-overlay" id="subtitle"]]
[[!template text="""with the depths for each region.""" start="00:18:23.881" video="mainVideo-overlay" id="subtitle"]]
[[!template text="""Let's add the hook for `tspew-mode`.""" start="00:18:26.220" video="mainVideo-overlay" id="subtitle"]]
[[!template text="""And now we can compile again.""" start="00:18:31.580" video="mainVideo-overlay" id="subtitle"]]
[[!template text="""All right, we can already see""" start="00:18:38.220" video="mainVideo-overlay" id="subtitle"]]
[[!template text="""that these things are formatted a little bit better""" start="00:18:41.504" video="mainVideo-overlay" id="subtitle"]]
[[!template text="""than they were before.""" start="00:18:47.196" video="mainVideo-overlay" id="subtitle"]]
[[!template text="""They're not all on one line.""" start="00:18:49.180" video="mainVideo-overlay" id="subtitle"]]
[[!template text="""Things are getting kind of lined up here.""" start="00:18:50.180" video="mainVideo-overlay" id="subtitle"]]
[[!template text="""Here's a good example.""" start="00:18:53.580" video="mainVideo-overlay" id="subtitle"]]
[[!template text="""And here's our big ugly one from before""" start="00:19:05.620" video="mainVideo-overlay" id="subtitle"]]
[[!template text="""with all the characters in it.""" start="00:19:08.638" video="mainVideo-overlay" id="subtitle"]]
[[!template text="""Let's try hiding some of this information.""" start="00:19:10.900" video="mainVideo-overlay" id="subtitle"]]
[[!template text="""We'll just slowly decrease the level of detail""" start="00:19:14.500" video="mainVideo-overlay" id="subtitle"]]
[[!template text="""and you can see how it works.""" start="00:19:17.432" video="mainVideo-overlay" id="subtitle"]]
[[!template text="""Over here, where there's these ellipses""" start="00:19:19.740" video="mainVideo-overlay" id="subtitle"]]
[[!template text="""next to string constant, the &quot;...&quot; there,""" start="00:19:22.334" video="mainVideo-overlay" id="subtitle"]]
[[!template text="""that's where we are starting to hide information""" start="00:19:25.460" video="mainVideo-overlay" id="subtitle"]]
[[!template text="""and go to the next level.""" start="00:19:30.387" video="mainVideo-overlay" id="subtitle"]]
[[!template text="""Hiding more, hiding more, hiding more.""" start="00:19:32.900" video="mainVideo-overlay" id="subtitle"]]
[[!template text="""Now we can go back and start adding it back.""" start="00:19:36.460" video="mainVideo-overlay" id="subtitle"]]
[[!template text="""You can see here now we just have about four layers,""" start="00:19:38.220" video="mainVideo-overlay" id="subtitle"]]
[[!template text="""which is a lot easier to understand.""" start="00:19:42.737" video="mainVideo-overlay" id="subtitle"]]
[[!template text="""And if we start understanding what it is""" start="00:19:45.540" video="mainVideo-overlay" id="subtitle"]]
[[!template text="""and we need more detail, we can just increase detail again.""" start="00:19:47.734" video="mainVideo-overlay" id="subtitle"]]
[[!template text="""And every time we increase or decrease detail,""" start="00:19:52.180" video="mainVideo-overlay" id="subtitle"]]
[[!template text="""it reformats so it still stays kind of consolidated""" start="00:19:55.403" video="mainVideo-overlay" id="subtitle"]]
[[!template text="""and nice looking.""" start="00:19:58.900" video="mainVideo-overlay" id="subtitle"]]
[[!template text="""Let's increase it a little bit more.""" start="00:19:59.900" video="mainVideo-overlay" id="subtitle"]]
[[!template text="""Okay, so you can see how that worked.""" start="00:20:02.060" video="mainVideo-overlay" id="subtitle"]]
[[!template text="""Let's go back to our presentation.""" start="00:20:04.540" video="mainVideo-overlay" id="subtitle"]]
[[!template text="""All right.""" start="00:20:08.340" video="mainVideo-overlay" id="subtitle"]]

Conclusion

[[!template new="1" text="""In conclusion, we saw how we could solve""" start="00:20:10.220" video="mainVideo-overlay" id="subtitle"]]
[[!template text="""a real problem for C++ programmers""" start="00:20:12.997" video="mainVideo-overlay" id="subtitle"]]
[[!template text="""by combining several Emacs features: overlays,""" start="00:20:15.368" video="mainVideo-overlay" id="subtitle"]]
[[!template text="""compilation mode extensions,""" start="00:20:18.535" video="mainVideo-overlay" id="subtitle"]]
[[!template text="""and balanced expression navigation using syntax tables.""" start="00:20:20.490" video="mainVideo-overlay" id="subtitle"]]
[[!template text="""Emacs is often compared unfavorably""" start="00:20:25.700" video="mainVideo-overlay" id="subtitle"]]
[[!template text="""to newer IDEs and editors with slicker user interfaces.""" start="00:20:27.979" video="mainVideo-overlay" id="subtitle"]]
[[!template text="""What Emacs has that they don't is powerful abstractions,""" start="00:20:32.220" video="mainVideo-overlay" id="subtitle"]]
[[!template text="""tons of libraries, and decades of work""" start="00:20:36.387" video="mainVideo-overlay" id="subtitle"]]
[[!template text="""by some of the luminaries in the field of software.""" start="00:20:38.863" video="mainVideo-overlay" id="subtitle"]]
[[!template text="""I think that this project would have been much harder to do""" start="00:20:42.100" video="mainVideo-overlay" id="subtitle"]]
[[!template text="""in a prettier but less powerful environment.""" start="00:20:45.344" video="mainVideo-overlay" id="subtitle"]]
[[!template text="""In short, there's plenty of hope for Emacs.""" start="00:20:48.020" video="mainVideo-overlay" id="subtitle"]]
[[!template text="""Thank you.""" start="00:20:50.860" video="mainVideo-overlay" id="subtitle"]]



Captioner: sachac

Questions or comments? Please e-mail [emacsconf-org-private@gnu.org](mailto:emacsconf-org-private@gnu.org?subject=Comment%20for%20EmacsConf%202023%20overlay%3A%20Improving%20compiler%20diagnostics%20with%20overlays)


<!-- End of emacsconf-publish-after-page -->