WEBVTT

NOTE Starting up

00:00:00.031 --> 00:00:02.517
[Sacha]: There's a 10-second delay, so I can

00:00:02.557 --> 00:00:04.962
never quite tell when I'm starting to start, but

00:00:05.243 --> 00:00:06.305
I think I'm going to do that now.

00:00:06.465 --> 00:00:07.147
Okay, let's go.

00:00:09.472 --> 00:00:11.436
Okay, I have pressed the Go Live button.

00:00:11.456 --> 00:00:13.220
Let's see how it goes.

00:00:13.401 --> 00:00:17.550
So this is Yay Emacs 33 with Prot:

00:00:17.530 --> 00:00:18.972
Sacha and Prot Talk Emacs.

00:00:19.012 --> 00:00:20.635
Today, we're going to be talking about

00:00:20.695 --> 00:00:23.539
underappreciated Emacs built-ins, which is the

00:00:23.640 --> 00:00:26.264
theme for this month's Emacs carnival.

NOTE #+TRIM: 00:00:26.344 --> 00:00:28.407

00:00:28.700 --> 00:00:29.088
Kind of like this, you know, shared, lots of

00:00:29.128 --> 00:00:31.592
people writing or talking about a specific topic.

00:00:32.372 --> 00:00:34.497
This one is hosted by Ross A. Baker.

00:00:34.637 --> 00:00:35.658
(Thanks for hosting that!)

00:00:36.239 --> 00:00:39.564
Anyway, so I'm here with Prot. I was very

00:00:39.625 --> 00:00:42.148
tempted to just dive into this brain dump like

00:00:42.189 --> 00:00:43.150
last time about...

00:00:43.433 --> 00:00:50.665
Let's start with the kinds of problems that

00:00:52.407 --> 00:00:55.392
newcomers and intermediate users might run into,

00:00:55.432 --> 00:00:57.776
especially the problems they don't even know

00:00:58.457 --> 00:01:02.724
about because Emacs would allow them to do things

00:01:02.784 --> 00:01:05.188
that other editors might not offer.

00:01:05.607 --> 00:01:08.310
But they've got to think about it first, right?

00:01:08.350 --> 00:01:10.433
They've got to discover that this is a need of theirs

00:01:10.533 --> 00:01:12.015
and that Emacs can help them with it.

00:01:12.716 --> 00:01:15.819
So maybe this conversation can be a high-level

00:01:16.340 --> 00:01:18.903
discussion of these concepts to help people

00:01:18.983 --> 00:01:21.126
develop this intuition for what's out there,

00:01:21.546 --> 00:01:23.288
particularly for the things that Emacs does

00:01:23.368 --> 00:01:25.151
differently compared to other editors.

00:01:25.791 --> 00:01:27.533
And if we start with a problem, and I have

00:01:27.754 --> 00:01:30.116
several that I often run into in my own life, you

00:01:30.136 --> 00:01:32.239
might suggest others as well.

00:01:32.219 --> 00:01:34.864
Then we can talk about how the things that

00:01:34.904 --> 00:01:37.509
are built into Emacs can support that and how

00:01:37.550 --> 00:01:39.994
they fit together at a high level. We don't

00:01:40.034 --> 00:01:41.878
have to go into "This is precisely how

00:01:41.918 --> 00:01:44.243
to start a keyboard macro and how to stop it."

00:01:44.523 --> 00:01:46.167
People can look that up in the manual. But the

00:01:46.227 --> 00:01:48.491
idea of a keyboard macro and how it's useful,

00:01:48.812 --> 00:01:50.675
*that* would probably be a good thing for a

00:01:50.736 --> 00:01:51.477
conversation.

00:01:51.862 --> 00:01:55.408
Then for the advanced users who are listening

00:01:55.448 --> 00:01:58.374
to this, we can sprinkle in some things we've

00:01:58.414 --> 00:02:00.718
seen about some really advanced uses of these

00:02:01.279 --> 00:02:02.842
built-ins, because there's a lot of high-level

00:02:02.902 --> 00:02:04.745
use that I haven't even got into yet.

00:02:05.947 --> 00:02:08.572
So Prot is here, which means that because you've

00:02:08.592 --> 00:02:12.118
got two people, you can see how these same tools

00:02:12.178 --> 00:02:14.202
can be used in different ways to support

00:02:14.262 --> 00:02:15.304
different workflows.

00:02:15.537 --> 00:02:19.665
I'm going to suggest some problems that I have.

00:02:20.186 --> 00:02:22.571
Of course, you can share some from your

00:02:22.631 --> 00:02:25.918
experience and from the times that you've coached

00:02:25.958 --> 00:02:26.539
other people.

NOTE Focus and distraction

00:02:27.080 --> 00:02:30.407
My main problem with life in general.

00:02:30.640 --> 00:02:32.181
is focus and distraction.

00:02:33.382 --> 00:02:36.665
Because I have a kid, my focus time is very

00:02:36.806 --> 00:02:37.566
unpredictable.

00:02:37.586 --> 00:02:39.668
It can be interrupted any moment by somebody

00:02:39.728 --> 00:02:40.789
needing help.

00:02:40.809 --> 00:02:43.792
My life over the last 10 years has mostly

00:02:43.852 --> 00:02:46.554
been about five minutes here, 10 minutes there,

00:02:46.634 --> 00:02:49.497
maybe 15, one hour of focus time if I'm lucky.

00:02:50.178 --> 00:02:53.200
This is a universal challenge.

00:02:53.220 --> 00:02:55.282
Well, some people actually get to focus, but my

00:02:55.342 --> 00:02:58.145
brain is not one of those focusable things.

00:02:58.225 --> 00:03:00.647
It has to work in stops and starts.

00:03:00.627 --> 00:03:04.730
Any chance this is a problem that you also run into?

00:03:06.492 --> 00:03:08.974
[Prot]: Not to that extent, but I have the

00:03:09.014 --> 00:03:10.956
propensity to go down rabbit holes.

00:03:11.656 --> 00:03:13.878
I will go really deep, like really deep.

00:03:13.898 --> 00:03:15.720
You give me something which I know nothing about,

00:03:15.760 --> 00:03:16.941
I will become an expert in it.

00:03:17.381 --> 00:03:19.223
But of course, this is a problem when you combine

00:03:19.263 --> 00:03:21.084
it with curiosity, because now you want to learn

00:03:21.184 --> 00:03:22.686
everything.

00:03:22.706 --> 00:03:24.707
Thankfully, I have learned to control myself.

00:03:24.747 --> 00:03:26.529
If you give me something I don't know about,

00:03:26.569 --> 00:03:29.291
I will say, OK, sounds very tempting, but I will

00:03:29.371 --> 00:03:30.212
not even try.

00:03:30.597 --> 00:03:33.317
I won't even go down the rabbit hole.

00:03:33.668 --> 00:03:35.289
[Sacha]: So these are

00:03:35.389 --> 00:03:38.312
two sides of the same problem,

00:03:38.352 --> 00:03:40.254
and something that a lot of people will resonate

00:03:40.294 --> 00:03:42.756
with... When you're working on something and you

00:03:42.796 --> 00:03:45.158
realize, okay, I've got to go do this other thing

00:03:45.258 --> 00:03:47.940
first or, oh, I'm curious about this question

00:03:47.980 --> 00:03:49.222
that has come up in my brain.

00:03:49.602 --> 00:03:51.263
I want to go down that rabbit hole.

00:03:51.684 --> 00:03:53.365
How do we manage this?

00:03:53.385 --> 00:03:54.826
Emacs is here to help.

NOTE Org Mode and other note-taking, task-management systems

00:03:54.846 --> 00:03:56.728
My first recommendation for this problem is:

00:03:56.828 --> 00:03:58.950
take advantage of Org Mode or other

00:03:59.150 --> 00:04:01.732
built-in note-taking task management support

00:04:01.752 --> 00:04:03.574
systems because it...

00:04:04.482 --> 00:04:06.905
Sometimes people think, okay, an IDE is just an

00:04:07.025 --> 00:04:07.866
IDE, right?

00:04:08.206 --> 00:04:10.248
If they're programmers, it's just for code.

00:04:10.608 --> 00:04:13.812
Sometimes people are writing. They're using

00:04:13.852 --> 00:04:15.734
a text editor just for writing their novel.

00:04:16.113 --> 00:04:18.315
But because Emacs has these built-in ways to

00:04:18.357 --> 00:04:20.699
support managing your to-dos and all that stuff,

00:04:20.738 --> 00:04:23.662
it's very easy just to stuff that task in there.

00:04:24.343 --> 00:04:26.465
Have a quick shortcut to go to your to-do list

00:04:26.505 --> 00:04:28.767
and put something in. Then it gets out of

00:04:28.827 --> 00:04:30.970
your brain so that you can try to focus on the

00:04:30.990 --> 00:04:32.211
thing that you're trying to get done.

00:04:32.326 --> 00:04:34.989
That's my quick underappreciated...

00:04:35.750 --> 00:04:37.272
actually, a lot of people really appreciate

00:04:37.292 --> 00:04:39.635
this, but it's one of those things

00:04:39.755 --> 00:04:41.958
people coming to Emacs from other editors might

00:04:42.018 --> 00:04:43.420
not immediately catch on to.

00:04:44.942 --> 00:04:46.504
[Prot]: You might not understand the

00:04:46.584 --> 00:04:48.346
extent of how valuable it is.

00:04:48.366 --> 00:04:51.130
It's the gift that keeps giving, basically.

00:04:51.150 --> 00:04:51.810
[Sacha]: Yeah, yeah.

00:04:52.031 --> 00:04:54.314
When your to-dos and your notes are just a couple

00:04:54.334 --> 00:04:56.436
of keystrokes away, and they can save the context

00:04:56.516 --> 00:04:57.878
of whatever you were looking at.

NOTE Kill ring

00:04:58.448 --> 00:05:01.010
There are all sorts of other small

00:05:01.070 --> 00:05:04.934
conveniences that Emacs has that also help with

00:05:04.974 --> 00:05:07.516
distraction and focus.

00:05:07.536 --> 00:05:08.697
For example, the kill ring.

00:05:10.479 --> 00:05:11.520
It's such a simple thing, right?

00:05:12.821 --> 00:05:15.283
[Prot]: It's super simple, but super useful.

00:05:15.383 --> 00:05:18.186
Just to say on the kill ring, it has been

00:05:18.246 --> 00:05:20.327
part of Emacs for several versions now, but it's

00:05:20.387 --> 00:05:21.008
not obvious.

00:05:21.488 --> 00:05:25.032
If you type `M-y` without `C-y` beforehand,

00:05:25.052 --> 00:05:26.633
you get completion.

00:05:26.765 --> 00:05:29.913
So you can select something that you had in your

00:05:29.973 --> 00:05:31.979
kill-ring like a few kills ago.

00:05:32.700 --> 00:05:34.926
Clipboard navigation,

00:05:34.986 --> 00:05:38.054
which is something that you don't see right away.

00:05:39.995 --> 00:05:41.697
[Sacha]: If people are coming

00:05:41.737 --> 00:05:43.779
from outside Emacs and they're like, "What is this

00:05:43.839 --> 00:05:44.680
thing that you're talking about?"

00:05:44.960 --> 00:05:47.323
People are used to having a clipboard, right?

00:05:47.823 --> 00:05:50.526
As soon as you copy something, your program

00:05:50.686 --> 00:05:53.069
forgets the thing that you previously copied.

00:05:53.149 --> 00:05:56.212
On mobile phones now, if you press

00:05:56.272 --> 00:05:58.394
paste, you can see a selection of the

00:05:58.454 --> 00:06:00.817
previous things you've copied before.

00:06:01.277 --> 00:06:03.500
It's like that, but larger.

NOTE #+TRIM: 00:06:04.040 --> 00:06:04.140

00:06:03.720 --> 00:06:06.243
Prot points out: you can use completion

00:06:06.283 --> 00:06:06.563
with it.

00:06:07.164 --> 00:06:12.637
So `M-y` is `yank-pop` I think?

00:06:15.182 --> 00:06:18.407
What I find useful about this is

00:06:18.467 --> 00:06:20.771
sometimes I'll copy something because I want to

00:06:20.811 --> 00:06:22.895
go paste it somewhere else, and then on the way to

00:06:22.955 --> 00:06:25.219
that somewhere else, I get distracted by something,

00:06:25.639 --> 00:06:28.323
and I need to copy that, but I know that the

00:06:28.324 --> 00:06:31.930
`kill-ring` will have the other copies that I meant to

00:06:31.970 --> 00:06:34.875
put somewhere else.

NOTE #+TRIM: 00:06:35.311 --> 00:06:35.512

00:06:35.311 --> 00:06:37.398
[Prot]: By completion here, we mean you

00:06:37.438 --> 00:06:40.328
can type and match that thing, narrow down to it.

NOTE #+TRIM: 00:06:40.348 --> 00:06:40.528

00:06:40.348 --> 00:06:42.876
You don't have to go searching for it and,

00:06:42.956 --> 00:06:45.645
"Okay, which one exactly is it," right?

NOTE #+TRIM: 00:06:45.665 --> 00:06:45.706

00:06:45.665 --> 00:06:48.274
You can find it more easily.

NOTE Registers

00:06:50.110 --> 00:06:50.812
[Sacha]: Registers.

00:06:51.694 --> 00:06:53.558
It's the other thing that I like to use when I

00:06:53.638 --> 00:06:56.785
know that I'm copying several things and I need

00:06:56.805 --> 00:06:59.751
to paste them, possibly in different order.

NOTE #+TRIM: 00:07:00.774 --> 00:07:01.235

00:07:00.774 --> 00:07:03.500
Again, that's another thing that people are

00:07:03.560 --> 00:07:05.204
like, "What is this thing, even?"

00:07:05.584 --> 00:07:08.511
Do you find yourself explaining registers to

00:07:08.571 --> 00:07:09.874
people who are new to Emacs?

NOTE #+TRIM: 00:07:10.698 --> 00:07:11.139, 00:07:11.319 --> 00:07:11.559

00:07:10.698 --> 00:07:13.001
[Prot]: Yes. Registers is

00:07:13.041 --> 00:07:15.465
something that is underutilized, because of course,

00:07:15.665 --> 00:07:17.707
why would you need them when you can have a

00:07:17.708 --> 00:07:21.373
kill-ring with a history, right? Why do I need to

00:07:21.453 --> 00:07:23.816
store things in a register when I can just have

