summaryrefslogtreecommitdiffstats
path: root/2026/info/align-after.md
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--2026/info/align-after.md434
1 files changed, 434 insertions, 0 deletions
diff --git a/2026/info/align-after.md b/2026/info/align-after.md
index bf3b05ec..f55af0e9 100644
--- a/2026/info/align-after.md
+++ b/2026/info/align-after.md
@@ -1,6 +1,440 @@
<!-- Automatically generated by emacsconf-publish-after-page -->
+<div class="transcript transcript-mainVideo"><a name="align-mainVideo-transcript"></a><h1>Transcript</h1>
+
+<div class="transcript-heading">[[!template new="1" text="""Lining things up: Introduction""" start="00:00:00.617" video="mainVideo-align" id="subtitle"]]</div><div>[[!template new="1" text="""Let's talk about aligning things vertically""" start="00:00:00.617" video="mainVideo-align" id="subtitle"]]
+[[!template text="""in Emacs\.""" start="00:00:03.139" video="mainVideo-align" id="subtitle"]]
+[[!template text="""It's often the case we want to line up text""" start="00:00:04.740" video="mainVideo-align" id="subtitle"]]
+[[!template text="""vertically in Emacs,""" start="00:00:06.821" video="mainVideo-align" id="subtitle"]]
+[[!template text="""typically for aesthetic purposes""" start="00:00:08.382" video="mainVideo-align" id="subtitle"]]
+[[!template text="""to make paragraphs or tables""" start="00:00:10.884" video="mainVideo-align" id="subtitle"]]
+[[!template text="""or code easier to read\.""" start="00:00:12.885" video="mainVideo-align" id="subtitle"]]
+[[!template text="""I'm embarrassed to say that I used to do""" start="00:00:15.340" video="mainVideo-align" id="subtitle"]]
+[[!template text="""these kinds of things in a painfully manual way""" start="00:00:17.268" video="mainVideo-align" id="subtitle"]]
+[[!template text="""because I hadn't read the documentation enough""" start="00:00:19.910" video="mainVideo-align" id="subtitle"]]
+[[!template text="""and I didn't realize there were features for it\.""" start="00:00:23.072" video="mainVideo-align" id="subtitle"]]
+[[!template text="""I want to introduce you to these features today""" start="00:00:25.440" video="mainVideo-align" id="subtitle"]]
+[[!template text="""and then use them as a launching point""" start="00:00:28.696" video="mainVideo-align" id="subtitle"]]
+[[!template text="""for a discussion of customizations and extensions""" start="00:00:31.489" video="mainVideo-align" id="subtitle"]]
+[[!template text="""using Emacs Lisp\.""" start="00:00:34.391" video="mainVideo-align" id="subtitle"]]
+[[!template text="""We're specifically going to""" start="00:00:36.052" video="mainVideo-align" id="subtitle"]]
+[[!template text="""talk about aligning the sides of paragraphs""" start="00:00:37.093" video="mainVideo-align" id="subtitle"]]
+[[!template text="""or comments, aligning columns of text for tables""" start="00:00:39.994" video="mainVideo-align" id="subtitle"]]
+[[!template text="""or in code, how to recognize columns""" start="00:00:44.297" video="mainVideo-align" id="subtitle"]]
+[[!template text="""using regular expressions, and then finally,""" start="00:00:48.460" video="mainVideo-align" id="subtitle"]]
+[[!template text="""doing the same thing""" start="00:00:52.082" video="mainVideo-align" id="subtitle"]]
+[[!template text="""but recognizing columns using parsers,""" start="00:00:53.403" video="mainVideo-align" id="subtitle"]]
+[[!template text="""which are more powerful than regular expressions\.""" start="00:00:55.564" video="mainVideo-align" id="subtitle"]]
+
+</div><div class="transcript-heading">[[!template new="1" text="""Terminology: justification, indentation, column alignment""" start="00:01:00.348" video="mainVideo-align" id="subtitle"]]</div><div>[[!template new="1" text="""But first, some terminology\.""" start="00:01:00.348" video="mainVideo-align" id="subtitle"]]
+[[!template text="""Left justification is just putting whitespace on""" start="00:01:03.891" video="mainVideo-align" id="subtitle"]]
+[[!template text="""the left hand side the same amount on every line\.""" start="00:01:07.473" video="mainVideo-align" id="subtitle"]]
+[[!template text="""This is different, in my view, from indentation,""" start="00:01:10.995" video="mainVideo-align" id="subtitle"]]
+[[!template text="""which is using the amount of whitespace on the""" start="00:01:16.938" video="mainVideo-align" id="subtitle"]]
+[[!template text="""left hand side to indicate something semantic""" start="00:01:20.239" video="mainVideo-align" id="subtitle"]]
+[[!template text="""about what you're looking at""" start="00:01:22.901" video="mainVideo-align" id="subtitle"]]
+[[!template text="""to give a cue to the reader\.""" start="00:01:23.901" video="mainVideo-align" id="subtitle"]]
+[[!template text="""For example, in the paragraph that we have here,""" start="00:01:25.842" video="mainVideo-align" id="subtitle"]]
+[[!template text="""the first line is indented""" start="00:01:30.825" video="mainVideo-align" id="subtitle"]]
+[[!template text="""because it begins a paragraph\.""" start="00:01:32.426" video="mainVideo-align" id="subtitle"]]
+[[!template text="""So that gives you a cue""" start="00:01:34.366" video="mainVideo-align" id="subtitle"]]
+[[!template text="""that a paragraph has begun\.""" start="00:01:35.227" video="mainVideo-align" id="subtitle"]]
+[[!template text="""You might also be using indentation in code""" start="00:01:37.187" video="mainVideo-align" id="subtitle"]]
+[[!template text="""to indicate the level of nesting""" start="00:01:40.188" video="mainVideo-align" id="subtitle"]]
+[[!template text="""or which pieces of code are considered""" start="00:01:43.409" video="mainVideo-align" id="subtitle"]]
+[[!template text="""parents of other pieces of code,""" start="00:01:46.150" video="mainVideo-align" id="subtitle"]]
+[[!template text="""which is inside a block,""" start="00:01:47.751" video="mainVideo-align" id="subtitle"]]
+[[!template text="""which is outside and so forth\.""" start="00:01:48.911" video="mainVideo-align" id="subtitle"]]
+[[!template text="""Now the behavior of indentation""" start="00:01:51.352" video="mainVideo-align" id="subtitle"]]
+[[!template text="""is highly mode-dependent""" start="00:01:52.592" video="mainVideo-align" id="subtitle"]]
+[[!template text="""and is really complex enough that it deserves""" start="00:01:54.937" video="mainVideo-align" id="subtitle"]]
+[[!template text="""a presentation of its own,""" start="00:01:58.119" video="mainVideo-align" id="subtitle"]]
+[[!template text="""so I won't do that today\.""" start="00:01:59.760" video="mainVideo-align" id="subtitle"]]
+[[!template text="""We'll move on to right justification,""" start="00:02:01.302" video="mainVideo-align" id="subtitle"]]
+[[!template text="""the mirror of left justification\.""" start="00:02:05.965" video="mainVideo-align" id="subtitle"]]
+[[!template text="""But it's a little tricky in that to get the""" start="00:02:08.627" video="mainVideo-align" id="subtitle"]]
+[[!template text="""non-whitespace text on the right-hand side""" start="00:02:10.848" video="mainVideo-align" id="subtitle"]]
+[[!template text="""lined up usually means inserting some space""" start="00:02:13.590" video="mainVideo-align" id="subtitle"]]
+[[!template text="""at some point in the middle\.""" start="00:02:16.492" video="mainVideo-align" id="subtitle"]]
+[[!template text="""The manual usually calls this just &quot;justification\.&quot;""" start="00:02:19.593" video="mainVideo-align" id="subtitle"]]
+[[!template text="""We will be spending some time on it\.""" start="00:02:22.955" video="mainVideo-align" id="subtitle"]]
+[[!template text="""And then finally, column alignment\.""" start="00:02:25.176" video="mainVideo-align" id="subtitle"]]
+[[!template text="""To me, this is the most interesting one\.""" start="00:02:28.697" video="mainVideo-align" id="subtitle"]]
+[[!template text="""This is recognizing portions of lines using""" start="00:02:31.078" video="mainVideo-align" id="subtitle"]]
+[[!template text="""regular expressions or eventually parsers and""" start="00:02:35.120" video="mainVideo-align" id="subtitle"]]
+[[!template text="""lining them up either on the left-hand side or""" start="00:02:38.282" video="mainVideo-align" id="subtitle"]]
+[[!template text="""the right-hand side in what looks like a table or""" start="00:02:40.543" video="mainVideo-align" id="subtitle"]]
+[[!template text="""something like that\.""" start="00:02:43.965" video="mainVideo-align" id="subtitle"]]
+[[!template text="""And we're going to spend a lot of time on this one\.""" start="00:02:44.625" video="mainVideo-align" id="subtitle"]]
+[[!template text="""But first, we'll talk about alignment in text modes\.""" start="00:02:49.783" video="mainVideo-align" id="subtitle"]]
+
+</div><div class="transcript-heading">[[!template new="1" text="""Alignment in text modes: Fill (and justification)""" start="00:02:55.326" video="mainVideo-align" id="subtitle"]]</div><div>[[!template new="1" text="""There is a feature called fill in Emacs, and what""" start="00:02:55.326" video="mainVideo-align" id="subtitle"]]
+[[!template text="""it is is a way of moving words between lines with""" start="00:02:58.268" video="mainVideo-align" id="subtitle"]]
+[[!template text="""a goal called the `fill-column` and trying to get""" start="00:03:02.930" video="mainVideo-align" id="subtitle"]]
+[[!template text="""the lines as long as possible""" start="00:03:07.093" video="mainVideo-align" id="subtitle"]]
+[[!template text="""while still being below the fill column""" start="00:03:09.134" video="mainVideo-align" id="subtitle"]]
+[[!template text="""by moving words between them\.""" start="00:03:12.316" video="mainVideo-align" id="subtitle"]]
+[[!template text="""The command `fill-paragraph` is bound to `M-q`\.""" start="00:03:15.418" video="mainVideo-align" id="subtitle"]]
+[[!template text="""If you add a numeric prefix""" start="00:03:18.409" video="mainVideo-align" id="subtitle"]]
+[[!template text="""like `C-u M-q`, it will right-justify""" start="00:03:20.091" video="mainVideo-align" id="subtitle"]]
+[[!template text="""to the fill-column if you've set it\.""" start="00:03:25.558" video="mainVideo-align" id="subtitle"]]
+[[!template text="""Fill can also infer an initial prefix""" start="00:03:30.381" video="mainVideo-align" id="subtitle"]]
+[[!template text="""for each line by looking at the existing text,""" start="00:03:33.262" video="mainVideo-align" id="subtitle"]]
+[[!template text="""so that filling takes place""" start="00:03:36.083" video="mainVideo-align" id="subtitle"]]
+[[!template text="""only with respect to the remaining words\.""" start="00:03:37.484" video="mainVideo-align" id="subtitle"]]
+[[!template text="""If you didn't set a fill prefix manually, fill is""" start="00:03:41.105" video="mainVideo-align" id="subtitle"]]
+[[!template text="""going to try to infer one for each line from the""" start="00:03:44.306" video="mainVideo-align" id="subtitle"]]
+[[!template text="""leading characters of the existing lines,""" start="00:03:46.987" video="mainVideo-align" id="subtitle"]]
+[[!template text="""which are typically whitespace, but not always\.""" start="00:03:48.968" video="mainVideo-align" id="subtitle"]]
+[[!template text="""This is known as adaptive filling\.""" start="00:03:51.429" video="mainVideo-align" id="subtitle"]]
+[[!template text="""There is a `left-margin` variable in each buffer""" start="00:03:55.690" video="mainVideo-align" id="subtitle"]]
+[[!template text="""that you can set, and every time you run `fill-paragraph`,""" start="00:03:59.568" video="mainVideo-align" id="subtitle"]]
+[[!template text="""the left-hand side will be justified at least to that point\.""" start="00:04:02.868" video="mainVideo-align" id="subtitle"]]
+[[!template text="""And then in addition, you can use commands""" start="00:04:06.601" video="mainVideo-align" id="subtitle"]]
+[[!template text="""`set-left-margin` and `set-right-margin`""" start="00:04:09.201" video="mainVideo-align" id="subtitle"]]
+[[!template text="""to control the padding at different words,""" start="00:04:11.534" video="mainVideo-align" id="subtitle"]]
+[[!template text="""so that you can vary it a little bit""" start="00:04:13.701" video="mainVideo-align" id="subtitle"]]
+[[!template text="""more granularly than the full buffer\.""" start="00:04:16.134" video="mainVideo-align" id="subtitle"]]
+[[!template text="""Let's look at some examples\.""" start="00:04:19.081" video="mainVideo-align" id="subtitle"]]
+[[!template text="""First note that this very long run-on line here""" start="00:04:26.420" video="mainVideo-align" id="subtitle"]]
+[[!template text="""begins with two spaces\.""" start="00:04:29.989" video="mainVideo-align" id="subtitle"]]
+[[!template text="""When we hit `M-q`, like that, and line""" start="00:04:31.970" video="mainVideo-align" id="subtitle"]]
+[[!template text="""everything up, now these lines are filled\.""" start="00:04:35.232" video="mainVideo-align" id="subtitle"]]
+[[!template text="""Instead of one line, there's five, and each line""" start="00:04:38.635" video="mainVideo-align" id="subtitle"]]
+[[!template text="""begins with that same pair of spaces\.""" start="00:04:41.837" video="mainVideo-align" id="subtitle"]]
+[[!template text="""This is adaptive fill at work\.""" start="00:04:44.739" video="mainVideo-align" id="subtitle"]]
+[[!template text="""Let's try right-justifying with `C-u M-q`\.""" start="00:04:47.581" video="mainVideo-align" id="subtitle"]]
+[[!template text="""Now you can see that all lines except for the""" start="00:04:52.197" video="mainVideo-align" id="subtitle"]]
+[[!template text="""last one are lined up on the right-hand side\.""" start="00:04:54.078" video="mainVideo-align" id="subtitle"]]
+[[!template text="""Let's try setting the global left margin""" start="00:04:57.760" video="mainVideo-align" id="subtitle"]]
+[[!template text="""in this buffer\.""" start="00:05:00.843" video="mainVideo-align" id="subtitle"]]
+[[!template text="""`(setq left-margin 5)`\.""" start="00:05:03.405" video="mainVideo-align" id="subtitle"]]
+[[!template text="""And if I fill again, now there's at least five""" start="00:05:08.909" video="mainVideo-align" id="subtitle"]]
+[[!template text="""spaces on the left side\.""" start="00:05:14.814" video="mainVideo-align" id="subtitle"]]
+[[!template text="""Maybe we want a couple of lines to have extra""" start="00:05:16.960" video="mainVideo-align" id="subtitle"]]
+[[!template text="""left margin\.""" start="00:05:20.157" video="mainVideo-align" id="subtitle"]]
+[[!template text="""Then we can select them, pick a region, say this""" start="00:05:21.577" video="mainVideo-align" id="subtitle"]]
+[[!template text="""part, and now if we use the command""" start="00:05:25.461" video="mainVideo-align" id="subtitle"]]
+[[!template text="""`set-left-margin` and we set it to, say, 7,""" start="00:05:30.906" video="mainVideo-align" id="subtitle"]]
+[[!template text="""now we have seven spaces on the left-hand side""" start="00:05:38.953" video="mainVideo-align" id="subtitle"]]
+[[!template text="""but just for these and if I run `M-q` again,""" start="00:05:41.215" video="mainVideo-align" id="subtitle"]]
+[[!template text="""we get actually the global 5 left margin""" start="00:05:45.725" video="mainVideo-align" id="subtitle"]]
+[[!template text="""plus that additional 7 that we asked for\.""" start="00:05:51.189" video="mainVideo-align" id="subtitle"]]
+[[!template text="""We can do the same thing with the right margin\.""" start="00:05:55.331" video="mainVideo-align" id="subtitle"]]
+[[!template text="""Let's just quickly try that\.""" start="00:05:57.633" video="mainVideo-align" id="subtitle"]]
+[[!template text="""If I set that right margin here, and I set it to""" start="00:06:00.435" video="mainVideo-align" id="subtitle"]]
+[[!template text="""say, I don't know, another 7 maybe, and then I""" start="00:06:06.138" video="mainVideo-align" id="subtitle"]]
+[[!template text="""fill again, then these last two lines""" start="00:06:10.381" video="mainVideo-align" id="subtitle"]]
+[[!template text="""have extra margin,""" start="00:06:14.063" video="mainVideo-align" id="subtitle"]]
+[[!template text="""just as the first two had extra margin on the""" start="00:06:16.468" video="mainVideo-align" id="subtitle"]]
+[[!template text="""left-hand side\.""" start="00:06:19.550" video="mainVideo-align" id="subtitle"]]
+[[!template text="""So that's the fill feature\.""" start="00:06:21.111" video="mainVideo-align" id="subtitle"]]
+
+</div><div class="transcript-heading">[[!template new="1" text="""Column alignment""" start="00:06:26.134" video="mainVideo-align" id="subtitle"]]</div><div>[[!template new="1" text="""We can also do column alignment in text\.""" start="00:06:26.134" video="mainVideo-align" id="subtitle"]]
+[[!template text="""Let's have a look\.""" start="00:06:28.596" video="mainVideo-align" id="subtitle"]]
+[[!template text="""There are two kind of ways that you can do column""" start="00:06:30.036" video="mainVideo-align" id="subtitle"]]
+[[!template text="""alignment easily\.""" start="00:06:31.958" video="mainVideo-align" id="subtitle"]]
+[[!template text="""One of them is this interesting built-in feature""" start="00:06:33.418" video="mainVideo-align" id="subtitle"]]
+[[!template text="""where in text mode, if you use the tab key, it's""" start="00:06:36.921" video="mainVideo-align" id="subtitle"]]
+[[!template text="""going to bring you to the beginning of""" start="00:06:41.363" video="mainVideo-align" id="subtitle"]]
+[[!template text="""every word in the previous line\.""" start="00:06:43.265" video="mainVideo-align" id="subtitle"]]
+[[!template text="""So we tab here, we can say some text here\.""" start="00:06:45.905" video="mainVideo-align" id="subtitle"]]
+[[!template text="""And every\.\.\. I just tabbed in between those words\.""" start="00:06:50.705" video="mainVideo-align" id="subtitle"]]
+[[!template text="""So it makes it really easy to line things up\.""" start="00:06:53.265" video="mainVideo-align" id="subtitle"]]
+[[!template text="""There's also the align command, and there's a""" start="00:06:58.380" video="mainVideo-align" id="subtitle"]]
+[[!template text="""whole align subsystem which we'll be getting into here\.""" start="00:07:01.117" video="mainVideo-align" id="subtitle"]]
+[[!template text="""By default, it will line up words into columns""" start="00:07:05.098" video="mainVideo-align" id="subtitle"]]
+[[!template text="""with the align command, the `M-x align`, if you""" start="00:07:08.320" video="mainVideo-align" id="subtitle"]]
+[[!template text="""select a region first\.""" start="00:07:12.941" video="mainVideo-align" id="subtitle"]]
+[[!template text="""There are different default rules for each mode,""" start="00:07:14.768" video="mainVideo-align" id="subtitle"]]
+[[!template text="""so I'm just going to show you the text mode one\.""" start="00:07:17.649" video="mainVideo-align" id="subtitle"]]
+[[!template text="""Usually, in most modes, there are some special""" start="00:07:21.250" video="mainVideo-align" id="subtitle"]]
+[[!template text="""alignment commands or special alignment rules,""" start="00:07:24.691" video="mainVideo-align" id="subtitle"]]
+[[!template text="""I should say, that are more advanced,""" start="00:07:27.051" video="mainVideo-align" id="subtitle"]]
+[[!template text="""and that you can get by using a numeric prefix\.""" start="00:07:29.492" video="mainVideo-align" id="subtitle"]]
+[[!template text="""So let's try this out\.""" start="00:07:33.213" video="mainVideo-align" id="subtitle"]]
+[[!template text="""We go here and edit this thing\.""" start="00:07:35.113" video="mainVideo-align" id="subtitle"]]
+[[!template text="""If I select this whole thing""" start="00:07:37.114" video="mainVideo-align" id="subtitle"]]
+[[!template text="""and I say `M-x align`,""" start="00:07:39.254" video="mainVideo-align" id="subtitle"]]
+[[!template text="""then it aligns everything on spaces\.""" start="00:07:42.780" video="mainVideo-align" id="subtitle"]]
+[[!template text="""Now the interesting extra rule that you can use""" start="00:07:45.262" video="mainVideo-align" id="subtitle"]]
+[[!template text="""aligns things on decimal points\.""" start="00:07:47.844" video="mainVideo-align" id="subtitle"]]
+[[!template text="""It's actually designed for currencies\.""" start="00:07:49.625" video="mainVideo-align" id="subtitle"]]
+[[!template text="""So if I say `C--` \[control dash\],""" start="00:07:51.827" video="mainVideo-align" id="subtitle"]]
+[[!template text="""which is a negative prefix argument,""" start="00:07:54.669" video="mainVideo-align" id="subtitle"]]
+[[!template text="""and I run `M-x align` again,""" start="00:07:57.271" video="mainVideo-align" id="subtitle"]]
+[[!template text="""now these numbers on the right hand side are""" start="00:08:00.967" video="mainVideo-align" id="subtitle"]]
+[[!template text="""actually aligned on their decimal points\.""" start="00:08:02.568" video="mainVideo-align" id="subtitle"]]
+[[!template text="""For more information, you can check out""" start="00:08:05.089" video="mainVideo-align" id="subtitle"]]
+[[!template text="""`align-rules-list`, a variable that lists""" start="00:08:06.589" video="mainVideo-align" id="subtitle"]]
+[[!template text="""all of the alignment rules""" start="00:08:09.770" video="mainVideo-align" id="subtitle"]]
+[[!template text="""that are in Emacs by default for each mode\.""" start="00:08:11.091" video="mainVideo-align" id="subtitle"]]
+
+</div><div class="transcript-heading">[[!template new="1" text="""Alignment in code: Fill in comments""" start="00:08:15.733" video="mainVideo-align" id="subtitle"]]</div><div>[[!template new="1" text="""Now, alignment in code\.""" start="00:08:15.733" video="mainVideo-align" id="subtitle"]]
+[[!template text="""This may be a little bit more interesting\.""" start="00:08:17.533" video="mainVideo-align" id="subtitle"]]
+[[!template text="""There's still fill in code, mostly in comments,""" start="00:08:19.474" video="mainVideo-align" id="subtitle"]]
+[[!template text="""but column alignment is huge\.""" start="00:08:24.776" video="mainVideo-align" id="subtitle"]]
+[[!template text="""So let's look at fill in code\.""" start="00:08:27.097" video="mainVideo-align" id="subtitle"]]
+[[!template text="""Basically this is in comments,""" start="00:08:29.297" video="mainVideo-align" id="subtitle"]]
+[[!template text="""but let's check this out\.""" start="00:08:31.238" video="mainVideo-align" id="subtitle"]]
+[[!template text="""Let's see what this comment looks like\.""" start="00:08:32.578" video="mainVideo-align" id="subtitle"]]
+[[!template text="""This time the lines don't begin with spaces\.""" start="00:08:34.438" video="mainVideo-align" id="subtitle"]]
+[[!template text="""They begin with semicolons\.""" start="00:08:37.619" video="mainVideo-align" id="subtitle"]]
+[[!template text="""And if I do `M-q` now and call""" start="00:08:39.820" video="mainVideo-align" id="subtitle"]]
+[[!template text="""`fill-paragraph`, it still works,""" start="00:08:43.460" video="mainVideo-align" id="subtitle"]]
+[[!template text="""even though the lines""" start="00:08:46.061" video="mainVideo-align" id="subtitle"]]
+[[!template text="""all began with semicolons and it doesn't try to""" start="00:08:46.861" video="mainVideo-align" id="subtitle"]]
+[[!template text="""insert the semicolons in the middle\.""" start="00:08:48.901" video="mainVideo-align" id="subtitle"]]
+[[!template text="""It understands that these are special\.""" start="00:08:50.342" video="mainVideo-align" id="subtitle"]]
+[[!template text="""Let's try setting the fill column here\.""" start="00:08:52.899" video="mainVideo-align" id="subtitle"]]
+[[!template text="""Let's move back to about right here\.""" start="00:08:55.161" video="mainVideo-align" id="subtitle"]]
+[[!template text="""`C-x f` sets the fill column\.""" start="00:08:56.802" video="mainVideo-align" id="subtitle"]]
+[[!template text="""By default, it's 70\.""" start="00:08:59.064" video="mainVideo-align" id="subtitle"]]
+[[!template text="""We're sending it to 58 now\.""" start="00:09:00.025" video="mainVideo-align" id="subtitle"]]
+[[!template text="""Now if I do `M-q` again, it squeezed the""" start="00:09:02.007" video="mainVideo-align" id="subtitle"]]
+[[!template text="""paragraph down, but the other interesting thing""" start="00:09:05.770" video="mainVideo-align" id="subtitle"]]
+[[!template text="""that it did is it added two semicolons at the""" start="00:09:07.692" video="mainVideo-align" id="subtitle"]]
+[[!template text="""beginning of the last line\.""" start="00:09:09.834" video="mainVideo-align" id="subtitle"]]
+[[!template text="""That's adaptive fill at work\.""" start="00:09:11.395" video="mainVideo-align" id="subtitle"]]
+
+</div><div class="transcript-heading">[[!template new="1" text="""Column alignment for code elements""" start="00:09:17.020" video="mainVideo-align" id="subtitle"]]</div><div>[[!template new="1" text="""Now let's talk about column alignment in code\.""" start="00:09:17.020" video="mainVideo-align" id="subtitle"]]
+[[!template text="""I'm going to use a specific example drawn from""" start="00:09:21.063" video="mainVideo-align" id="subtitle"]]
+[[!template text="""real C++ code defining the bits of a register""" start="00:09:23.185" video="mainVideo-align" id="subtitle"]]
+[[!template text="""using a bitmask\.""" start="00:09:28.809" video="mainVideo-align" id="subtitle"]]
+[[!template text="""The C++ code on the right hand side is a""" start="00:09:32.712" video="mainVideo-align" id="subtitle"]]
+[[!template text="""definition of the bit in a hardware register\.""" start="00:09:35.634" video="mainVideo-align" id="subtitle"]]
+[[!template text="""You have names on one side, the name of the bit,""" start="00:09:40.217" video="mainVideo-align" id="subtitle"]]
+[[!template text="""and on the right-hand side is a number that's a""" start="00:09:42.898" video="mainVideo-align" id="subtitle"]]
+[[!template text="""power of two, which indicates you can use it as a""" start="00:09:46.079" video="mainVideo-align" id="subtitle"]]
+[[!template text="""mask if you do bitwise arithmetic, and it can""" start="00:09:49.860" video="mainVideo-align" id="subtitle"]]
+[[!template text="""help you change or access the values of bits in a""" start="00:09:52.901" video="mainVideo-align" id="subtitle"]]
+[[!template text="""register in a useful way inside your code\.""" start="00:09:56.982" video="mainVideo-align" id="subtitle"]]
+[[!template text="""We can align the two columns, that is the names""" start="00:10:01.183" video="mainVideo-align" id="subtitle"]]
+[[!template text="""and the values, in two steps using `align-regexp`,""" start="00:10:04.084" video="mainVideo-align" id="subtitle"]]
+[[!template text="""which is a command\.""" start="00:10:06.805" video="mainVideo-align" id="subtitle"]]
+[[!template text="""Let's give this a try,""" start="00:10:11.580" video="mainVideo-align" id="subtitle"]]
+[[!template text="""but we're going to do the first one first\.""" start="00:10:12.448" video="mainVideo-align" id="subtitle"]]
+[[!template text="""This one will align everything""" start="00:10:13.909" video="mainVideo-align" id="subtitle"]]
+[[!template text="""before the equal sign\.""" start="00:10:16.320" video="mainVideo-align" id="subtitle"]]
+[[!template text="""This one here\.""" start="00:10:18.611" video="mainVideo-align" id="subtitle"]]
+[[!template text="""So let's try just running it\.""" start="00:10:19.312" video="mainVideo-align" id="subtitle"]]
+[[!template text="""Now you can see on the right-hand side that""" start="00:10:22.133" video="mainVideo-align" id="subtitle"]]
+[[!template text="""everything before the equal sign has been aligned\.""" start="00:10:24.174" video="mainVideo-align" id="subtitle"]]
+[[!template text="""But we have one thing down at the bottom that""" start="00:10:28.856" video="mainVideo-align" id="subtitle"]]
+[[!template text="""doesn't look very nice, because we also have to""" start="00:10:31.978" video="mainVideo-align" id="subtitle"]]
+[[!template text="""align the numbers on the right-hand side of the""" start="00:10:34.539" video="mainVideo-align" id="subtitle"]]
+[[!template text="""equal sign\.""" start="00:10:36.620" video="mainVideo-align" id="subtitle"]]
+[[!template text="""And so to do that,""" start="00:10:37.940" video="mainVideo-align" id="subtitle"]]
+[[!template text="""I'll uncomment this and we run it again\.""" start="00:10:39.788" video="mainVideo-align" id="subtitle"]]
+[[!template text="""And now MPIE is lined up as well\.""" start="00:10:43.129" video="mainVideo-align" id="subtitle"]]
+[[!template text="""The only difference between""" start="00:10:46.290" video="mainVideo-align" id="subtitle"]]
+[[!template text="""these two commands here""" start="00:10:47.230" video="mainVideo-align" id="subtitle"]]
+[[!template text="""is just this first thing\.""" start="00:10:49.311" video="mainVideo-align" id="subtitle"]]
+[[!template text="""This argument here, it comes after that gnarly""" start="00:10:51.831" video="mainVideo-align" id="subtitle"]]
+[[!template text="""regular expression, is the group number,""" start="00:10:54.992" video="mainVideo-align" id="subtitle"]]
+[[!template text="""so it refers to something called a capture""" start="00:10:58.033" video="mainVideo-align" id="subtitle"]]
+[[!template text="""group inside the regular expression\.""" start="00:11:00.114" video="mainVideo-align" id="subtitle"]]
+[[!template text="""It tells us that we want to first do the""" start="00:11:02.174" video="mainVideo-align" id="subtitle"]]
+[[!template text="""first capture group and then do the second""" start="00:11:06.135" video="mainVideo-align" id="subtitle"]]
+[[!template text="""capture group\.""" start="00:11:07.836" video="mainVideo-align" id="subtitle"]]
+[[!template text="""So the rest of the arguments tell you how many""" start="00:11:09.917" video="mainVideo-align" id="subtitle"]]
+[[!template text="""spaces to use and whether to repeat\.""" start="00:11:11.958" video="mainVideo-align" id="subtitle"]]
+[[!template text="""Let's take a moment to analyze the regular""" start="00:11:17.820" video="mainVideo-align" id="subtitle"]]
+[[!template text="""expression we just used a little bit\.""" start="00:11:19.601" video="mainVideo-align" id="subtitle"]]
+[[!template text="""So they're kind of gnarly-looking and they're""" start="00:11:22.382" video="mainVideo-align" id="subtitle"]]
+[[!template text="""very similar to regular expressions used in other""" start="00:11:26.564" video="mainVideo-align" id="subtitle"]]
+[[!template text="""languages, but not exactly\.""" start="00:11:29.305" video="mainVideo-align" id="subtitle"]]
+[[!template text="""So let's look at this one\.""" start="00:11:31.666" video="mainVideo-align" id="subtitle"]]
+[[!template text="""This one we use\.\.\.""" start="00:11:34.167" video="mainVideo-align" id="subtitle"]]
+[[!template text="""We use these things called character classes,""" start="00:11:37.147" video="mainVideo-align" id="subtitle"]]
+[[!template text="""which is the colon,""" start="00:11:42.029" video="mainVideo-align" id="subtitle"]]
+[[!template text="""the things in the bracket here\.""" start="00:11:43.810" video="mainVideo-align" id="subtitle"]]
+[[!template text="""So instead of listing out all the valid""" start="00:11:45.570" video="mainVideo-align" id="subtitle"]]
+[[!template text="""characters here,""" start="00:11:47.171" video="mainVideo-align" id="subtitle"]]
+[[!template text="""we put it using this special syntax\.""" start="00:11:48.652" video="mainVideo-align" id="subtitle"]]
+[[!template text="""So this says any space character is here,""" start="00:11:50.912" video="mainVideo-align" id="subtitle"]]
+[[!template text="""and this one means any hexadecimal digits,""" start="00:11:54.514" video="mainVideo-align" id="subtitle"]]
+[[!template text="""so 0 through 9, A through F\.""" start="00:11:57.915" video="mainVideo-align" id="subtitle"]]
+[[!template text="""We also have these capture group things in here""" start="00:12:00.937" video="mainVideo-align" id="subtitle"]]
+[[!template text="""which are these parentheses\.""" start="00:12:03.038" video="mainVideo-align" id="subtitle"]]
+[[!template text="""Now, normally, parentheses in regular expressions""" start="00:12:04.118" video="mainVideo-align" id="subtitle"]]
+[[!template text="""in Emacs are not special,""" start="00:12:06.179" video="mainVideo-align" id="subtitle"]]
+[[!template text="""so you have to have a backslash in front of them\.""" start="00:12:08.160" video="mainVideo-align" id="subtitle"]]
+[[!template text="""And also because we're writing strings here,""" start="00:12:11.341" video="mainVideo-align" id="subtitle"]]
+[[!template text="""backslashes are significant to the string reader\.""" start="00:12:15.182" video="mainVideo-align" id="subtitle"]]
+[[!template text="""So you actually have to have two backslashes""" start="00:12:18.703" video="mainVideo-align" id="subtitle"]]
+[[!template text="""to get the capture groups right\.""" start="00:12:22.025" video="mainVideo-align" id="subtitle"]]
+[[!template text="""Here you can see a little diagram I""" start="00:12:24.986" video="mainVideo-align" id="subtitle"]]
+[[!template text="""made of how the capture groups work\.""" start="00:12:26.886" video="mainVideo-align" id="subtitle"]]
+[[!template text="""If you read all of this together, it's zero or""" start="00:12:29.760" video="mainVideo-align" id="subtitle"]]
+[[!template text="""more white space characters in a group,""" start="00:12:32.782" video="mainVideo-align" id="subtitle"]]
+[[!template text="""an equal sign, another zero or more""" start="00:12:35.743" video="mainVideo-align" id="subtitle"]]
+[[!template text="""whitespace characters in a group,""" start="00:12:38.085" video="mainVideo-align" id="subtitle"]]
+[[!template text="""and then a hexadecimal number\.""" start="00:12:40.386" video="mainVideo-align" id="subtitle"]]
+
+</div><div class="transcript-heading">[[!template new="1" text="""align-regexp with right justify""" start="00:12:44.428" video="mainVideo-align" id="subtitle"]]</div><div>[[!template new="1" text="""So let's try right justifying now\.""" start="00:12:44.428" video="mainVideo-align" id="subtitle"]]
+[[!template text="""We did left justification before\.""" start="00:12:46.709" video="mainVideo-align" id="subtitle"]]
+[[!template text="""We're going to change our `align-regexp` calls so""" start="00:12:48.790" video="mainVideo-align" id="subtitle"]]
+[[!template text="""that they are slightly different in two ways\.""" start="00:12:52.332" video="mainVideo-align" id="subtitle"]]
+[[!template text="""First of all,""" start="00:12:56.595" video="mainVideo-align" id="subtitle"]]
+[[!template text="""in the one where we want to right-justify,""" start="00:12:58.810" video="mainVideo-align" id="subtitle"]]
+[[!template text="""we've made the group number negative\.""" start="00:13:00.591" video="mainVideo-align" id="subtitle"]]
+[[!template text="""The other thing that we've done, we've gone down""" start="00:13:02.752" video="mainVideo-align" id="subtitle"]]
+[[!template text="""here and this capture group""" start="00:13:05.213" video="mainVideo-align" id="subtitle"]]
+[[!template text="""inside the parentheses now contains more stuff\.""" start="00:13:07.533" video="mainVideo-align" id="subtitle"]]
+[[!template text="""It contains the non-whitespace characters""" start="00:13:10.114" video="mainVideo-align" id="subtitle"]]
+[[!template text="""that we want to capture\.""" start="00:13:12.835" video="mainVideo-align" id="subtitle"]]
+[[!template text="""That's because you have to include the""" start="00:13:13.836" video="mainVideo-align" id="subtitle"]]
+[[!template text="""non-whitespace for the Emacs alignment code to""" start="00:13:15.576" video="mainVideo-align" id="subtitle"]]
+[[!template text="""figure out how far over the whole thing goes,""" start="00:13:18.498" video="mainVideo-align" id="subtitle"]]
+[[!template text="""so that it can line everything up\.""" start="00:13:22.339" video="mainVideo-align" id="subtitle"]]
+[[!template text="""We'll make these two changes and let's see""" start="00:13:24.480" video="mainVideo-align" id="subtitle"]]
+[[!template text="""what happens when we run this\.""" start="00:13:26.240" video="mainVideo-align" id="subtitle"]]
+[[!template text="""Bam!""" start="00:13:28.549" video="mainVideo-align" id="subtitle"]]
+[[!template text="""Now they're all lined up on the right-hand side""" start="00:13:28.929" video="mainVideo-align" id="subtitle"]]
+[[!template text="""as well with just these two changes to the calls\.""" start="00:13:31.230" video="mainVideo-align" id="subtitle"]]
+
+</div><div class="transcript-heading">[[!template new="1" text="""align-region""" start="00:13:35.212" video="mainVideo-align" id="subtitle"]]</div><div>[[!template new="1" text="""We can use a different function called""" start="00:13:35.212" video="mainVideo-align" id="subtitle"]]
+[[!template text="""`align-region` that allows us to combine those two""" start="00:13:36.612" video="mainVideo-align" id="subtitle"]]
+[[!template text="""calls to `align-regexp`\.""" start="00:13:38.953" video="mainVideo-align" id="subtitle"]]
+[[!template text="""This allows us to do multiple columns at once\.""" start="00:13:40.914" video="mainVideo-align" id="subtitle"]]
+[[!template text="""It uses rules instead of regular expressions\.""" start="00:13:44.355" video="mainVideo-align" id="subtitle"]]
+[[!template text="""So the rules also specify""" start="00:13:47.656" video="mainVideo-align" id="subtitle"]]
+[[!template text="""the regular expression as before\.""" start="00:13:49.097" video="mainVideo-align" id="subtitle"]]
+[[!template text="""They list the groups that you're interested in\.""" start="00:13:51.098" video="mainVideo-align" id="subtitle"]]
+[[!template text="""Here we've noted that we need to justify, also,""" start="00:13:53.739" video="mainVideo-align" id="subtitle"]]
+[[!template text="""instead of using a negative group number\.""" start="00:13:57.880" video="mainVideo-align" id="subtitle"]]
+[[!template text="""Let's see if I can undo any of this\.""" start="00:14:02.101" video="mainVideo-align" id="subtitle"]]
+[[!template text="""Oh, there we go\.""" start="00:14:03.942" video="mainVideo-align" id="subtitle"]]
+[[!template text="""Okay, now let's try\.\.\. Now let's run this one\.""" start="00:14:04.442" video="mainVideo-align" id="subtitle"]]
+[[!template text="""So this is a different way of achieving the same""" start="00:14:07.343" video="mainVideo-align" id="subtitle"]]
+[[!template text="""goal, but with a rule instead of simply a regexp\.""" start="00:14:09.063" video="mainVideo-align" id="subtitle"]]
+[[!template text="""So this leaves us with a left-justified first""" start="00:14:13.265" video="mainVideo-align" id="subtitle"]]
+[[!template text="""column and a right-justified second one using a""" start="00:14:15.065" video="mainVideo-align" id="subtitle"]]
+[[!template text="""line region instead of a line regex called twice\.""" start="00:14:17.746" video="mainVideo-align" id="subtitle"]]
+[[!template text="""And as an aside, when you're debugging these""" start="00:14:22.457" video="mainVideo-align" id="subtitle"]]
+[[!template text="""regular expressions, which can be a little""" start="00:14:25.479" video="mainVideo-align" id="subtitle"]]
+[[!template text="""challenging to get right, there's a function""" start="00:14:26.979" video="mainVideo-align" id="subtitle"]]
+[[!template text="""called `align-highlight-rule`\.""" start="00:14:29.161" video="mainVideo-align" id="subtitle"]]
+[[!template text="""And if you're using `align-region`, it's really easy""" start="00:14:31.142" video="mainVideo-align" id="subtitle"]]
+[[!template text="""to use because it's basically the same syntax\.""" start="00:14:33.423" video="mainVideo-align" id="subtitle"]]
+[[!template text="""It produces an image that looks like the one""" start="00:14:36.845" video="mainVideo-align" id="subtitle"]]
+[[!template text="""on the right with little highlights everywhere""" start="00:14:38.646" video="mainVideo-align" id="subtitle"]]
+[[!template text="""the capture group would be\.""" start="00:14:42.528" video="mainVideo-align" id="subtitle"]]
+
+</div><div class="transcript-heading">[[!template new="1" text="""Structured regular expressions with rx""" start="00:14:46.270" video="mainVideo-align" id="subtitle"]]</div><div>[[!template new="1" text="""Now, the regular expression construction, as we""" start="00:14:46.270" video="mainVideo-align" id="subtitle"]]
+[[!template text="""discussed, can be a little cryptic\.""" start="00:14:48.451" video="mainVideo-align" id="subtitle"]]
+[[!template text="""You want a feature that allows you to write""" start="00:14:51.027" video="mainVideo-align" id="subtitle"]]
+[[!template text="""things in human language\.""" start="00:14:53.709" video="mainVideo-align" id="subtitle"]]
+[[!template text="""And rx is exactly that feature\.""" start="00:14:56.130" video="mainVideo-align" id="subtitle"]]
+[[!template text="""So this is the English language description""" start="00:14:58.631" video="mainVideo-align" id="subtitle"]]
+[[!template text="""basically in comments that I showed before\.""" start="00:15:00.392" video="mainVideo-align" id="subtitle"]]
+[[!template text="""Let's see what happens when we run this\.""" start="00:15:03.134" video="mainVideo-align" id="subtitle"]]
+[[!template text="""That rx expression resulted in a string, and the""" start="00:15:07.817" video="mainVideo-align" id="subtitle"]]
+[[!template text="""string is just exactly the thing that we wrote""" start="00:15:10.398" video="mainVideo-align" id="subtitle"]]
+[[!template text="""manually earlier\.""" start="00:15:12.399" video="mainVideo-align" id="subtitle"]]
+[[!template text="""So rx can really help\.""" start="00:15:13.660" video="mainVideo-align" id="subtitle"]]
+
+</div><div class="transcript-heading">[[!template new="1" text="""Replacing regexps with PEG parsers""" start="00:15:16.962" video="mainVideo-align" id="subtitle"]]</div><div>[[!template new="1" text="""Let's replace our regular expression""" start="00:15:16.962" video="mainVideo-align" id="subtitle"]]
+[[!template text="""with a parser\.""" start="00:15:19.463" video="mainVideo-align" id="subtitle"]]
+[[!template text="""Why would we want to do this?""" start="00:15:20.855" video="mainVideo-align" id="subtitle"]]
+[[!template text="""Well, sometimes you want to align things that""" start="00:15:22.316" video="mainVideo-align" id="subtitle"]]
+[[!template text="""require a parser to recognize the thing that""" start="00:15:24.697" video="mainVideo-align" id="subtitle"]]
+[[!template text="""you're trying to align, and a regular expression""" start="00:15:28.039" video="mainVideo-align" id="subtitle"]]
+[[!template text="""might not be enough\.""" start="00:15:31.400" video="mainVideo-align" id="subtitle"]]
+[[!template text="""Parenthesized expressions are a classic example,""" start="00:15:32.301" video="mainVideo-align" id="subtitle"]]
+[[!template text="""as is HTML\.""" start="00:15:35.662" video="mainVideo-align" id="subtitle"]]
+[[!template text="""But also for the inputs that they can handle,""" start="00:15:37.944" video="mainVideo-align" id="subtitle"]]
+[[!template text="""sometimes a parser is more readable""" start="00:15:40.505" video="mainVideo-align" id="subtitle"]]
+[[!template text="""because you can write rules""" start="00:15:42.006" video="mainVideo-align" id="subtitle"]]
+[[!template text="""and rules can be repeated\.""" start="00:15:43.306" video="mainVideo-align" id="subtitle"]]
+[[!template text="""Finally, parsers can return more than pass, fail,""" start="00:15:45.890" video="mainVideo-align" id="subtitle"]]
+[[!template text="""and match data\.""" start="00:15:48.412" video="mainVideo-align" id="subtitle"]]
+[[!template text="""In the parsing framework we're going to use,""" start="00:15:50.173" video="mainVideo-align" id="subtitle"]]
+[[!template text="""we have parser actions that allow us to extract more""" start="00:15:51.855" video="mainVideo-align" id="subtitle"]]
+[[!template text="""information from the parser run\.""" start="00:15:55.697" video="mainVideo-align" id="subtitle"]]
+[[!template text="""Let's write a small example parser using the""" start="00:15:58.179" video="mainVideo-align" id="subtitle"]]
+[[!template text="""peg\.el framework that's built into Emacs\.""" start="00:16:00.601" video="mainVideo-align" id="subtitle"]]
+[[!template text="""Our parser will recognize arbitrarily-nested""" start="00:16:03.463" video="mainVideo-align" id="subtitle"]]
+[[!template text="""bitwise OR operations on hexadecimal numbers,""" start="00:16:06.486" video="mainVideo-align" id="subtitle"]]
+[[!template text="""which is useful for bitmasks\.""" start="00:16:09.288" video="mainVideo-align" id="subtitle"]]
+[[!template text="""There are two rules in our grammar""" start="00:16:11.709" video="mainVideo-align" id="subtitle"]]
+[[!template text="""and one parser action\.""" start="00:16:13.631" video="mainVideo-align" id="subtitle"]]
+[[!template text="""The first rule describes a hexadecimal number in""" start="00:16:15.730" video="mainVideo-align" id="subtitle"]]
+[[!template text="""very similar terms to those we used for rx\.""" start="00:16:18.231" video="mainVideo-align" id="subtitle"]]
+[[!template text="""It also uses a parser action called `substring` to""" start="00:16:21.393" video="mainVideo-align" id="subtitle"]]
+[[!template text="""ensure we collect the hex numbers during parsing\.""" start="00:16:24.334" video="mainVideo-align" id="subtitle"]]
+[[!template text="""The second rule is recursively defined, which""" start="00:16:28.256" video="mainVideo-align" id="subtitle"]]
+[[!template text="""allows it to handle expressions of any depth\.""" start="00:16:30.497" video="mainVideo-align" id="subtitle"]]
+[[!template text="""Let's try the whole thing out\.""" start="00:16:33.498" video="mainVideo-align" id="subtitle"]]
+[[!template text="""We successfully collected the numbers that were""" start="00:16:37.440" video="mainVideo-align" id="subtitle"]]
+[[!template text="""in the test data\.""" start="00:16:39.561" video="mainVideo-align" id="subtitle"]]
+[[!template text="""Let's make a more complex parser to handle our""" start="00:16:43.675" video="mainVideo-align" id="subtitle"]]
+[[!template text="""bitmasks formatting application\.""" start="00:16:45.997" video="mainVideo-align" id="subtitle"]]
+[[!template text="""We have one rule, spaces, that we reuse in""" start="00:16:49.019" video="mainVideo-align" id="subtitle"]]
+[[!template text="""several places\.""" start="00:16:52.361" video="mainVideo-align" id="subtitle"]]
+[[!template text="""Our final rule looks very much like the Rx""" start="00:16:55.884" video="mainVideo-align" id="subtitle"]]
+[[!template text="""definition of the enum line matcher\.""" start="00:16:58.786" video="mainVideo-align" id="subtitle"]]
+[[!template text="""Let's see what the whole thing does\.""" start="00:17:01.908" video="mainVideo-align" id="subtitle"]]
+[[!template text="""It just returned true, and the reason is that we""" start="00:17:05.411" video="mainVideo-align" id="subtitle"]]
+[[!template text="""don't have any parser actions that do anything special\.""" start="00:17:08.473" video="mainVideo-align" id="subtitle"]]
+[[!template text="""And true just means that we successfully parsed""" start="00:17:12.453" video="mainVideo-align" id="subtitle"]]
+[[!template text="""the input\.""" start="00:17:14.915" video="mainVideo-align" id="subtitle"]]
+[[!template text="""Let's add some parser actions\.""" start="00:17:17.217" video="mainVideo-align" id="subtitle"]]
+[[!template text="""A regex capture group remembers the range of""" start="00:17:20.579" video="mainVideo-align" id="subtitle"]]
+[[!template text="""locations it matched\.""" start="00:17:23.321" video="mainVideo-align" id="subtitle"]]
+[[!template text="""It would be helpful to have the same thing with""" start="00:17:25.223" video="mainVideo-align" id="subtitle"]]
+[[!template text="""our parser\.""" start="00:17:27.586" video="mainVideo-align" id="subtitle"]]
+[[!template text="""That's what the region parser action is for\.""" start="00:17:28.907" video="mainVideo-align" id="subtitle"]]
+[[!template text="""Here we've wrapped parts of the grammar that""" start="00:17:32.270" video="mainVideo-align" id="subtitle"]]
+[[!template text="""correspond to capture groups""" start="00:17:34.051" video="mainVideo-align" id="subtitle"]]
+[[!template text="""with the region action\.""" start="00:17:36.053" video="mainVideo-align" id="subtitle"]]
+[[!template text="""Let's see what we get\.""" start="00:17:42.251" video="mainVideo-align" id="subtitle"]]
+[[!template text="""We have four numbers that correspond""" start="00:17:46.632" video="mainVideo-align" id="subtitle"]]
+[[!template text="""to the starts and ends""" start="00:17:48.773" video="mainVideo-align" id="subtitle"]]
+[[!template text="""of what we used to call capture groups\.""" start="00:17:50.774" video="mainVideo-align" id="subtitle"]]
+[[!template text="""True match data must add one more pair of numbers""" start="00:17:55.355" video="mainVideo-align" id="subtitle"]]
+[[!template text="""at the beginning for the region matched by the""" start="00:17:58.416" video="mainVideo-align" id="subtitle"]]
+[[!template text="""parser overall, giving us a total of six numbers\.""" start="00:18:00.697" video="mainVideo-align" id="subtitle"]]
+[[!template text="""We'll do that in some extra code\.""" start="00:18:04.678" video="mainVideo-align" id="subtitle"]]
+[[!template text="""We now have all the information the regex would""" start="00:18:09.838" video="mainVideo-align" id="subtitle"]]
+[[!template text="""have produced\.""" start="00:18:12.099" video="mainVideo-align" id="subtitle"]]
+[[!template text="""How do we substitute our parser in?""" start="00:18:13.480" video="mainVideo-align" id="subtitle"]]
+[[!template text="""Well, it turns out that `align-region` accepts any""" start="00:18:16.242" video="mainVideo-align" id="subtitle"]]
+[[!template text="""function meeting certain requirements as a""" start="00:18:19.884" video="mainVideo-align" id="subtitle"]]
+[[!template text="""substitute for a string-based regular expression\.""" start="00:18:22.586" video="mainVideo-align" id="subtitle"]]
+[[!template text="""It just has to emulate a function called""" start="00:18:25.988" video="mainVideo-align" id="subtitle"]]
+[[!template text="""`re-search-forward`, which performs a regex search""" start="00:18:27.889" video="mainVideo-align" id="subtitle"]]
+[[!template text="""within the buffer\.""" start="00:18:30.991" video="mainVideo-align" id="subtitle"]]
+[[!template text="""Let's see how we can do that\.""" start="00:18:32.872" video="mainVideo-align" id="subtitle"]]
+[[!template text="""This is a function""" start="00:18:38.897" video="mainVideo-align" id="subtitle"]]
+[[!template text="""`parse-enum-assignment-set-matchdata`\.""" start="00:18:39.897" video="mainVideo-align" id="subtitle"]]
+[[!template text="""It takes the required two arguments,""" start="00:18:42.878" video="mainVideo-align" id="subtitle"]]
+[[!template text="""which it doesn't use,""" start="00:18:45.798" video="mainVideo-align" id="subtitle"]]
+[[!template text="""sets the global match data when it's done,""" start="00:18:47.559" video="mainVideo-align" id="subtitle"]]
+[[!template text="""and returns true\.""" start="00:18:49.859" video="mainVideo-align" id="subtitle"]]
+[[!template text="""Let's try it out and print the match data\.""" start="00:18:52.020" video="mainVideo-align" id="subtitle"]]
+[[!template text="""That looks right\.""" start="00:18:58.641" video="mainVideo-align" id="subtitle"]]
+[[!template text="""We now have the required six numbers\.""" start="00:18:59.902" video="mainVideo-align" id="subtitle"]]
+[[!template text="""Let's try substituting this function""" start="00:19:02.822" video="mainVideo-align" id="subtitle"]]
+[[!template text="""we just defined""" start="00:19:05.683" video="mainVideo-align" id="subtitle"]]
+[[!template text="""in our call to `align-region`\.""" start="00:19:07.682" video="mainVideo-align" id="subtitle"]]
+[[!template text="""Let's try it\.""" start="00:19:10.245" video="mainVideo-align" id="subtitle"]]
+[[!template text="""Awesome\.""" start="00:19:14.449" video="mainVideo-align" id="subtitle"]]
+[[!template text="""Everything looks good now\.""" start="00:19:15.490" video="mainVideo-align" id="subtitle"]]
+[[!template text="""So we covered vertical alignment commands for""" start="00:19:21.091" video="mainVideo-align" id="subtitle"]]
+[[!template text="""both text and code, custom column alignment with""" start="00:19:24.074" video="mainVideo-align" id="subtitle"]]
+[[!template text="""regular expressions, using rx to make the""" start="00:19:27.357" video="mainVideo-align" id="subtitle"]]
+[[!template text="""expression more readable, extending column""" start="00:19:30.340" video="mainVideo-align" id="subtitle"]]
+[[!template text="""alignment with Emacs Lisp, and replacing regexp""" start="00:19:32.803" video="mainVideo-align" id="subtitle"]]
+[[!template text="""with peg\.el parsers\.""" start="00:19:36.006" video="mainVideo-align" id="subtitle"]]
+[[!template text="""Thanks for watching\.""" start="00:19:38.068" video="mainVideo-align" id="subtitle"]]</div>
+
+</div>
+
+Captioner: sachac
+
Questions or comments? Please e-mail [emacsconf-org-private@gnu.org](mailto:emacsconf-org-private@gnu.org?subject=Comment%20for%20EmacsConf%202023%20align%3A%20Column-aligning%20text%20in%20Emacs)