summaryrefslogtreecommitdiffstats
path: root/2023/info/overlay-after.md
diff options
context:
space:
mode:
Diffstat (limited to '2023/info/overlay-after.md')
-rw-r--r--2023/info/overlay-after.md78
1 files changed, 78 insertions, 0 deletions
diff --git a/2023/info/overlay-after.md b/2023/info/overlay-after.md
index 0bf7e9a4..77329547 100644
--- a/2023/info/overlay-after.md
+++ b/2023/info/overlay-after.md
@@ -4,6 +4,9 @@
<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"]]
@@ -15,6 +18,9 @@
[[!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"]]
@@ -47,6 +53,9 @@
[[!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"]]
@@ -57,6 +66,9 @@
[[!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"]]
@@ -69,6 +81,9 @@
[[!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"]]
@@ -76,6 +91,9 @@
[[!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"]]
@@ -88,10 +106,16 @@
[[!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"]]
@@ -107,6 +131,9 @@
[[!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"]]
@@ -121,12 +148,18 @@
[[!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"]]
@@ -145,6 +178,9 @@
[[!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"]]
@@ -179,10 +215,16 @@
[[!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"]]
@@ -190,6 +232,9 @@
[[!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"]]
@@ -199,6 +244,9 @@
[[!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"]]
@@ -223,6 +271,9 @@
[[!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"]]
@@ -253,6 +304,9 @@
[[!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"]]
@@ -263,6 +317,9 @@
[[!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"]]
@@ -276,6 +333,9 @@
[[!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"]]
@@ -301,6 +361,9 @@
[[!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"]]
@@ -312,12 +375,18 @@
[[!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"]]
@@ -355,6 +424,9 @@
[[!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"]]
@@ -371,6 +443,9 @@
[[!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"]]
@@ -412,6 +487,9 @@
[[!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"]]