00:07:23.876 --> 00:07:27.220
them one after the other in the kill-ring.

00:07:27.221 --> 00:07:31.186
The answer is because if you do something more

00:07:31.266 --> 00:07:34.090
advanced, such as with a keyboard macro,

00:07:34.475 --> 00:07:36.157
it will always be correct.

00:07:36.277 --> 00:07:37.418
It's precise.

00:07:37.438 --> 00:07:40.181
It's not "Give me the last thing on the kill ring,"

00:07:40.321 --> 00:07:43.444
or last thing minus two or whatever.

00:07:43.465 --> 00:07:45.687
Give me that, right,

00:07:45.707 --> 00:07:47.249
and you specify what that is.

00:07:47.969 --> 00:07:50.272
It's an expression of intent.

NOTE #+TRIM: 00:07:50.912 --> 00:07:53.195

00:07:50.912 --> 00:07:54.575
Plus more advanced things,

00:07:54.576 --> 00:07:56.557
like incrementing a number or whatever.

00:07:56.558 --> 00:07:58.120
I think that's super specialized.

00:07:58.471 --> 00:07:59.872
[Sacha]: I don't even use that very much,

00:08:00.013 --> 00:08:02.354
but I know some people who use that

00:08:02.355 --> 00:08:03.136
to great effect.

00:08:03.316 --> 00:08:06.139
So that's one of those little Easter eggs for

00:08:06.159 --> 00:08:07.300
advanced users.

00:08:07.401 --> 00:08:10.364
If you're watching this and you're like, okay, I

00:08:10.404 --> 00:08:11.985
know about these built-ins, but there's more.

00:08:12.406 --> 00:08:14.468
Emacs has this fractal complexity.

00:08:14.568 --> 00:08:16.229
It just keeps getting more interesting

00:08:16.230 --> 00:08:17.251
the more you dig into it.

00:08:17.732 --> 00:08:19.153
Okay, so, registers.

00:08:19.173 --> 00:08:21.755
Registers can store text that you're copying,

00:08:21.756 --> 00:08:23.698
but they can also store other things.

00:08:24.399 --> 00:08:26.401
I think, like, do you use them for window

00:08:26.441 --> 00:08:27.482
configurations, Prot?

00:08:28.508 --> 00:08:31.796
[Prot]: I have used them for framesets:

00:08:32.096 --> 00:08:38.892
frames and their window configurations.

00:08:39.393 --> 00:08:41.558
If you have three frames and they are

00:08:41.597 --> 00:08:43.523
split in different ways, you restore that.

00:08:44.425 --> 00:08:45.668
[Sacha]: You can do all of that with

00:08:45.808 --> 00:08:47.091
just one register.

00:08:47.476 --> 00:08:48.558
[Prot]: With a register, yeah.

00:08:48.678 --> 00:08:51.182
I have created another register of mine just

00:08:51.223 --> 00:08:55.169
to see how it works, where it saves a

00:08:55.470 --> 00:08:58.274
file with a specific location,

00:08:58.275 --> 00:08:59.777
but it's supposed to be in memory,

00:08:59.778 --> 00:09:01.540
not like a bookmark.

00:09:01.541 --> 00:09:02.903
I did it just for testing.

00:09:03.338 --> 00:09:04.419
[Sacha]: I have that too.

00:09:04.499 --> 00:09:08.104
I use registers to files so that I can jump to

00:09:08.144 --> 00:09:11.869
things like my Emacs configuration or my notes or

00:09:11.949 --> 00:09:12.750
something like that.

00:09:13.611 --> 00:09:15.974
I use that instead of bookmarks so that I can

00:09:16.014 --> 00:09:18.397
just have a keyboard shortcut go straight to that

00:09:18.457 --> 00:09:18.898
register.

00:09:19.358 --> 00:09:23.964
I can do the [`jump-to-register`] and then I can just

00:09:24.064 --> 00:09:25.365
easily press one more key

00:09:25.366 --> 00:09:28.890
to get to the file that I want.

00:09:28.870 --> 00:09:32.213
So registers, again, if you're not used to Emacs,

00:09:32.494 --> 00:09:34.996
this is a built-in that's got a lot of features

00:09:35.096 --> 00:09:37.879
for helping you save text to things, especially

00:09:37.899 --> 00:09:39.641
if you're going to use them in keyboard macros

00:09:40.061 --> 00:09:42.664
because you can say, okay, insert text A and then

00:09:42.764 --> 00:09:46.587
insert text C and then insert text B. But you can

00:09:46.627 --> 00:09:49.510
also use them for other things like frameset,

00:09:49.831 --> 00:09:52.533
like the way that your windows and your buffers

00:09:52.593 --> 00:09:57.358
are arranged, or files that you want to go back to.

NOTE Narrowing

00:09:58.891 --> 00:10:03.755
Another built-in that I find really helpful for

00:10:03.795 --> 00:10:06.589
managing my focus and distraction is narrowing.

00:10:07.261 --> 00:10:11.006
I get distracted by all the other stuff, or I

00:10:11.066 --> 00:10:13.189
worry about accidentally revealing private

00:10:13.249 --> 00:10:15.752
information when I am streaming, or something else.

00:10:16.053 --> 00:10:18.777
So instead I narrow it to just the task that I'm

00:10:18.817 --> 00:10:21.120
working on or just the function that I'm editing.

00:10:21.841 --> 00:10:24.204
That's super useful not only for keeping me

00:10:24.244 --> 00:10:27.248
focused, but also for making sure that my changes

00:10:27.348 --> 00:10:30.973
don't affect more text than I mean to.

00:10:30.953 --> 00:10:34.301
If I'm using substitute.el... You can select the

00:10:34.341 --> 00:10:36.968
region, and a lot of the functions in Emacs will

00:10:37.068 --> 00:10:38.572
operate only within that region.

00:10:39.033 --> 00:10:42.542
But reselecting the region several times, if you

00:10:42.562 --> 00:10:44.727
end up needing to do multiple operations, it's a

00:10:44.767 --> 00:10:45.689
bit annoying.

00:10:45.709 --> 00:10:47.734
So instead, I'll just narrow and then it can work

00:10:47.754 --> 00:10:48.456
on the whole thing.

00:10:49.094 --> 00:10:51.278
[Prot]: Yes. When you narrow, you can

00:10:51.378 --> 00:10:54.003
also be less careful, in a sense.

00:10:54.004 --> 00:10:55.826
Like, you do a `query-replace`,

00:10:55.827 --> 00:10:58.992
when you do `!`, it means yes to all,

00:10:58.993 --> 00:11:00.596
but if you are in a narrowed region,

00:11:00.597 --> 00:11:02.399
yes to all means only within

00:11:02.400 --> 00:11:03.642
that portion of the buffer.

00:11:03.643 --> 00:11:05.065
So if you take care to

00:11:05.145 --> 00:11:06.387
narrow to where you want to be,

00:11:06.388 --> 00:11:08.993
then okay yes to all, you don't even have to check.

00:11:09.968 --> 00:11:11.110
[Sacha]: And I think this is

00:11:11.370 --> 00:11:14.115
underappreciated enough that, in fact, if you try

00:11:14.175 --> 00:11:17.862
to use... Is it `C-x n`?

00:11:17.882 --> 00:11:19.385
[Prot]: That's the prefix key.

00:11:19.445 --> 00:11:20.887
`C-x n` for narrowing.

00:11:20.907 --> 00:11:22.711
[Sacha]: The first time Emacs will

00:11:22.751 --> 00:11:24.113
say, are you really, really sure?

00:11:24.754 --> 00:11:26.738
It's one of those disabled commands, right?

00:11:27.339 --> 00:11:29.422
You've got to enable it for yourself.

00:11:29.543 --> 00:11:31.707
You've got to say, "Okay, I know what I'm doing.

00:11:31.787 --> 00:11:33.991
I'm not going to panic if the rest of my file

00:11:34.031 --> 00:11:34.812
disappears."

00:11:34.792 --> 00:11:35.917
I know it's there.

00:11:36.198 --> 00:11:37.805
I'm just choosing to focus on it.

00:11:38.287 --> 00:11:40.236
I think it's actually available off the menu as

00:11:40.296 --> 00:11:42.123
well, but I haven't

00:11:42.124 --> 00:11:43.249
used it off the menu bar.

00:11:44.005 --> 00:11:46.609
[Prot]: Yeah, I don't use the menu, so I

00:11:46.649 --> 00:11:47.209
cannot tell.

00:11:48.411 --> 00:11:50.333
But I remember that prompt,

00:11:50.334 --> 00:11:51.315
"Are you really sure?"

00:11:51.355 --> 00:11:52.657
It's disabled by default.

00:11:53.398 --> 00:11:55.561
Please make sure you know what you want.

00:11:55.761 --> 00:11:56.883
[Sacha]: Keyboard shortcut.

00:11:56.903 --> 00:11:58.165
That's the way to do it anyway.

00:11:58.405 --> 00:12:03.953
[Prot]: The thing is that I do use it extensively.

NOTE org-narrow-to-subtree

00:12:04.994 --> 00:12:07.578
Narrowing, of course, is generic.,

00:12:07.618 --> 00:12:10.442
Org also has its own narrowing.

00:12:10.882 --> 00:12:13.506
The most common one is [`org-narrow-to-subtree`].

NOTE narrow-to-defun

00:12:13.486 --> 00:12:20.858
[Sacha]: Narrowing to defun feels easier

00:12:20.898 --> 00:12:22.841
than trying to mark the function before search

00:12:22.901 --> 00:12:23.462
and replace.

00:12:23.602 --> 00:12:24.483
I love narrowing.

00:12:25.204 --> 00:12:27.154
In fact, I narrow to functions

00:12:27.155 --> 00:12:28.790
or sets of functions a lot,

00:12:29.251 --> 00:12:32.035
because I do a lot of work with

00:12:32.015 --> 00:12:33.861
with Javascript in HTML files,

00:12:33.862 --> 00:12:36.533
just a single file HTML that I can upload.

00:12:36.534 --> 00:12:39.367
It's got CSS and regular HTML in it as well.

00:12:39.368 --> 00:12:42.712
But I often just need to copy

00:12:42.713 --> 00:12:44.816
the particular snippet of JavaScript

00:12:44.817 --> 00:12:46.981
so I can paste it into the console as

00:12:47.041 --> 00:12:47.943
I'm making changes.

00:12:48.704 --> 00:12:50.547
I have a function that

00:12:50.527 --> 00:12:52.009
looks for certain text:

00:12:52.149 --> 00:12:53.652
"start of focus", "end of focus".

00:12:54.172 --> 00:12:56.756
Then it narrows to that section, which might

00:12:57.157 --> 00:12:58.779
include several functions.

00:12:58.799 --> 00:13:00.822
Then I have another keyboard shortcut that

00:13:00.843 --> 00:13:03.346
just copies the entire buffer and adds a little

00:13:03.386 --> 00:13:05.349
text at the end, so I can run whatever function I

00:13:05.550 --> 00:13:06.150
need to test.

00:13:06.551 --> 00:13:08.734
I can paste that into the browser.

00:13:09.055 --> 00:13:12.680
Narrowing either to one function or to a

00:13:13.782 --> 00:13:16.566
predefined region or whatever else is very useful.

00:13:17.648 --> 00:13:19.150
[Prot]: Yes, very nice.

NOTE Indirect buffers

00:13:19.568 --> 00:13:20.693
[Sacha]: Then people are like, yeah, but

00:13:20.733 --> 00:13:23.024
what if I want to narrow to two

00:13:23.124 --> 00:13:24.591
parts of the same file?

00:13:25.917 --> 00:13:33.485
[Prot]: That's why you have indirect buffers there.

00:13:33.505 --> 00:13:35.067
[Sacha]: It's Emacs, of course there's a way

00:13:35.127 --> 00:13:35.647
to do it.

00:13:36.348 --> 00:13:38.650
Indirect buffers is another one of those

00:13:38.730 --> 00:13:41.053
built-ins that's a little hard to wrap your head

00:13:41.113 --> 00:13:45.077
around, because you're like, okay, you're opening

00:13:45.137 --> 00:13:49.261
a file twice, but you can have it narrowed to a

00:13:49.321 --> 00:13:51.323
different part of it, or you can be looking at a

00:13:51.443 --> 00:13:53.525
different part of it, or you can even have it in

00:13:53.565 --> 00:13:56.528
a different major mode.

00:13:57.436 --> 00:13:57.977
[Prot]: Yeah, yeah.

00:13:57.998 --> 00:14:01.267
And the point, like the practical one, is the

00:14:01.327 --> 00:14:03.633
different levels of narrow, really...

00:14:03.874 --> 00:14:05.919
The most common one, I mean,

00:14:05.939 --> 00:14:08.727
where it's like, okay, you focus on this heading

00:14:08.767 --> 00:14:12.036
and now you focus on this other heading.

00:14:12.370 --> 00:14:14.454
[Sacha]: I'll often split my buffer if I

00:14:14.514 --> 00:14:17.119
know that I'm not going to narrow.

00:14:17.360 --> 00:14:20.085
So that way, if I need to refer to two parts of

00:14:20.125 --> 00:14:23.371
the file at the same time, I can have one window

00:14:23.491 --> 00:14:25.796
focusing on one part of it and the other window

00:14:25.836 --> 00:14:26.998
focusing on the other part of it.

00:14:27.018 --> 00:14:28.641
It might even be a different frame.

00:14:28.621 --> 00:14:31.124
And that way, I don't

00:14:31.164 --> 00:14:32.486
have to keep switching back and forth.

00:14:32.526 --> 00:14:34.929
I don't have to scroll up and down all the time.

00:14:34.949 --> 00:14:37.292
I can just look at one and then look at the other

00:14:37.472 --> 00:14:40.536
and arrange my windows and my desktop as I see fit.

00:14:40.556 --> 00:14:42.779
But if you want to do something more complicated,

00:14:43.280 --> 00:14:45.582
like more narrowing or different modes or

00:14:45.623 --> 00:14:49.267
whatever, then cloning an indirect buffer is the

00:14:49.307 --> 00:14:49.988
way to do it.

NOTE Undoing within a region

00:14:50.980 --> 00:14:54.423
[Prot]: I don't know if you have this,

00:14:54.424 --> 00:14:55.285
but because you

00:14:55.325 --> 00:14:57.648
mentioned the region earlier, I will say it.

00:14:57.908 --> 00:14:59.730
Maybe you have it somewhere, I don't see it there.

00:15:01.452 --> 00:15:05.978
You know regular undo in Emacs and how it works,

00:15:05.998 --> 00:15:08.220
but when you have a region selected, undo works

00:15:08.300 --> 00:15:08.921
in the region.

00:15:09.962 --> 00:15:12.325
So you make a change here, you go make some

00:15:12.365 --> 00:15:15.028
changes up there, you come back here, you mark

00:15:15.108 --> 00:15:17.371
this region, undo only works here, it doesn't

00:15:17.391 --> 00:15:18.372
work up there anymore.

00:15:18.672 --> 00:15:20.575
[Sacha]: Oh yeah, that's definitely a

00:15:20.736 --> 00:15:23.440
built-in that people will benefit from if they develop

00:15:23.460 --> 00:15:24.482
an intuition for it.

00:15:25.204 --> 00:15:28.049
If you've made a bunch of changes to your file

00:15:28.549 --> 00:15:31.394
and you notice that something's wrong in just

00:15:31.415 --> 00:15:34.139
this section, you can select the region and then

00:15:34.260 --> 00:15:38.487
undo within it to just fix those things.

00:15:39.715 --> 00:15:42.563
Those are some of the things that I've thought

00:15:42.603 --> 00:15:45.370
about for focus or distraction or getting tempted

00:15:45.410 --> 00:15:46.493
to go down rabbit holes.

00:15:46.654 --> 00:15:50.203
Do you use any of the other Emacs built-ins to

00:15:50.263 --> 00:15:52.810
help you with your tendency to dive really deep

00:15:52.870 --> 00:15:53.472
into something?

NOTE Bookmarks

00:15:53.975 --> 00:15:55.838
[Prot]: So the other one would be bookmarks.

00:15:55.858 --> 00:15:57.681
You mentioned it already,

00:15:57.701 --> 00:16:00.665
but it really is worth having it there,

00:16:01.386 --> 00:16:04.872
because the nice thing with bookmarks is that not

00:16:05.012 --> 00:16:08.758
only it's a way to go to a place, but you also

00:16:09.018 --> 00:16:10.480
give it a name.

00:16:10.601 --> 00:16:12.103
So the counterpart...

00:16:12.123 --> 00:16:14.126
Like you said, okay, I have a key to quickly go

00:16:14.206 --> 00:16:17.451
to my init file, for example, my configuration file.

00:16:17.566 --> 00:16:21.733
But what if I want to have something by name that

00:16:21.813 --> 00:16:26.701
doesn't quite fit nicely in all the keys, right?

00:16:26.721 --> 00:16:28.343
Then I can have a descriptive name.

00:16:28.383 --> 00:16:29.085
Maybe it's long.

00:16:29.145 --> 00:16:33.452
For example, my notes for my meeting with Sacha,

00:16:33.472 --> 00:16:35.996
which is in mid-June, blah, blah, blah, right?

00:16:36.256 --> 00:16:38.780
I can have a long name like that, which

00:16:38.860 --> 00:16:41.224
is descriptive and gives me context.

00:16:41.244 --> 00:16:43.067
Then I use a bookmark for that.

00:16:43.351 --> 00:16:45.534
[Sacha]: And that's a great built-in

00:16:45.574 --> 00:16:48.036
solution for the general problem of finding your

00:16:48.117 --> 00:16:49.518
way around.

00:16:49.538 --> 00:16:51.921
So in case you're trying to find your way around

00:16:51.981 --> 00:16:54.604
different files or different projects or

00:16:54.684 --> 00:16:58.068
different places in various files, bookmarks are

00:16:58.108 --> 00:17:00.751
great for that because you can give it a name.

00:17:00.791 --> 00:17:04.496
That means you can file more things than will fit

00:17:04.556 --> 00:17:05.237
on your keyboard.

00:17:05.957 --> 00:17:09.021
Kind of an advanced

00:17:09.001 --> 00:17:11.933
use of it, I was talking to Ben

00:17:11.934 --> 00:17:15.433
in the previous Emacs Chat about

00:17:15.434 --> 00:17:19.000
So he bookmarks Elfeed searches,

00:17:19.001 --> 00:17:21.266
and based on his naming convention,

00:17:21.267 --> 00:17:23.067
if he names his bookmark a certain way,

00:17:23.068 --> 00:17:25.667
then it becomes available for

00:17:25.668 --> 00:17:27.500
these other functions that he has.

00:17:27.501 --> 00:17:29.200
So if you have a naming convention for your

00:17:29.201 --> 00:17:31.097
bookmarks, you can do other things with it from

00:17:31.237 --> 00:17:32.038
Emacs Lisp.

00:17:33.233 --> 00:17:34.194
[Prot]: Yeah, exactly.

00:17:34.214 --> 00:17:37.139
That's the more advanced power user thing.

00:17:37.159 --> 00:17:39.943
It's just data and you have access to it.

NOTE isearch

00:17:41.205 --> 00:17:42.287
[Sacha]: Going back to something a little

00:17:42.327 --> 00:17:45.111
more basic for the problem of finding your way

00:17:45.171 --> 00:17:47.815
around, I think that isearch is one of those

00:17:47.875 --> 00:17:50.499
built-ins that people coming from a different

00:17:50.579 --> 00:17:52.963
editor might not think of using.

00:17:53.281 --> 00:17:59.191
"Find in page" is an annoying experience in a

00:17:59.251 --> 00:18:01.054
browser or in other editors.

00:18:01.074 --> 00:18:03.357
You have to go to the menu, you do it, and then

00:18:03.498 --> 00:18:05.601
there's things you have to click on in order to

00:18:05.641 --> 00:18:07.725
go to the next one or the previous one and so

00:18:07.805 --> 00:18:08.546
forth.

00:18:08.566 --> 00:18:11.230
But isearch lets you just keep typing and then

00:18:11.471 --> 00:18:13.474
you can just press the isearch shortcut again,

00:18:13.574 --> 00:18:16.298
`C-s`, to search for the next one, or you can

00:18:16.359 --> 00:18:19.103
go to the previous one very easily.

00:18:19.083 --> 00:18:21.467
So isearch is great.

NOTE Tip: Add a counter to isearch

00:18:21.487 --> 00:18:22.229
[Prot]: Yeah, yeah, it is.

00:18:22.749 --> 00:18:25.895
I think one nice quality of life improvement to

00:18:25.975 --> 00:18:28.720
it, which again is several Emacs versions old, is

00:18:29.020 --> 00:18:29.662
a counter.

00:18:30.062 --> 00:18:33.608
Like it shows you are on number 3 out of

00:18:33.628 --> 00:18:35.031
10, for example.

00:18:35.051 --> 00:18:37.395
You have a sense of where you are going.

00:18:38.050 --> 00:18:40.455
[Sacha]: Otherwise, I find I just wrap

00:18:40.515 --> 00:18:42.619
around to the beginning and I

00:18:42.639 --> 00:18:45.365
take a moment to reorient myself because it has

00:18:45.906 --> 00:18:47.489
wrapped around.

00:18:47.770 --> 00:18:49.494
The other thing that I want to point out

00:18:50.335 --> 00:18:55.245
related to isearch as well is using it to help

00:18:55.706 --> 00:18:57.510
you mark a region.

00:18:57.929 --> 00:19:00.813
This is something that people aren't

00:19:00.933 --> 00:19:04.237
used to because in other editors, you highlight

00:19:04.337 --> 00:19:05.619
things with your mouse, right?

00:19:06.280 --> 00:19:08.401
Here in Emacs, we say, okay,

00:19:08.402 --> 00:19:09.703
press C-SPC to say

00:19:09.704 --> 00:19:11.065
you're going to start a region,

00:19:11.066 --> 00:19:13.008
and then just search for the end of the region,

00:19:13.489 --> 00:19:17.754
navigate to it somewhere, and

00:19:17.774 --> 00:19:20.457
the text between

00:19:20.458 --> 00:19:22.219
when you press C-SPC

00:19:22.220 --> 00:19:23.721
and where your cursor is now,

00:19:23.722 --> 00:19:24.763
that's the region.

00:19:25.368 --> 00:19:26.550
[Prot]: Yes, exactly.

NOTE C-x C-x (exchange-point-and-mark)

00:19:26.570 --> 00:19:31.037
On this note, `C-x C-x`.

00:19:31.097 --> 00:19:34.582
By default, it's `exchange-point-and-mark`.

00:19:34.602 --> 00:19:37.607
Which, if your cursor is here and where you

00:19:37.627 --> 00:19:40.532
started is up there, it moves the cursor up there

00:19:40.792 --> 00:19:43.616
and now where you started is down at that point.

00:19:44.097 --> 00:19:46.261
You can expand the region both ways.

00:19:47.643 --> 00:19:49.806
You can keep switching and expanding.

00:19:50.123 --> 00:19:51.585
[Sacha]: I have never thought about using it

00:19:51.625 --> 00:19:52.687
for expanding the region.

00:19:52.827 --> 00:19:55.231
I usually just use it to confirm that, yes, I am

00:19:55.351 --> 00:19:57.073
actually selecting the parts that I meant to

00:19:57.133 --> 00:19:57.494
select.

00:19:57.855 --> 00:19:59.417
Because by the time, of course, I've found the

00:19:59.457 --> 00:20:01.320
thing that I wanted to end the region with, I've

00:20:01.380 --> 00:20:04.004
forgotten or I'm not entirely sure I have the

00:20:04.044 --> 00:20:04.625
right start.

00:20:04.765 --> 00:20:07.609
So I was using `C-x C-x` to

00:20:07.649 --> 00:20:09.752
quickly verify and have everything nicely

00:20:09.792 --> 00:20:10.313
highlighted.

00:20:10.734 --> 00:20:12.556
But expanding the region, yeah, that's a thing

00:20:12.576 --> 00:20:15.000
you can do with it.

00:20:15.858 --> 00:20:16.880
[Prot]: Yeah, yeah, of course.

00:20:16.920 --> 00:20:18.722
Now it's obvious, right?

00:20:18.762 --> 00:20:22.107
But it's something that you may notice by

00:20:22.148 --> 00:20:23.029
mistake, by accident.

00:20:23.590 --> 00:20:50.412
[Sacha]: [interrupted by life]

00:20:50.432 --> 00:20:52.075
@charliemcmackin4859 says, "I love that you can make those

00:20:52.135 --> 00:20:54.638
marking tricks part of a keyboard macro."

NOTE Popping to marks - going back to where you were

00:20:55.279 --> 00:20:57.281
Oh, the other thing I want to say with marks is

00:20:57.481 --> 00:21:00.445
you can also navigate by mark.

00:21:00.425 --> 00:21:04.736
C-x SPC?

00:21:04.756 --> 00:21:07.524
[Prot]: `C-u C-SPC`.

00:21:08.045 --> 00:21:11.113
I think it's `pop-to-mark` is the concept.

00:21:13.058 --> 00:21:14.221
[Sacha]: Popping to mark.

00:21:14.241 --> 00:21:15.946
We'll just go with the concept because people can

00:21:15.966 --> 00:21:17.269
search for the key binding.

00:21:17.249 --> 00:21:21.075
Which basically means for all the places where

00:21:21.135 --> 00:21:24.341
you were before you went off searching for

00:21:24.401 --> 00:21:26.784
something else or doing some other command,

00:21:26.785 --> 00:21:29.469
you can go back to those places in sequence.

00:21:30.010 --> 00:21:32.134
I think there are even some commands to let

00:21:32.154 --> 00:21:34.918
you easily navigate through all the places

00:21:34.958 --> 00:21:36.481
you've been previously.

00:21:36.501 --> 00:21:39.966
That is a thing that you can do with Emacs

00:21:40.006 --> 00:21:40.467
built-ins.

00:21:40.788 --> 00:21:41.849
It's called popping the mark.

00:21:41.970 --> 00:21:43.392
It lets you revisit places.

00:21:44.148 --> 00:21:44.909
[Prot]: Yeah, yeah.

00:21:44.929 --> 00:21:47.732
Another point related to this and also related to

00:21:47.852 --> 00:21:49.374
yank that we said earlier...

NOTE Selecting what you just pasted

00:21:49.394 --> 00:21:51.917
Imagine you have copied something and you are

00:21:51.997 --> 00:21:54.079
pasting it now in your Emacs.

00:21:54.099 --> 00:21:56.742
Then what you want to do is select it, maybe

00:21:56.782 --> 00:21:59.265
to do something with it, such as to

00:21:59.385 --> 00:22:01.628
make it all up case or whatever, right?

00:22:01.648 --> 00:22:04.852
Instead of selecting it manually, you can just

00:22:04.892 --> 00:22:07.955
do `C-x C-x`. Because when you paste

00:22:08.075 --> 00:22:11.039
something or when you do I search or whatever, it

00:22:11.099 --> 00:22:13.041
has the effect of updating the mark.

00:22:13.612 --> 00:22:16.437
Then you can work with that.

00:22:16.657 --> 00:22:18.460
[Sacha]: Yeah, that one I use fairly often.

00:22:19.522 --> 00:22:21.786
Also, that way, you can easily

00:22:21.866 --> 00:22:25.432
see what it highlights, the part that you've just

00:22:25.492 --> 00:22:29.018
pasted, and then you can do your other

00:22:29.198 --> 00:22:31.722
replacements or uppercasing or whatever else

00:22:32.223 --> 00:22:33.445
to it.

NOTE Indenting pasted or selected text with indent-rigidly

00:22:33.706 --> 00:22:35.729
[Prot]: The nice part for this is the

00:22:35.910 --> 00:22:37.392
`indent-rigidly`,

00:22:39.278 --> 00:22:43.408
`C-x C-i` by default, where you can now

00:22:43.468 --> 00:22:46.815
have a region of text including an implicit

00:22:46.976 --> 00:22:50.323
region between mark and point, and you just shift

00:22:50.344 --> 00:22:53.170
it around, literally left or right.

00:22:54.213 --> 00:22:54.593
Try it.

00:22:54.614 --> 00:22:55.675
It's very nice.

00:22:55.695 --> 00:22:58.479
[Sacha]: `C-x C-i`.

00:23:01.462 --> 00:23:03.365
I think you can even use the arrow keys to

00:23:03.405 --> 00:23:04.086
move things,

00:23:04.126 --> 00:23:07.170
so you can just nudge it until it looks right,

00:23:07.190 --> 00:23:08.832
which is great because sometimes, when you paste

00:23:08.872 --> 00:23:11.676
things, the indentation isn't the same

00:23:11.716 --> 00:23:13.358
as all of the rest of your stuff.

00:23:13.378 --> 00:23:15.521
You might want to put it all the way into an

00:23:15.661 --> 00:23:19.786
Org list or whatever else, code block, whatever.

00:23:20.287 --> 00:23:20.768
[Prot]: Okay.

00:23:20.848 --> 00:23:23.011
[Sacha]: So `C-x C-x`, very handy

00:23:23.111 --> 00:23:24.152
even after you paste.

NOTE Popping to mark after xref or imenu

00:23:24.487 --> 00:23:28.171
Oh, @hmelman also points out the fact that

00:23:28.411 --> 00:23:31.475
things like xref or imenu push the last location

00:23:31.515 --> 00:23:34.117
before jumping means popping the mark is an easy

00:23:34.177 --> 00:23:36.840
way to go back from various navigation mechanisms.

00:23:37.461 --> 00:23:40.704
In general, if you have navigated away from

00:23:40.805 --> 00:23:43.507
something using some magical Emacs command that

00:23:43.548 --> 00:23:46.310
has taken you far from where you are, you can

00:23:46.351 --> 00:23:48.913
always find your way back home or back to where

00:23:48.973 --> 00:23:51.456
you were by popping the mark.

00:23:51.436 --> 00:23:53.402
I think there's even a distinction between

00:23:53.462 --> 00:23:56.893
popping the mark in your buffer

00:23:56.913 --> 00:23:59.060
versus popping your global mark.

00:23:59.481 --> 00:24:02.269
You can go to a different buffer that you were

00:24:02.310 --> 00:24:04.737
just in if you wanted to.

NOTE Adding other packages like consult

00:24:05.645 --> 00:24:07.687
[Prot]: Very nice.

00:24:07.727 --> 00:24:11.592
Many of these are also augmented by

00:24:11.712 --> 00:24:15.436
packages. When you install a package, it doesn't

00:24:15.497 --> 00:24:18.180
introduce completely new functionality. It adds to

00:24:18.200 --> 00:24:20.703
existing one. For example, the consult package,

00:24:20.763 --> 00:24:23.866
which is very useful, very nice, has something to

00:24:23.926 --> 00:24:26.750
do with what we just mentioned. Like,

00:24:26.830 --> 00:24:28.611
navigating the mark in a visual way,

00:24:28.612 --> 00:24:29.593
so you get to see it.

00:24:30.232 --> 00:24:34.537
[Sacha]: @hmelman points out that local and global

00:24:34.597 --> 00:24:37.179
marks are useful to navigate through.

00:24:37.700 --> 00:24:40.223
Check out all these other packages for adding

00:24:40.263 --> 00:24:41.844
extra functionality around that.

NOTE Tip about indicating isearch wrapping

00:24:44.447 --> 00:24:46.889
@matthewjorgensen9115 says,

00:24:46.890 --> 00:24:48.191
"thinking about isearch wrapping

00:24:48.251 --> 00:24:48.792
around search,

00:24:48.812 --> 00:24:50.734
gwhen you get to the bottom of your file, when

00:24:50.754 --> 00:24:53.336
you're isearching and there's no other matches to

00:24:53.376 --> 00:24:56.320
be found, it will by default wrap you around to

00:24:56.360 --> 00:24:57.741
the beginning of the file so you can keep

00:24:57.801 --> 00:24:58.602
searching from there."

00:24:58.970 --> 00:25:02.957
Matthew says you can either have scroll to

00:25:02.997 --> 00:25:04.820
position to know the direction

00:25:05.581 --> 00:25:07.544
(it also indicates the position in your mode line),

00:25:07.905 --> 00:25:09.828
or you can have your mode line flash to see it

00:25:09.888 --> 00:25:11.651
move from last to first.

00:25:11.671 --> 00:25:12.913
I don't have that configured.

00:25:12.993 --> 00:25:14.716
I should look into how to get that configured

00:25:15.116 --> 00:25:16.919
because it's like all these little things, right?

00:25:20.585 --> 00:25:21.907
But sometimes you don't need

00:25:21.927 --> 00:25:23.830
to make a big navigational jump.

00:25:23.850 --> 00:25:26.033
You just need to move forward by a little bit.

NOTE Navigating by sentence or s-expression

00:25:26.814 --> 00:25:30.139
Emacs has built-in shortcuts for navigating

00:25:30.259 --> 00:25:34.244
by expression, maybe things inside the

00:25:34.284 --> 00:25:37.369
parentheses or things inside the quotes, as well

00:25:37.469 --> 00:25:40.473
as natural language shortcuts like navigating by

00:25:40.573 --> 00:25:42.696
word or by sentence.

00:25:42.716 --> 00:25:44.980
Those are some very useful built-ins that are

00:25:45.060 --> 00:25:47.303
well worth learning the keyboard shortcuts for.

00:25:48.397 --> 00:25:50.080
[Prot]: Yes, indeed.

00:25:50.100 --> 00:25:51.822
Of course, we call them

00:25:51.982 --> 00:25:55.287
S-expressions and the terminology of the commands

00:25:55.328 --> 00:25:58.352
alludes to Lisp, but they work in other

00:25:58.392 --> 00:25:59.734
programming languages as well.

00:26:00.535 --> 00:26:01.897
For example, there is the

00:26:01.898 --> 00:26:05.303
`forward-sexp`, but it works in other languages

00:26:05.683 --> 00:26:08.127
which don't have this Lispy syntax.

00:26:08.647 --> 00:26:12.410
[Sacha]: So if you skipped over that part of

00:26:12.450 --> 00:26:15.033
the tutorial or the manual, go back and read it

00:26:15.093 --> 00:26:16.534
because it can save you some time.

00:26:16.934 --> 00:26:20.637
In a pinch, it will also help you

00:26:20.677 --> 00:26:23.440
make sure that your parentheses are matched up

00:26:23.500 --> 00:26:25.762
correctly and you go to where you expect them to go.

00:26:26.583 --> 00:26:28.664
There are other ways to make it easier to match

00:26:28.764 --> 00:26:31.106
up parentheses or braces or brackets or quotes

00:26:31.547 --> 00:26:33.569
like [ `show-paren-mode` ] or whatever.

00:26:33.589 --> 00:26:36.972
Sometimes I just go forward and back to see

00:26:37.012 --> 00:26:38.653
whether I end up in the right place.

00:26:38.633 --> 00:26:42.016
[Prot]: A small trick here,

00:26:42.017 --> 00:26:44.059
if you are writing specifically Emacs Lisp,

00:26:44.060 --> 00:26:46.563
there is a very common mistake of adding

00:26:46.663 --> 00:26:48.866
an extra parenthesis, and it says "end of

00:26:48.926 --> 00:26:52.150
file during parsing", or one less parenthesis, what

00:26:52.190 --> 00:26:54.373
you can do with a combination of keyboard macros...

00:26:54.793 --> 00:26:56.975
You go to the beginning

00:26:56.976 --> 00:27:00.761
and you do `C-M-e` to go to the end of the defun,

00:27:01.322 --> 00:27:04.405
and then, in a keyboard macro, you keep doing that.

00:27:04.606 --> 00:27:08.050
Next, next, next, end, end, end, right? Until it stops,

00:27:08.030 --> 00:27:09.592
and you know where your error is.

00:27:10.093 --> 00:27:11.995
[Sacha]: Oh, and I should tell people, if

00:27:12.055 --> 00:27:15.459
you give the `execute-kbd-macro` a negative

00:27:15.679 --> 00:27:17.502
argument, it'll run until error.

00:27:17.762 --> 00:27:18.802
So you just do that

00:27:18.803 --> 00:27:20.666
and it'll drop you where it ends.

00:27:20.686 --> 00:27:23.849
You don't have to manually press `e` 500 times.

00:27:24.691 --> 00:27:25.371
[Prot]: Exactly.

00:27:25.391 --> 00:27:27.955
The "run until error" happens when you are in a

00:27:28.015 --> 00:27:29.076
narrowed region as well.

00:27:29.697 --> 00:27:32.400
Error here means end of region, end of buffer.

00:27:33.342 --> 00:27:35.167
[Sacha]: I should point out in the specific

00:27:35.207 --> 00:27:37.313
case where you're trying to hunt down a stray

00:27:37.353 --> 00:27:39.390
parenthesis, you should also just use

00:27:39.391 --> 00:27:41.003
check-parens, which will tell you.

00:27:42.346 --> 00:27:44.572
[Prot]: Of course.

NOTE Navigating to other errors

00:27:45.334 --> 00:27:48.904
[Sacha]: And for other errors

00:27:49.070 --> 00:27:53.395
not just limited to missing quotation marks or

00:27:53.435 --> 00:27:54.096
parentheses,

00:27:54.797 --> 00:27:57.881
it's well worth taking the time to set up

00:27:58.401 --> 00:28:01.164
flycheck or flymake or whatever error checking

00:28:01.205 --> 00:28:03.547
thing you want to use, because then you can

00:28:03.667 --> 00:28:06.150
navigate to the previous and next errors as

00:28:06.251 --> 00:28:10.315
easily as you would with keyboard shortcuts.

00:28:10.816 --> 00:28:12.999
If you get the hang of doing that, you can

00:28:13.099 --> 00:28:16.663
also use the same mental model to navigate through...

00:28:16.880 --> 00:28:21.047
If you're doing a keyword search with grep, then

00:28:21.067 --> 00:28:22.870
you can use the `next-error`, `previous-error` to

00:28:22.930 --> 00:28:25.073
also go to just the next match or the previous match.

00:28:26.135 --> 00:28:28.279
[Prot]: That's very useful.

NOTE Tags

00:28:29.561 --> 00:28:31.263
[Sacha]: I am not using tags nearly as much

00:28:31.304 --> 00:28:34.669
as I probably should for navigating symbols.

00:28:35.459 --> 00:28:36.962
[Prot]: Tags, yeah, in the context of

00:28:37.003 --> 00:28:37.464
programming.

00:28:37.824 --> 00:28:39.669
Me, I haven't used that, no.

00:28:39.689 --> 00:28:40.671
[Sacha]: Oh, yeah?

00:28:40.691 --> 00:28:42.194
I guess because you primarily work with

00:28:42.195 --> 00:28:44.699
Emacs Lisp, it's easy enough

00:28:44.700 --> 00:28:46.184
to find the definition from there.

NOTE Imenu

00:28:47.186 --> 00:28:51.075
[Prot]: But imenu is the other one, along those lines.

00:28:51.095 --> 00:28:51.997
[Sacha]: That's interesting.

00:28:52.078 --> 00:28:54.463
You don't use the menu bar, but you use imenu.

00:28:55.169 --> 00:28:57.672
[Prot]: Yes, imenu is useful because, of

00:28:57.732 --> 00:28:58.993
course, it's with completion.

00:28:59.854 --> 00:29:01.796
Now, I should say here, of course, that the

00:29:01.836 --> 00:29:06.521
default imenu has this concept of going in steps,

00:29:06.541 --> 00:29:08.864
but you can flatten the list, which is more

00:29:08.984 --> 00:29:12.468
interesting for the purpose of completion.

00:29:13.269 --> 00:29:15.912
I believe what I'm saying is the case, but I

00:29:15.952 --> 00:29:16.733
don't remember anymore.

00:29:16.853 --> 00:29:19.516
But you can have a flattened list, at which point

00:29:19.576 --> 00:29:21.598
you navigate the file with completion.

00:29:22.388 --> 00:29:25.151
[Sacha]: I should try that because I really

00:29:25.232 --> 00:29:27.935
like the way that Org, when you're navigating by

00:29:27.975 --> 00:29:31.119
the outline, you can also configure it to flatten

00:29:31.159 --> 00:29:32.981
the list so you don't have to complete the

00:29:33.041 --> 00:29:34.904
heading and the next setting and all that stuff.

00:29:35.564 --> 00:29:38.628
@hmelman says you don't actually need flymake for the

00:29:39.189 --> 00:29:40.370
error navigation thing.

00:29:40.771 --> 00:29:43.393
You can just use `next-error`

00:29:43.394 --> 00:29:44.695
and `previous-error` which works with

00:29:44.696 --> 00:29:46.158
`compile` and `grep` and `occur`

00:29:46.578 --> 00:29:48.661
and a bunch of other things that have the

00:29:48.721 --> 00:29:49.662
same convention.

00:29:49.777 --> 00:29:53.001
So yes, if you use the `M-x compile` command to

00:29:53.081 --> 00:29:56.706
run whatever your compilation step is, it will

00:29:56.787 --> 00:30:01.593
parse the output of many compilation systems,

00:30:02.034 --> 00:30:04.497
programs, and it will let you jump to the next

00:30:04.597 --> 00:30:04.857
error.

00:30:04.877 --> 00:30:07.141
It will also even show you the errors, I think.

00:30:07.161 --> 00:30:09.444
Anyway, so you don't need flymake.

00:30:10.765 --> 00:30:12.328
Flymake just gives you the squiggly underlines.

00:30:12.868 --> 00:30:15.091
But you can use `next-error` right away.

00:30:16.353 --> 00:30:16.854
[Prot]: Yeah, yeah, yeah.

00:30:16.874 --> 00:30:18.616
Flymake is more narrow.

00:30:18.636 --> 00:30:19.277
Yeah, correct.

NOTE Projects

00:30:19.662 --> 00:30:23.546
[Sacha]: I think projects and project-based

00:30:23.566 --> 00:30:27.531
navigation is another big chunk of Emacs built-in

00:30:27.591 --> 00:30:30.915
functionality that is useful for people who have

00:30:30.955 --> 00:30:32.256
a hard time finding their way around.

00:30:32.276 --> 00:30:34.899
You don't have to manually find each file.

00:30:34.959 --> 00:30:36.701
You can set up shortcuts so you can say, I want

00:30:36.721 --> 00:30:37.662
to go to this project.

00:30:38.063 --> 00:30:41.467
Then from within this project, I can find a

00:30:41.527 --> 00:30:44.590
file very easily.

00:30:44.637 --> 00:30:46.720
[Prot]: This is indeed very

00:30:46.821 --> 00:30:50.406
powerful. The thing is you don't have to also

00:30:50.486 --> 00:30:54.874
think in terms of the structure of the project,

00:30:55.134 --> 00:30:57.317
like the tree structure of the project, because if

00:30:57.378 --> 00:31:00.663
you find the file in the project, it

00:31:00.763 --> 00:31:03.207
will flatten the structure for you, so then you

00:31:03.307 --> 00:31:05.711
use completion to find it or find the directory

00:31:05.771 --> 00:31:08.736
where something is. Of course, you can still

00:31:08.976 --> 00:31:11.320
use the tree view as well.

00:31:11.705 --> 00:31:13.727
[Sacha]: This is great because

00:31:13.987 --> 00:31:16.630
for example, in Java projects, the

00:31:16.750 --> 00:31:18.512
directory structure gets very deep because they

00:31:18.532 --> 00:31:20.734
have to be their domain name and

00:31:20.874 --> 00:31:22.196
package names and all that stuff.

00:31:23.016 --> 00:31:27.100
Just have either project or projectile index all

00:31:27.120 --> 00:31:28.922
of your files for you, and then you can jump to a

00:31:28.982 --> 00:31:31.104
file by name anywhere in your structure.

00:31:31.545 --> 00:31:34.148
You can tell it also to ignore certain files,

00:31:34.168 --> 00:31:36.310
which is handy so that you don't have to go into

00:31:36.370 --> 00:31:37.631
your node-modules.

00:31:38.492 --> 00:31:39.653
That would be silly.

00:31:40.308 --> 00:31:44.254
[Prot]: Yeah, that would be a nightmare.

00:31:44.255 --> 00:31:49.204
[Sacha]: Do we have basically the Emacs

00:31:49.244 --> 00:31:51.108
built-ins for finding your way around well

00:31:51.148 --> 00:31:53.592
covered here, or other other recommendations that

00:31:53.632 --> 00:31:56.116
people should go check out?

00:31:56.117 --> 00:31:59.683
[Prot]: These are already very useful, yeah.

00:32:00.102 --> 00:32:06.928
Most of these, if not all, are augmented by packages.

00:32:07.008 --> 00:32:09.410
So the core functionality is there, and then you

00:32:09.451 --> 00:32:10.932
can do more stuff with them.

NOTE Putting projects in tabs or frames

00:32:10.952 --> 00:32:14.855
For example, with projects, you may want to have

00:32:14.895 --> 00:32:16.897
an arrangement where you put them in separate

00:32:16.997 --> 00:32:20.060
tabs, and then you use a package like tabspaces

00:32:20.521 --> 00:32:23.283
so that each tab has its own buffer list, or

00:32:23.603 --> 00:32:26.466
my package beframe so that you put them in

00:32:26.506 --> 00:32:27.527
separate frames.

00:32:27.507 --> 00:32:30.152
Each frame has its own buffer list,

00:32:30.172 --> 00:32:32.517
so that basically when you search for buffers,

00:32:32.537 --> 00:32:35.062
you only see those related to the project.

NOTE Tabs

00:32:35.102 --> 00:32:36.986
[Sacha]: I am not using tabs nearly as much

00:32:37.086 --> 00:32:38.870
as I probably could,

00:32:39.291 --> 00:32:42.236
so that is one of my underappreciated Emacs

00:32:42.277 --> 00:32:43.018
built-ins here.

00:32:43.387 --> 00:32:47.112
I'm getting the sense that people use tabs to

00:32:47.152 --> 00:32:50.817
say, okay, this is the set of windows related to

00:32:52.580 --> 00:32:55.824
managing my mail, or this is a set of tabs

00:32:55.864 --> 00:32:57.066
related to this project.

00:32:57.126 --> 00:32:59.930
This is a set of windows related to this project,

00:32:59.970 --> 00:33:02.774
or this is a set of windows related to managing

00:33:02.954 --> 00:33:04.256
my notes about something.

00:33:04.977 --> 00:33:07.200
Is that what you use tabs for?

00:33:07.940 --> 00:33:09.643
[Prot]: I seldom use them.

00:33:09.803 --> 00:33:12.868
I use them specifically only within the context

00:33:12.949 --> 00:33:17.757
of popping into a Magit interface.

00:33:18.157 --> 00:33:20.542
So I have my project that I'm working on.

00:33:20.602 --> 00:33:22.325
Let's say it's split in three windows.

00:33:22.745 --> 00:33:25.069
And then I want to leave everything intact and

00:33:25.129 --> 00:33:28.014
just go into Magit to do some Git operation.

00:33:28.595 --> 00:33:31.300
I configure `display-buffer-alist`

00:33:31.320 --> 00:33:33.103
so when I do Emacs Magit,

00:33:33.083 --> 00:33:36.100
magit-status or whatever, it goes in a new tab.

00:33:36.101 --> 00:33:39.133
Then I leave my work where it is.

00:33:39.134 --> 00:33:41.300
I do the git thing,

00:33:41.301 --> 00:33:44.733
then I quit those. I'm back to my layout.

00:33:44.734 --> 00:33:48.190
[Sacha]: I know you're a

00:33:48.878 --> 00:33:51.322
good advocate of checking out

00:33:51.382 --> 00:33:53.385
display-buffer-alist and all the wonderful

00:33:53.425 --> 00:33:54.167
things it can do.

00:33:54.828 --> 00:33:57.492
I should definitely look into having it set up a

00:33:57.552 --> 00:34:01.298
tab because that sounds a lot nicer than trying

00:34:01.318 --> 00:34:03.061
to remember, okay, I need to save my window

00:34:03.121 --> 00:34:06.887
configuration to register and then do this thing.

00:34:07.137 --> 00:34:09.519
I have it set up actually so that I can

00:34:09.520 --> 00:34:12.884
`winner-undo` in order to get back to my previous

00:34:13.685 --> 00:34:14.525
configuration.

00:34:15.027 --> 00:34:17.730
But of course, if I need to flip back and forth

00:34:17.810 --> 00:34:21.335
between two different views, like Magit and

00:34:21.554 --> 00:34:24.739
my project code, then a tab would work much

00:34:24.799 --> 00:34:26.161
better for this purpose, I think.

00:34:27.042 --> 00:34:28.924
[Prot]: Yes, and it scales better as well,

00:34:28.964 --> 00:34:31.828
like if you need to have three tabs or whatever.

00:34:32.112 --> 00:34:35.260
[Sacha]: Or a new frame.

00:34:35.340 --> 00:34:37.687
But sometimes managing frames gets a little

00:34:37.726 --> 00:34:38.447
annoying too.

00:34:39.672 --> 00:34:40.353
[Prot]: Of course, of course.

00:34:40.373 --> 00:34:41.777
There are pros and cons.

NOTE Navigating frames

00:34:41.797 --> 00:34:44.543
Speaking of frames, one nice thing is that there

00:34:44.745 --> 00:34:47.893
is completion again to select frames.

00:34:48.059 --> 00:34:49.821
So I forget how it's called.

00:34:49.841 --> 00:34:51.422
[ `select-frame` ], I think, is the command.

00:34:51.922 --> 00:34:55.065
If you have lots of frames and you don't know

00:34:55.167 --> 00:34:57.909
where they are, you can use completion for that.

00:34:58.090 --> 00:35:01.533
If you want, you can also name frames.

00:35:01.914 --> 00:35:03.515
I believe it's rename frame. [`set-frame-name`]

00:35:03.555 --> 00:35:04.817
I forget now the command.

00:35:04.837 --> 00:35:06.879
Basically, you can give it a specific name

00:35:07.239 --> 00:35:09.502
rather than it changing the name all the time.

00:35:10.162 --> 00:35:12.165
So you can say, OK, this is my super

00:35:12.185 --> 00:35:14.527
important note for our livestream, right?

00:35:15.188 --> 00:35:16.349
That's the frame for you.

00:35:16.369 --> 00:35:17.290
Now you can find it.

00:35:18.721 --> 00:35:19.742
[Sacha]: I should look into that.

00:35:19.942 --> 00:35:23.326
I also underutilize frames because for the most

00:35:23.366 --> 00:35:27.971
part, I have a keyboard shortcut like Super 1

00:35:28.692 --> 00:35:32.015
which jumps back to Emacs, raises my

00:35:32.095 --> 00:35:33.497
Emacs window.

00:35:33.677 --> 00:35:35.739
But it doesn't work so well if I have multiple

00:35:35.839 --> 00:35:37.942
Emacs window, like multiple Emacs frames.

00:35:38.723 --> 00:35:42.306
If I can figure out how to get mentally

00:35:42.527 --> 00:35:45.650
through that or if I switch to EXWM as my window

00:35:45.690 --> 00:35:46.551
manager,

00:35:48.353 --> 00:35:50.837
then I'm sure that managing multiple Emacs frames

00:35:50.857 --> 00:35:52.259
will be a lot easier.

00:35:52.279 --> 00:35:53.300
But at least

00:35:53.320 --> 00:35:56.145
tabs, I can probably use within that one frame in

00:35:56.205 --> 00:35:58.108
order to manage different windows.

00:35:58.889 --> 00:36:00.731
[Prot]: I would say tabs is the first thing

00:36:00.771 --> 00:36:01.693
you want to check.

00:36:02.234 --> 00:36:04.477
Frames is a little bit more... You have to change

00:36:04.517 --> 00:36:05.839
your mental model a little bit.

NOTE These navigation shortcuts work for prose, too

00:36:07.135 --> 00:36:08.839
[Sacha]: @hmelman has one more tip to

00:36:08.899 --> 00:36:11.765
include in this section on finding your way

00:36:11.845 --> 00:36:12.326
around.

00:36:13.328 --> 00:36:16.434
You can use these S-expression commands

00:36:16.435 --> 00:36:17.557
in prose too.

00:36:17.918 --> 00:36:21.504
Like for example, `C-M-u` or `backwards-up-list`

00:36:21.505 --> 00:36:24.773
moves you out of a quote or a parenthesis

00:36:24.753 --> 00:36:27.833
and then you can `C-M-e` to go to the end of it.

00:36:27.834 --> 00:36:30.967
So even if you're writing, for example, a novel,

00:36:30.968 --> 00:36:32.667
and you're saying, okay, I want to

00:36:32.668 --> 00:36:35.933
get out of this quote and go to the next sentence,

00:36:35.934 --> 00:36:38.367
you can either isearch to the start of it,

00:36:38.368 --> 00:36:40.700
or you can go up out of the quote and then

00:36:40.701 --> 00:36:41.767
go to the end of the quote.

00:36:41.768 --> 00:36:46.005
Also very handy to learn the commands for killing

00:36:46.365 --> 00:36:47.326
an S expression [ `kill-sexp` ],

00:36:47.327 --> 00:36:48.989
which again also works with

00:36:49.169 --> 00:36:52.874
other stuff like quotes or parentheses, because

00:36:52.935 --> 00:36:55.058
then you can copy and paste things or you can

00:36:55.538 --> 00:36:56.279
kill it.

00:36:56.299 --> 00:36:57.581
You don't have to paste it back.

00:36:57.681 --> 00:36:59.304
It's just you delete it and then you type

00:36:59.344 --> 00:36:59.924
something else in.

00:37:00.145 --> 00:37:00.445
It's fine.

00:37:03.610 --> 00:37:05.132
[Prot]: Exactly, exactly.

00:37:05.152 --> 00:37:07.856
And one of those is the `mark-sexp`, which

00:37:07.936 --> 00:37:08.817
is very useful.

NOTE follow-mode

00:37:09.050 --> 00:37:10.111
[Sacha]: Oh yeah, oh yeah.

00:37:10.933 --> 00:37:14.017
And @matthewjorgensen9115 shares: `follow-mode` allows the same

00:37:14.097 --> 00:37:16.019
file with multiple frames like a book.

00:37:16.340 --> 00:37:18.623
So follow mode can work with two, three or more

00:37:18.743 --> 00:37:19.204
windows.

00:37:20.085 --> 00:37:21.987
You have an ultra wide, right?

00:37:22.728 --> 00:37:26.514
So like, okay, you can have several columns

00:37:26.634 --> 00:37:29.437
following the same file and you can scroll and

00:37:29.578 --> 00:37:32.482
all of them will scroll in sync.

00:37:32.682 --> 00:37:33.042
[Prot]: Yeah, yeah.

00:37:33.062 --> 00:37:33.803
It's quite nice.

00:37:33.964 --> 00:37:35.085
Quite nice.

00:37:35.105 --> 00:37:36.507
[Sacha]: I forget, does follow mode work

00:37:36.547 --> 00:37:38.770
with different files?

00:37:39.087 --> 00:37:40.869
[Prot]: With different files?

00:37:40.889 --> 00:37:41.810
I don't think so.

00:37:41.971 --> 00:37:44.674
Like kind of a scroll lock for all windows?

00:37:44.694 --> 00:37:45.695
[Sacha]: Yeah, yeah, yeah.

00:37:46.577 --> 00:37:47.057
[Prot]: I don't know.

00:37:47.077 --> 00:37:47.738
I don't think so.

00:37:48.419 --> 00:37:49.500
I haven't tried it.

00:37:49.801 --> 00:37:50.622
[Sacha]: Worth looking into. [`scroll-all-mode`]

NOTE Ediff

00:37:50.802 --> 00:37:53.886
If you do find yourself needing to compare one

00:37:53.966 --> 00:37:58.632
file with another manually, then maybe

00:37:58.696 --> 00:38:01.001
like ediff?

00:38:01.643 --> 00:38:05.552
[Prot]: Ediff would do that.

00:38:05.592 --> 00:38:06.714
You would have them side by side.

00:38:06.735 --> 00:38:09.701
But the thing with Ediff is that you don't get a

00:38:10.022 --> 00:38:11.205
scroll lock for both.

00:38:11.405 --> 00:38:14.472
It's only navigation through the differences.

00:38:14.492 --> 00:38:16.958
So that wouldn't be exactly that.

00:38:17.242 --> 00:38:18.965
[Sacha]: For the purposes of

00:38:19.025 --> 00:38:22.370
comparing, Ediff will let you compare two files,

00:38:22.390 --> 00:38:24.333
but you can even use it to compare two buffers.

00:38:24.894 --> 00:38:27.599
However, Prot does have some recommendations in

00:38:27.619 --> 00:38:31.124
the one on the defaults that you shared before on

00:38:31.184 --> 00:38:34.069
how to make Ediff more manageable.

00:38:35.028 --> 00:38:37.231
[Prot]: Yeah, I think by default it's not

00:38:37.291 --> 00:38:39.715
intuitive, because by default, when you do Ediff

00:38:39.735 --> 00:38:42.500
without any configuration, it will display its

00:38:42.640 --> 00:38:44.042
panel in a separate frame.

00:38:44.563 --> 00:38:46.406
If you have never used many frames, that's

00:38:46.466 --> 00:38:47.647
already your first problem.

00:38:47.668 --> 00:38:49.370
Like you don't even know what happened.

00:38:50.111 --> 00:38:54.158
The second problem is that the layout will be one

00:38:54.238 --> 00:38:58.144
above the other, which depending on your screen,

00:38:58.544 --> 00:39:01.489
you have like a wide screen, so it's not as easy

00:39:01.549 --> 00:39:02.250
of a layout.

00:39:02.230 --> 00:39:04.375
Then you have to figure out where the other

00:39:04.435 --> 00:39:05.798
frame with the panel is.

00:39:05.818 --> 00:39:08.083
Basically two variables where you change them

00:39:08.224 --> 00:39:10.288
and you have the panel at the bottom, the control

00:39:10.329 --> 00:39:14.057
panel and then file A here, file B there.

00:39:14.077 --> 00:39:15.499
And of course you can do it with three files

00:39:15.500 --> 00:39:15.801
as well.

00:39:16.152 --> 00:39:17.474
[Sacha]: I will find it and put it in the

00:39:17.514 --> 00:39:17.935
show notes.

00:39:19.016 --> 00:39:22.882
Matthew also points out the following also works

00:39:22.922 --> 00:39:24.223
with `centered-cursor-mode` [(it's a package)],

00:39:24.224 --> 00:39:24.864
which will keep the

00:39:24.904 --> 00:39:28.009
cursor position in the middle of the frame.

00:39:28.369 --> 00:39:30.833
So I can't remember whether there's also like a

00:39:30.893 --> 00:39:31.874
scroll lock or whatever.

00:39:32.195 --> 00:39:33.056
[Prot]: `scroll-lock-mode`.

00:39:33.357 --> 00:39:34.979
Yeah, there is `scroll-lock mode.

00:39:34.999 --> 00:39:37.182
[Sacha]: Or there was another

00:39:37.162 --> 00:39:40.026
Emacs built-in that someone mentioned that

00:39:40.066 --> 00:39:42.350
scrolls it one line at a time, keeping it

00:39:42.730 --> 00:39:45.254
centered, I guess, which the person found very

00:39:45.314 --> 00:39:47.217
useful because their cat was sitting on their

00:39:47.237 --> 00:39:51.443
laptop.

00:39:51.704 --> 00:39:55.048
So moral lesson is: learn about the Emacs built-in

00:39:55.069 --> 00:39:57.031
because you never know when a small mammal will

00:39:57.051 --> 00:39:59.094
be obscuring half of your screen.

00:40:00.216 --> 00:40:01.498
You can still use Emacs.

00:40:03.352 --> 00:40:07.821
Which actually is an interesting segue into this

00:40:07.841 --> 00:40:12.390
thing about discoverability because Emacs is

00:40:12.490 --> 00:40:13.993
quite unlike many other editors.

00:40:14.153 --> 00:40:16.779
It is very well documented and if you can figure

00:40:16.819 --> 00:40:19.484
out how to navigate and find that documentation

00:40:19.544 --> 00:40:23.532
and even how to make this fun for you, then you

00:40:23.572 --> 00:40:25.596
can do all sorts of interesting things with it.

00:40:26.167 --> 00:40:29.411
Okay, so self-documentation.

00:40:30.352 --> 00:40:31.974
I love telling people, okay, you can just press

00:40:32.014 --> 00:40:34.797
`C-h k` or `describe-key` to describe anything.

00:40:34.817 --> 00:40:36.839
You can `C-h f` any function.

00:40:37.300 --> 00:40:39.482
You can, you know, `C-h v` any variable.

00:40:39.502 --> 00:40:42.225
`describe-` whatever is great.

00:40:42.706 --> 00:40:45.829
Of course, adding `C-h` to the end of the

00:40:45.889 --> 00:40:47.711
keyboard shortcut that you've started but you've

00:40:47.751 --> 00:40:51.115
forgotten how to finish, especially if you've

00:40:51.155 --> 00:40:52.697
turned on `which-key` mode,

00:40:52.981 --> 00:40:56.267
is great for listing the actual shortcuts that

00:40:56.307 --> 00:40:57.469
start with that sequence.

00:40:59.232 --> 00:41:00.635
[Prot]: And even without `which-key`, it will

00:41:00.675 --> 00:41:03.600
put all those shortcuts in a Help buffer,

00:41:04.081 --> 00:41:06.806
and it will show the key and the name of the

00:41:06.866 --> 00:41:07.267
command.

00:41:09.230 --> 00:41:12.757
Of course, you can click on the command to

00:41:12.837 --> 00:41:13.538
read about it.

00:41:14.682 --> 00:41:16.866
[Sacha]: Someday I think it would be amazing

00:41:16.926 --> 00:41:23.276
if Emacs comes with a completion interface that's

00:41:23.336 --> 00:41:25.300
easy for people to understand and get started with,

00:41:25.700 --> 00:41:27.664
but in the meantime, if you don't already have

00:41:27.704 --> 00:41:30.568
completion set up, that is well worth taking the

00:41:30.609 --> 00:41:31.510
time to figure out.

00:41:32.671 --> 00:41:33.192
[Prot]: Yeah, yeah.

00:41:33.472 --> 00:41:37.299
The built-in one has improved tremendously.

00:41:37.739 --> 00:41:39.743
I mean minibuffer.el here

00:41:40.043 --> 00:41:43.769
has improved tremendously over the various recent

00:41:43.829 --> 00:41:44.330
versions.

00:41:45.111 --> 00:41:47.716
But you still need to be aware of all the user

00:41:47.776 --> 00:41:48.818
options to configure it.

00:41:49.479 --> 00:41:52.804
So to get, for example, a single column view

00:41:52.904 --> 00:41:55.168
instead of a grid with 100 options...

00:41:55.148 --> 00:41:59.277
That requires some effort.

00:41:59.297 --> 00:42:01.662
Out of the box, if you really want something

00:42:01.682 --> 00:42:04.268
that is built into Emacs and does completion in a

00:42:04.308 --> 00:42:06.834
way that is fairly easy to understand, it would

00:42:06.874 --> 00:42:10.762
be icomplete-vertical-mode or fido or

00:42:10.783 --> 00:42:11.925
fido-vertical-mode.

NOTE Calling functions by name

00:42:12.277 --> 00:42:18.643
[Sacha]: Another thing that Emacs does

00:42:18.703 --> 00:42:21.526
differently that might be good for people to

00:42:21.586 --> 00:42:25.110
learn about is that in Emacs, it is totally okay

00:42:25.170 --> 00:42:27.592
to not remember the keyboard shortcuts for

00:42:27.672 --> 00:42:30.355
everything or not use the menus for everything,

00:42:30.375 --> 00:42:31.876
because not everything will fit in the menus

00:42:32.017 --> 00:42:32.257
either.

00:42:32.817 --> 00:42:35.840
If you kind of remember the name of the function,

00:42:35.900 --> 00:42:39.284
you can use M-x and possibly completion to go

00:42:39.444 --> 00:42:40.545
run that function,

00:42:40.880 --> 00:42:44.627
which is helpful because sometimes knowing the

00:42:44.688 --> 00:42:48.034
words to call a function is a lot easier to

00:42:48.074 --> 00:42:50.218
remember than remembering the shortcut for it.

00:42:51.361 --> 00:42:51.782
[Prot]: Exactly.

00:42:51.802 --> 00:42:52.944
And I would say completion...

NOTE Completion

00:42:52.964 --> 00:42:55.369
If you have to configure one part of Emacs,

00:42:55.389 --> 00:42:56.070
it's completion.

00:42:56.573 --> 00:42:59.980
If you improve that part of it, it will help you

00:43:00.140 --> 00:43:00.601
everywhere.

00:43:00.701 --> 00:43:02.966
Like we were saying earlier about bookmarks, it

00:43:03.026 --> 00:43:03.667
helps you there.

00:43:03.988 --> 00:43:05.471
The kill-ring, it helps you there.

00:43:05.751 --> 00:43:07.194
Finding files, it helps you there.

00:43:07.234 --> 00:43:09.058
Switching to buffers and so on.

00:43:09.078 --> 00:43:10.621
Like what we are now talking about.

00:43:10.741 --> 00:43:11.663
It's always useful.

00:43:12.976 --> 00:43:15.560
[Sacha]: When you set up a completion, also

00:43:15.620 --> 00:43:18.183
learn how your favorite completion system lets

00:43:18.243 --> 00:43:20.667
you put in things that look like they should

00:43:20.747 --> 00:43:24.151
match something on the list, but you actually

00:43:24.232 --> 00:43:26.815
want just the partial part or just the blank part.

00:43:27.616 --> 00:43:30.602
For example, in some systems, you press

00:43:30.603 --> 00:43:35.046
`M-RET` or `M-p` to send what you already have

00:43:35.107 --> 00:43:37.029
there instead of selecting one of the completion

00:43:37.129 --> 00:43:37.650
options.

00:43:38.002 --> 00:43:39.885
This is helpful because sometimes you'll want

00:43:39.925 --> 00:43:43.010
to name a file something that is a substring of

00:43:43.071 --> 00:43:45.074
another file and you want to be able to say,

00:43:45.114 --> 00:43:46.977
yeah, that is actually what I meant, not the

00:43:47.498 --> 00:43:49.401
completion part.

00:43:49.421 --> 00:43:49.782
[Prot]: Yeah, yeah.

00:43:49.802 --> 00:43:52.867
I think that's the only rough edge with most of

00:43:52.927 --> 00:43:53.448
those, yeah.

00:43:54.109 --> 00:43:56.573
Where you have to be mindful of that or, you

00:43:56.613 --> 00:43:59.438
know, I have to select the prompt or I have to

00:43:59.558 --> 00:44:02.944
type a special key for this edge case.

00:44:02.964 --> 00:44:03.064
Yeah.

00:44:03.263 --> 00:44:05.266
[Sacha]: Once you get that sorted out and

00:44:05.366 --> 00:44:09.271
you've drilled it into your fingers, it's very,

00:44:09.311 --> 00:44:12.575
very helpful to have completion sorted out.

NOTE Manuals

00:44:13.236 --> 00:44:15.139
Emacs also comes with extensive manuals.

00:44:15.259 --> 00:44:17.221
You like to write very thorough manuals for your

00:44:17.261 --> 00:44:18.803
packages, which I also appreciate.

00:44:19.745 --> 00:44:22.829
Flipping through manuals for fun is something

00:44:22.869 --> 00:44:26.233
that we've discussed in previous...

00:44:26.416 --> 00:44:29.003
This is such a great practice.

00:44:29.023 --> 00:44:30.166
You learn something new every day.

00:44:30.187 --> 00:44:34.138
I was going through the Emacs manual in

00:44:34.178 --> 00:44:37.166
preparation for this conversation and I was just

00:44:37.347 --> 00:44:39.312
highlighting things that I need to dig into.

00:44:41.232 --> 00:44:44.218
[Prot]: It's very useful and again to point

00:44:44.318 --> 00:44:45.059
out completion.

00:44:45.400 --> 00:44:48.866
`C-h R` is how you can search for the

00:44:48.946 --> 00:44:50.529
manual of a package.

00:44:50.549 --> 00:44:52.112
Like for example, I'm interested in Org.

00:44:52.172 --> 00:44:54.557
`C-h R`, Org.

00:44:54.958 --> 00:44:56.681
I find Org from anywhere, right?

00:44:57.502 --> 00:45:00.488
`C-h R` and then I will search for

00:45:00.548 --> 00:45:01.330
something else, right?

00:45:01.470 --> 00:45:03.373
Elisp, for example, to go to the Emacs Lisp

00:45:03.393 --> 00:45:04.776
reference manual.

00:45:04.857 --> 00:45:05.838
Again, very useful.

00:45:05.938 --> 00:45:09.122
From inside the manuals, `g` to go to a

00:45:09.202 --> 00:45:12.966
chapter, also known as a node, `i` to go to a

00:45:13.066 --> 00:45:18.412
topic, an index, and `m` if you want, but `g` and `i`.

00:45:18.552 --> 00:45:21.576
Just think of `g` and `i`. Very, very useful.

00:45:21.716 --> 00:45:24.499
`m` is also useful to navigate the menu of the

00:45:24.559 --> 00:45:25.640
current node.

00:45:26.121 --> 00:45:28.283
[Sacha]: I use `s` also for search.

00:45:28.448 --> 00:45:29.529
[Prot]: And there's for research

00:45:29.570 --> 00:45:30.250
throughout, yes.

00:45:30.431 --> 00:45:30.711
[Sacha]: Yes.

00:45:31.252 --> 00:45:33.595
I have not been using `C-h R`.

00:45:33.615 --> 00:45:36.319
I have been using `C-h i` to look at the whole

00:45:36.359 --> 00:45:40.404
list of info manuals and then using `m` or isearch

00:45:40.484 --> 00:45:41.546
like a newbie.

00:45:42.827 --> 00:45:43.468
[Prot]: That works.

00:45:43.508 --> 00:45:45.551
The problem with that is that if you have already

00:45:45.611 --> 00:45:46.913
gone into a manual,

00:45:47.365 --> 00:45:49.969
`C-h i` will take you back to that manual.

00:45:49.989 --> 00:45:51.952
So you have to click it and then start again.

00:45:52.412 --> 00:45:52.673
[Sacha]: Okay.

00:45:53.013 --> 00:45:53.594
Alright.

00:45:53.654 --> 00:45:55.036
Well, I'm learning new things.

00:45:56.639 --> 00:45:56.959
[Prot]: Nice.

NOTE Menus

00:45:57.420 --> 00:45:58.842
[Sacha]: Okay, you mentioned you are not a

00:45:58.862 --> 00:46:01.746
fan of... you don't use the menus and I know a

00:46:01.766 --> 00:46:01.900
lot of people...

00:46:01.901 --> 00:46:04.009
[Prot]: But I appreciate that.

00:46:04.029 --> 00:46:06.052
And in one of my... oh, in a couple

00:46:06.072 --> 00:46:08.496
of my packages I have menu entry.

00:46:08.628 --> 00:46:10.331
[Sacha]: Yeah, and I know a lot of people

00:46:10.371 --> 00:46:13.456
turn the menu bar off in their

00:46:13.496 --> 00:46:15.820
"this is how you configure Emacs" sort

00:46:15.861 --> 00:46:16.542
of tutorials.

00:46:17.123 --> 00:46:19.627
But if you are new to Emacs, and even if

00:46:19.647 --> 00:46:21.250
you're an intermediate user, I strongly

00:46:21.290 --> 00:46:24.576
recommend, sacrificing that tiny sliver

00:46:24.876 --> 00:46:27.581
of vertical space for the menu bar,

00:46:27.661 --> 00:46:29.404
because it's a great way to discover

00:46:29.384 --> 00:46:31.867
commands that are related to your

00:46:31.868 --> 00:46:35.533
particular major mode or other things.

00:46:35.534 --> 00:46:38.954
It's just fun to go through it and see what's

00:46:39.014 --> 00:46:41.056
been deemed worthy of including in one of those

00:46:41.136 --> 00:46:41.557
menus.

00:46:45.161 --> 00:46:48.244
There are some efforts now to get the right-click

00:46:48.784 --> 00:46:51.487
mouse menus to also have lots of interesting

00:46:51.607 --> 00:46:54.230
options, but definitely the menu bar at the top,

00:46:54.911 --> 00:46:57.574
which can also be accessed if you use F10 if you

00:46:57.614 --> 00:46:58.935
don't want to use the mouse.

00:46:59.000 --> 00:47:01.285
The menu bar is even working on terminal,

00:47:01.305 --> 00:47:01.826
which is nice.

00:47:02.227 --> 00:47:04.412
So yes, menu bar at the top has a lot of useful

00:47:04.452 --> 00:47:07.499
suggestions for discovering things.

00:47:07.519 --> 00:47:08.602
[Prot]: Yes, yes, excellent.

00:47:09.725 --> 00:47:11.829
The part you mentioned about key navigation,

00:47:11.849 --> 00:47:12.551
that's also good.

00:47:12.571 --> 00:47:14.936
You may be like, don't want to use

00:47:14.957 --> 00:47:15.398
the mouse.

00:47:15.658 --> 00:47:16.199
There you have it.

00:47:16.239 --> 00:47:16.941
You don't have...

00:47:17.545 --> 00:47:19.908
[Sacha]: And speaking of key navigation, if

00:47:19.948 --> 00:47:22.592
you press `C-h k`, which is `describe-key`, it

00:47:22.632 --> 00:47:24.975
will work on menu items as well.

00:47:24.995 --> 00:47:27.057
If you're finding yourself always going to the

00:47:27.137 --> 00:47:30.882
menu to do this thing, sometimes the menu items

00:47:30.942 --> 00:47:33.065
are not named the same as their commands, but you

00:47:33.085 --> 00:47:35.408
can use `C-h k` to find out what that function

00:47:35.528 --> 00:47:37.831
is and what keyboard shortcuts it's bound to.

00:47:37.992 --> 00:47:40.495
Then you can call it with M-x directly, or

00:47:40.535 --> 00:47:42.237
you can memorize the keyboard shortcuts.

NOTE Automation - abbreviations

00:47:46.418 --> 00:47:48.724
Okay, shall we move on to automation,

00:47:49.225 --> 00:47:53.515
for which Emacs has a ton of built-in things?

00:47:53.595 --> 00:47:59.489
Using abbreviations and things like that is

00:47:59.529 --> 00:48:01.113
actually something I picked up from reading your

00:48:01.153 --> 00:48:04.461
config, I think, because you use abbreviations a lot.

00:48:05.437 --> 00:48:07.620
[Prot]: Yeah. Very nice. Very useful.

00:48:07.740 --> 00:48:09.962
Even for basic things.

00:48:09.982 --> 00:48:12.645
For example, I want to write, you know, my

00:48:12.725 --> 00:48:15.849
fancy French expressions, like, this is so

00:48:15.889 --> 00:48:16.950
déjà vu, you know?

00:48:17.611 --> 00:48:19.393
I want to have the accents correct.

00:48:19.633 --> 00:48:22.917
I just write `deja vu` with English, and then I

00:48:22.977 --> 00:48:24.999
have the French equivalent with all the fancy

00:48:25.120 --> 00:48:26.261
accents.

00:48:26.281 --> 00:48:28.103
Stuff like that you can do, like...

00:48:28.302 --> 00:48:31.286
something you keep misspelling the whole time you

00:48:31.346 --> 00:48:34.350
actually do it, right, something that is with an

00:48:34.410 --> 00:48:38.456
annoying spelling, like annoying capitalization

00:48:38.496 --> 00:48:41.820
like LaTeX. Nobody knows how that is written. You

00:48:41.841 --> 00:48:44.624
just write it latex, all lowercase, and then expand

00:48:44.664 --> 00:48:47.008
to whatever it should expand. This sort of thing

00:48:47.068 --> 00:48:49.731
is very useful. Of course, you can just have

00:48:49.791 --> 00:48:52.795
some short text which expands into very long

00:48:52.856 --> 00:48:53.196
text.

00:48:53.547 --> 00:48:55.170
[Sacha]: We should also point out if you

00:48:56.312 --> 00:48:59.358
type something that is normally an abbreviation

00:48:59.479 --> 00:49:02.585
like LaTeX, but in this case you actually want to

00:49:02.625 --> 00:49:09.238
write the word latex, then how do you do the

00:49:09.298 --> 00:49:11.783
abbreviation without it being expanded into

00:49:12.364 --> 00:49:13.446
whatever that is?

00:49:13.426 --> 00:49:14.968
[Prot]: Of course you would rather avoid

00:49:15.048 --> 00:49:18.373
that situation with your abbreviation. It wouldn't

00:49:18.393 --> 00:49:20.616
be like that, but otherwise you will have to undo.

00:49:20.997 --> 00:49:25.663
When you do SPC and it expands, you undo.

00:49:25.723 --> 00:49:29.148
That is a little bit annoying, for sure. But I

00:49:29.188 --> 00:49:31.752
would say, just make sure to have abbreviations

00:49:31.792 --> 00:49:34.776
that are not ordinary words.

00:49:35.144 --> 00:49:38.150
They are a little bit contrived, so you don't get

00:49:38.210 --> 00:49:40.154
false positives.

00:49:40.775 --> 00:49:43.321
A good use case here, like what I have in my

00:49:43.361 --> 00:49:45.325
configuration, like you can have your

00:49:45.385 --> 00:49:49.072
abbreviations behind a

00:49:49.112 --> 00:49:51.016
character such as the semicolon.

00:49:52.840 --> 00:49:54.543
Then of course it's very unlikely that you will

00:49:54.603 --> 00:49:56.427
have semicolon later.

NOTE Quoting the next character with C-q

00:49:56.812 --> 00:49:58.855
[Sacha]: The other thing that you could

00:49:58.895 --> 00:50:02.139
potentially do is use `C-q` to quote the next

00:50:02.219 --> 00:50:03.902
character literally.

00:50:03.922 --> 00:50:07.206
So here for example, I have `ot` expand to the

00:50:07.246 --> 00:50:13.174
current time, but if I say `ot` `C-q` SPC, this helps.

00:50:13.254 --> 00:50:17.540
And in general, this idea of `C-q` to quote

00:50:17.580 --> 00:50:20.103
the next character is also useful in other places

00:50:20.164 --> 00:50:22.327
where you might, for example, need to add a

00:50:22.507 --> 00:50:25.671
literal new line to a search or something like that,

00:50:25.651 --> 00:50:30.261
or a literal tab.

NOTE Mapping abbreviations to code

00:50:31.372 --> 00:50:33.814
The other thing that I want to add to

00:50:33.955 --> 00:50:37.678
abbreviations here is your abbreviations are not

00:50:37.758 --> 00:50:38.899
limited to just text.

00:50:38.979 --> 00:50:42.102
You can use them to run things, which means you

00:50:42.143 --> 00:50:45.005
can use them to run things that expand to text,

00:50:45.025 --> 00:50:47.027
or I think you might even get away with using

00:50:47.067 --> 00:50:49.370
them to run commands.

00:50:49.590 --> 00:50:52.893
So it's pretty limitless.

00:50:53.614 --> 00:50:53.994
[Prot]: Yeah, yeah.

00:50:54.034 --> 00:50:57.077
Of course, it's how determined you are to write

00:50:57.137 --> 00:50:58.298
custom code for that.

00:50:59.148 --> 00:51:02.652
[Sacha]: Or how resourceful you are in

00:51:02.732 --> 00:51:04.674
finding other people's custom code that you can

00:51:04.754 --> 00:51:05.735
copy, at least.

00:51:07.397 --> 00:51:09.059
Good motivation to learn Emacs Lisp.

00:51:10.220 --> 00:51:12.743
I do not remember if Yasnippet is built-in.

00:51:12.843 --> 00:51:13.904
It feels like it's built-in.

00:51:15.126 --> 00:51:17.929
[Prot]: No, but it's one of those that

00:51:18.429 --> 00:51:19.971
basically everybody uses.

00:51:19.991 --> 00:51:23.755
Yasnippet or Tempel.

00:51:24.173 --> 00:51:28.539
[Sacha]: A couple of questions from chat.

00:51:28.579 --> 00:51:30.461
When highlighting parts of the manual, how are

00:51:30.501 --> 00:51:31.202
you doing this?

00:51:31.622 --> 00:51:34.446
In bookmarks, bookmark-region, using Org Remark,

00:51:34.586 --> 00:51:35.167
other ways?

00:51:35.948 --> 00:51:40.354
I was doing this at the playground the other day,

00:51:40.774 --> 00:51:43.998
so I just had it in my iPad and I had it in one

00:51:44.038 --> 00:51:45.760
of those graphical note-taking things and I was

00:51:45.800 --> 00:51:47.042
highlighting with the Pencil.

00:51:47.022 --> 00:51:49.566
But I've heard good things about Org Remark,

00:51:49.587 --> 00:51:51.089
which is a package.

NOTE Taking notes with org-capture

00:51:51.249 --> 00:51:53.313
You can also use just `org-capture` if you're

00:51:53.353 --> 00:51:55.297
reading the manuals from within Emacs, which you

00:51:55.337 --> 00:51:55.657
can.

00:51:56.118 --> 00:51:59.484
If you `org-capture`, you can even select sections

00:51:59.564 --> 00:52:01.888
of the manual and it'll automatically save that

00:52:02.008 --> 00:52:04.573
in the capture template along with a link back to

00:52:04.633 --> 00:52:05.995
where you were looking.

00:52:06.416 --> 00:52:07.478
This is great.

NOTE Navigating back to captures or refiles

00:52:08.504 --> 00:52:10.150
[Prot]: Since you mentioned `org-capture`

00:52:10.271 --> 00:52:12.740
and we talked about bookmarks earlier, when you

00:52:12.800 --> 00:52:16.334
do `org-capture` or `org-refile`, it stores a

00:52:16.374 --> 00:52:16.876
bookmark.

00:52:17.056 --> 00:52:19.365
You can go back to the last capture, the last

00:52:19.446 --> 00:52:19.847
refile.

00:52:20.418 --> 00:52:22.421
[Sacha]: Yeah, yeah, which is handy.

00:52:22.441 --> 00:52:26.306
Also, you can use `org-refile` to navigate your Org files.

00:52:26.326 --> 00:52:28.989
In addition to using it to jump to the last

00:52:29.049 --> 00:52:30.551
thing that you filed because you were like, "Oh,

00:52:30.571 --> 00:52:31.512
yeah, wait, I forgot.

00:52:31.833 --> 00:52:33.675
I want to add more to that note,"

00:52:33.695 --> 00:52:36.219
you can also use it to jump to any of your

00:52:36.359 --> 00:52:38.401
projects, for example, or any of your notes,

00:52:38.862 --> 00:52:41.065
assuming you've set up your `org-refile-targets`

00:52:41.165 --> 00:52:41.886
appropriately.

00:52:43.064 --> 00:52:45.046
Okay, @RandCode has question.

00:52:45.307 --> 00:52:48.431
Does Emacs have a grammar checker like Harper's LSP?

00:52:48.771 --> 00:52:51.214
I know there are packages that people can use to

00:52:51.475 --> 00:52:54.018
work with Harper and other things.

00:52:54.839 --> 00:52:56.961
Do you know of any other built-in things?

00:52:57.242 --> 00:52:58.964
[Prot]: Built-in, it's flyspell, but

00:52:59.004 --> 00:52:59.845
that's not grammar.

00:52:59.885 --> 00:53:00.806
That's spelling.

00:53:01.607 --> 00:53:02.568
[Sacha]: Okay, all right.

00:53:02.608 --> 00:53:03.630
[Prot]: I cannot think of something.

00:53:03.650 --> 00:53:05.172
No, I don't think there is for grammar.

00:53:05.632 --> 00:53:08.876
So Harper or anything like that would plug into

00:53:08.916 --> 00:53:09.477
Flymake.

00:53:09.946 --> 00:53:16.023
[Sacha]: @greggr0th has a question.

00:53:16.063 --> 00:53:22.200
What are your favorite completion plugins?

00:53:22.366 --> 00:53:24.548
[Prot]: Yeah, I think it's really vertico.

00:53:24.628 --> 00:53:27.492
I prefer it over the built-in options, over

00:53:27.512 --> 00:53:29.594
icomplete.

00:53:29.774 --> 00:53:33.038
So it's vertico, and then with that, I would

00:53:33.118 --> 00:53:35.460
say, at minimum, orderless.

00:53:36.141 --> 00:53:37.823
So vertico and orderless, at minimum.

00:53:37.863 --> 00:53:39.665
But then, of course, if you want a little bit

00:53:39.725 --> 00:53:43.589
more, which is very useful, Marginalia, Consult,

00:53:43.609 --> 00:53:46.773
Embark, maybe I'm forgetting something, save-hist,

00:53:46.793 --> 00:53:47.353
it's built-in.

00:53:47.513 --> 00:53:49.015
But yeah, those, those for sure.

NOTE dabbrev

00:53:49.383 --> 00:53:52.270
[Sacha]: @hmelman says dabbrev for dynamic

00:53:52.310 --> 00:53:53.834
abbreviations is underrated.

00:53:54.135 --> 00:53:55.378
You don't need to predefine them.

00:53:55.398 --> 00:53:57.623
You just type the start of a word or symbol and

00:53:57.683 --> 00:54:00.670
type `M-/`, and it will search the buffer for

00:54:00.791 --> 00:54:03.878
something starting with what's on the left side

00:54:03.938 --> 00:54:05.923
of your point and then expand it.

00:54:05.903 --> 00:54:08.626
I can't remember if it's dabbrev or hippie-expand,

00:54:08.647 --> 00:54:10.849
but you can also set it up so that it can try

00:54:10.929 --> 00:54:13.913
words from other buffers or other things that

00:54:13.953 --> 00:54:16.376
you've got or contacts or whatever.

00:54:16.477 --> 00:54:18.439
Anyway, so dynamic abbreviations.

00:54:18.559 --> 00:54:21.944
If you search for dabbrev and if you look also for

00:54:21.984 --> 00:54:25.188
hippie-expand, you will find lots of things that

00:54:25.228 --> 00:54:28.772
you can configure to fit your particular workflow.

00:54:29.133 --> 00:54:31.716
So you can expand abbreviations without having to

00:54:31.776 --> 00:54:32.417
define them.

00:54:33.258 --> 00:54:33.900
[Prot]: Yeah, yeah, yeah.

00:54:33.940 --> 00:54:34.882
Super powerful.

00:54:34.902 --> 00:54:35.604
Super useful.

00:54:35.704 --> 00:54:38.912
I use it more than tab completion, you know, like

00:54:38.932 --> 00:54:40.496
with core.

00:54:40.516 --> 00:54:41.920
I use dabbrev more.

00:54:42.301 --> 00:54:44.185
It's very nice.

00:54:44.366 --> 00:54:44.466
Yeah.

NOTE Keyboard macros

00:54:44.699 --> 00:54:47.362
[Sacha]: Okay, so we've mentioned keyboard

00:54:47.422 --> 00:54:51.006
macros very briefly, but this is another very

00:54:51.086 --> 00:54:55.010
powerful chunk of things that people might not be

00:54:55.170 --> 00:54:57.632
used to if they're coming from an editor that is

00:54:57.692 --> 00:54:58.413
not Emacs.

00:54:59.014 --> 00:55:02.598
So keyboard macros, what's kind of like the thing

00:55:02.618 --> 00:55:04.359
that we can use to explain?

00:55:04.379 --> 00:55:06.141
How do we explain it to people who are new to

00:55:06.181 --> 00:55:06.402
this?

00:55:07.723 --> 00:55:10.045
[Prot]: In its simplest form, you record

00:55:10.306 --> 00:55:12.508
what you type and you can play it back in its

00:55:12.548 --> 00:55:13.609
simplest form.

00:55:13.859 --> 00:55:16.321
But the thing with Emacs is that you don't just

00:55:16.381 --> 00:55:19.624
record typing motions, typing actions.

00:55:19.644 --> 00:55:22.246
You also record all the Emacs motions.

00:55:22.566 --> 00:55:24.608
You can have a keyboard macro that includes

00:55:24.668 --> 00:55:28.631
stuff such as move to another window or create a

00:55:28.712 --> 00:55:30.013
new split or whatever.

00:55:30.053 --> 00:55:32.635
You can do more advanced things like that.

00:55:33.355 --> 00:55:37.619
This has very nice qualities to it where it's

00:55:37.659 --> 00:55:40.001
like, oh, I just want to copy all these symbols

00:55:40.061 --> 00:55:42.423
and move them to my shell buffer and then I will

00:55:42.463 --> 00:55:43.444
do something with them,

00:55:43.897 --> 00:55:46.033
pipe it to something like a program

00:55:46.034 --> 00:55:47.800
outside of Emacs. So it has

00:55:47.801 --> 00:55:50.000
a lot of nice applications like that.

00:55:51.187 --> 00:55:55.853
[Sacha]: I think that if people can get the

00:55:55.913 --> 00:55:58.216
hang of: very carefully set up their

00:55:58.256 --> 00:56:01.220
keyboard macro, think what's a series of

00:56:01.280 --> 00:56:04.845
steps that I can do so that I can do the change

00:56:04.945 --> 00:56:07.428
and then move my cursor to the start of where the

00:56:07.488 --> 00:56:08.510
next change should be...

00:56:09.110 --> 00:56:12.074
For example, I'll start the keyboard

00:56:12.114 --> 00:56:14.818
macro, I'll delete the word, I'll type in

00:56:14.898 --> 00:56:18.763
something new, or maybe I'll paste in a register

00:56:18.743 --> 00:56:21.461
I'll use isearch to find the next point at which

00:56:21.521 --> 00:56:22.729
I need to do something.

00:56:23.047 --> 00:56:25.930
If you define your keyboard macros like this,

00:56:25.950 --> 00:56:27.712
then you're giving yourself the ability to

00:56:28.212 --> 00:56:30.434
interactively confirm whether you're still on the

00:56:30.474 --> 00:56:34.258
right track and then make the change because that

00:56:34.358 --> 00:56:36.861
way, it's not just like a search and

00:56:36.881 --> 00:56:38.522
replace and you're hoping it all works out.

00:56:38.582 --> 00:56:40.264
Although the recent search and replaces are great

00:56:40.284 --> 00:56:42.026
because they show you the changes.

00:56:42.046 --> 00:56:43.727
But for something that's more complex, especially

00:56:43.747 --> 00:56:45.309
if you're not used to regular expressions,

00:56:45.669 --> 00:56:47.691
keyboard macros can help you

00:56:48.172 --> 00:56:50.674
interactively do it in small steps.

00:56:51.582 --> 00:56:52.786
[Prot]: Yeah, exactly.

00:56:52.806 --> 00:56:55.435
Of course, search and replace will be more

00:56:55.555 --> 00:56:58.745
tricky if you have to go through many files and

00:56:58.786 --> 00:57:00.732
perform multiple edits in each,

00:57:01.575 --> 00:57:04.063
because then the concept of regular expressions

00:57:04.143 --> 00:57:04.765
breaks down.

00:57:05.521 --> 00:57:08.206
You don't want to think in those terms where it's

00:57:08.266 --> 00:57:10.030
like, I will have to make a change somewhere

00:57:10.070 --> 00:57:12.053
towards the top and then somewhere in the middle

00:57:12.133 --> 00:57:14.518
and then somewhere towards the end. Keyboard

00:57:14.558 --> 00:57:17.464
macros combined with Dired combined with going to

00:57:17.504 --> 00:57:18.726
file... Very nice.

00:57:19.527 --> 00:57:22.052
Just to say another thing about keyboard macros

00:57:22.072 --> 00:57:23.856
is... Let's say you have written your very nice

00:57:23.896 --> 00:57:26.521
keyboard macro. You're recording it, and somewhere

00:57:26.761 --> 00:57:28.845
towards the end, you make a small mistake.

00:57:29.973 --> 00:57:33.626
Keep going and then `C-x C-k C-e` to

00:57:33.687 --> 00:57:34.570
edit your macro.

00:57:35.051 --> 00:57:38.243
It's a text buffer. You just remove what you

00:57:38.283 --> 00:57:38.785
don't want.

00:57:39.153 --> 00:57:40.975
[Sacha]: You can save these keyboard macros

00:57:41.055 --> 00:57:41.515
as well.

00:57:41.956 --> 00:57:45.499
You can use them in a future Emacs session or

00:57:45.539 --> 00:57:48.262
even turn them into your first Emacs Lisp

00:57:48.322 --> 00:57:48.842
function.

00:57:48.983 --> 00:57:51.565
You can give it a name and you can run it that way.

NOTE Editable grep and occur

00:57:52.706 --> 00:57:54.868
In the next three minutes before the kiddo runs

00:57:55.068 --> 00:57:57.711
out for lunch break, I also want to mention,

00:57:57.751 --> 00:57:59.633
since we talked about making changes in multiple

00:57:59.673 --> 00:58:04.077
files, that grep and occur are both editable.

00:58:04.097 --> 00:58:06.279
You can do your grep and you can search for

00:58:06.319 --> 00:58:07.000
things.

00:58:06.980 --> 00:58:11.067
And then you can say `C-x C-q` which turns it

00:58:11.068 --> 00:58:13.633
from read-only to something you can change,

00:58:13.634 --> 00:58:15.867
then you can do your search and replace in that,

00:58:15.868 --> 00:58:18.167
and you can `C-x C-q` again

00:58:18.168 --> 00:58:20.933
and those changes can get put back

00:58:20.934 --> 00:58:22.356
into all those different files.

00:58:23.332 --> 00:58:24.714
[Prot]: It's amazing.

00:58:25.115 --> 00:58:27.900
On this note, specifically for grep, if you

00:58:28.000 --> 00:58:30.945
edit many files with the grep edit mode that is

00:58:30.965 --> 00:58:34.210
built into Emacs 31, it will not save them for you.

00:58:34.230 --> 00:58:37.736
So `C-x s`, instead of `C-x C-s`,

00:58:37.977 --> 00:58:39.940
allows you to save multiple buffers.

00:58:40.223 --> 00:58:42.988
And every time, it gives you a prompt and you can

00:58:43.028 --> 00:58:45.533
type `d` to see the diff.

00:58:45.553 --> 00:58:47.416
Like, okay, what exactly did I change?

00:58:47.436 --> 00:58:50.602
If you have many unsaved files, `d` to see what

00:58:50.642 --> 00:58:53.507
you're about to save so you never make any

00:58:53.527 --> 00:58:53.828
mistakes.

00:58:54.280 --> 00:58:54.861
[Sacha]: Mm-hmm.

00:58:55.381 --> 00:58:59.586
Taking advantage of these diffing tools is

00:58:59.646 --> 00:59:00.327
great also.

00:59:02.310 --> 00:59:04.732
Even if you're new to Emacs or you don't have a

00:59:04.793 --> 00:59:06.775
programming background, if you find yourself

00:59:06.835 --> 00:59:08.637
making changes to lots of files, I strongly

00:59:08.697 --> 00:59:11.461
recommend learning more about version control

00:59:11.501 --> 00:59:14.144
systems like Git and then using something like

00:59:14.204 --> 00:59:16.086
Magit or even the built-in VC.

00:59:16.066 --> 00:59:19.756
If you use VC, you can use it and you have set up

00:59:19.896 --> 00:59:21.300
something like a git repository.

00:59:26.060 --> 00:59:26.354
You can use `C-x v =` to diff to see

00:59:26.374 --> 00:59:29.022
the changes between your file and the previous

00:59:29.463 --> 00:59:31.408
thing that you had saved.

00:59:31.388 --> 00:59:34.573
Which makes sense so that you can see, okay,

00:59:34.653 --> 00:59:35.414
these are the changes.

00:59:35.875 --> 00:59:38.118
Also it means that you can experiment with

00:59:38.178 --> 00:59:39.380
different changes.

00:59:39.400 --> 00:59:42.105
You can experiment with different ways of

00:59:42.185 --> 00:59:44.288
writing a paragraph or whatever, and you know

00:59:44.348 --> 00:59:46.591
that all of your previous versions are saved and

00:59:46.632 --> 00:59:49.195
you don't have "really, really final

00:59:49.276 --> 00:59:50.217
version two."

00:59:51.239 --> 00:59:54.584
You don't clutter your directory with a lot of

00:59:54.804 --> 00:59:56.046
copies of the same file.

00:59:57.612 --> 00:59:59.717
[Prot]: But even if you don't have any of

00:59:59.737 --> 01:00:03.064
the version control system set up, a very simple

01:00:03.125 --> 01:00:05.410
thing is `diff-buffer-with-file`.

01:00:05.971 --> 01:00:08.958
So you have a file you are working on and now you

01:00:08.998 --> 01:00:09.740
make some edits.

01:00:10.381 --> 01:00:13.107
The buffer, what is in memory, is different

01:00:13.147 --> 01:00:14.490
than what is on disk.

01:00:14.510 --> 01:00:16.515
You can compare the difference between the two.

01:00:18.284 --> 01:00:20.507
[Sacha]: Okay, I'm going to try to wrap up

01:00:20.547 --> 01:00:22.830
here because the kid is going to run and say hi

01:00:22.970 --> 01:00:23.431
very soon.

01:00:23.812 --> 01:00:25.554
Thank you so much for joining me.

01:00:25.674 --> 01:00:27.697
Of course, there's a lot more to talk about the

01:00:27.717 --> 01:00:30.040
Emacs built-ins, but I hope we've given a quick

01:00:30.260 --> 01:00:32.563
tour of some of the things that are definitely

01:00:32.604 --> 01:00:35.367
worth learning more about and the situations for

01:00:35.427 --> 01:00:37.090
which they are absurdly useful.

01:00:37.731 --> 01:00:39.954
Thanks to everyone in chat also for coming and

01:00:39.994 --> 01:00:40.594
hanging out.

01:00:40.695 --> 01:00:44.620
I will post the show notes eventually and get the

01:00:44.660 --> 01:00:45.461
transcripts sorted out.

01:00:45.541 --> 01:00:46.182
Thanks.

01:00:47.022 --> 01:00:47.625
[Prot]: You're welcome.

01:00:47.645 --> 01:00:48.248
You're welcome.

01:00:49.654 --> 01:00:50.156
Take care.

01:00:50.337 --> 01:00:53.371
Of course, good luck with everything.

01:00:54.577 --> 01:00:56.425
Didn't she show up here?

01:00:58.244 --> 01:01:00.047
[Sacha]: If she shows up, she will.

01:01:00.367 --> 01:01:01.028
It's inevitable.

NOTE Emacs Carnival June 2026: Underappreciated built-ins

01:01:01.709 --> 01:01:05.676
Also, if folks are interested, even if you've

01:01:05.716 --> 01:01:09.602
never blogged before, the Emacs carnival theme

01:01:09.722 --> 01:01:13.167
for June 2026 is "Underappreciated Emacs

01:01:13.207 --> 01:01:14.910
built-ins," which is why we had this conversation.

01:01:15.251 --> 01:01:16.973
Feel free to write about something and either

01:01:17.294 --> 01:01:18.014
send [Ross and] me a link,

01:01:18.015 --> 01:01:19.137
or you can even send me the post

01:01:19.197 --> 01:01:21.480
and I'll post it on my blog with your name on it

01:01:21.540 --> 01:01:23.724
and other things like that so you can share your

01:01:23.764 --> 01:01:25.787
appreciation for these built-ins.

01:01:25.936 --> 01:01:26.377
All right.

01:01:26.618 --> 01:01:28.103
Okay, I hear movement.

01:01:28.123 --> 01:01:28.625
I gotta go.

01:01:28.866 --> 01:01:29.207
All right.

01:01:29.267 --> 01:01:32.077
[Prot]: Take care, Sacha.

01:01:32.097 --> 01:01:32.819
Take care, folks.

01:01:32.859 --> 01:01:33.180
Goodbye.
