I recently switched back to Doom Emacs and I'm in the early stages of configuring it. In this video, I configure variable font sized Org headers, set eshell as the initial buffer when I launch emacs, and convert my config.el over to a literate config.org.
Your support is very much appreciated. Thanks, guys!
So, I recently switched back over to
using Doom EMAs, which I really like
Doom EMAX. I got a basic installation
and configuration up and running, but
I've done very minor tweaks to it thus
far. Today, I wanted to customize it a
little more. There's a few things in the
Doom Emac configuration that I'd like to
change a little bit. So, let's jump into
it. So, let me go ahead and launch Doom
Emac. And the very first thing I want to
do is I want to play around a little bit
with the configuration file. So, we do
have a key binding space FP. Space FP
for find private config files. And the
private config files they're talking
about are your Doom EMAC config files.
You've got three basic config files. You
got the init. You've got your packages.
And the most important one is the
config.el. And this is where you do a
lot of your personal customization
settings. Now, on that initial video I
did about Doomax, I didn't do much
configuration to the config. I only made
one change because the font was really
small for me. So, I went ahead and
changed the font. I switched the font
family over to Jet Brains Mono for the
font and I set the size to 15. But
there's some other things I want to do
with fonts here. For one thing, I do a
lot with org mode. Let me launch another
window and let me search for an org
document. For example, I've got this old
org document from a previous Doom EMAC
config that I used years ago. And you
can see uh the headers here, the org
headers, they don't have variable font
sizes. For readability, I like making
like top level headers in org documents
really big. Second level headers
slightly less big. Third levels headers
uh slightly less big. You guys have seen
that in all of my videos for years and
years. all my org documents, you've seen
those variable font sizes using org
mode. And what I've done is I've created
this block of code here. Right now, it
is commented out. It's not turned on
because I wanted to you to see the
before and the after. So, let me go
ahead and uncomment these lines here
that I've got commented out. Now, there
is a program in Emacs called comment-
line. If you do meta x and type comment
dash line, here is a program. It has a
default key binding which is controll X
followed by control semicolon. I hate
those control kind of EMAC key chords.
I'm going to set that to something more
doom ccentric. And Doom of course uses
space as the leader key. So I'm going to
create a key binding for the comment
line function that uses the space leader
key rather than control. So let me
scroll down a little bit and I've got
these two lines here that are commented
out. Let me go ahead and uncomment these
lines. And this is an example of how to
set a keybinding in Doom EMAC. You use
this function here, map exclamation, and
then you give it a key binding. You give
it the description of the key binding,
and then you give it the actual Emacs
function, the Emacs program to run. So
in this case, the keybinding is going to
involve leader. The leader key in DoomX
is space. And then the other key
involved is going to be the minus
symbol. Now, why did I choose space
minus for this? Well, if I hit space on
the keyboard, the witch key program
comes up. Which key is a EMAC program
that tells you the possible key
bindings. So, any key I hit on the
keyboard, it tells me the next possible
keys and what they would do. So, if I
hit space, here are all of the other key
bindings that I could do with the space
key that I've already hit the one time.
And I notice they're using most
everything on the keyboard. pretty much
every key on the keyboard except they
weren't using the minus symbol. So
that's why I chose space minus for this
is because it wasn't in use. So space
which is leader minus is going to run
this function here, the comment line
function. And then I give it a
description and the description is
comment line. Uh the description would
be what shows up when you do which key.
So, I've already got this commented out
and I think I've already reloaded the
config before. So, it's already
available to me. But just to make sure,
space HRR reloads Doom Emacs. But if I
hit the space key, you will see I
actually do have the minus symbol here
now. And it says comment line. That was
the description I gave it. And if I hit
the minus symbol, it's going to run the
comment line program, which just
commented out that one line, the line I
was on, which obviously I didn't want to
do. If I really wanted to comment this
out, I'd need to do the whole block of
code here. So, I'd get into visual block
mode here or visual line mode here in a
evil mode in in Vim mode essentially.
And I would highlight the entire block
of code I want to comment. And now all I
have to do is space minus and I just
commented that out. U to undo. Now, if
they were already commented out and I
wanted to uncomment them. So, let me
control R to redo. That's a standard BIM
key binding. Let me once again get into
visual line mode. I like the lines that
I want to uncomment. Space minus, right?
And so the comment line function, it
comments out lines that aren't commented
and it uncomments lines that are
commented. So it's a really handy
function. I would suggest anybody using
Emacs have that as a a easy keybinding
for you, especially if you do any kind
of scripting and programming because
you're going to be commenting and
uncommenting lines constantly if you're
a scriptor or programmer. So, now that
I've got that done, let me go back up
here to the block of code that I was
wanting to uncomment for the variable
org header settings. So, let's go ahead
highlight the block of code. Space minus
to uncomment that. Let me go ahead and
write that space hrR to reload Doom
Emacs. And now let me check out an org
file. So let me go to any org document.
And now you can see I have variable font
uh sizes as far as the org headers. The
top level headers are really big. The
second level headers a little less big.
Thirdle headers if I have any in here
would be a little less big. Um I don't
have a lot of third level headers. It's
mostly just first and second level
headers in this document. But if I close
this out and get back into the config.
Zoom in here, you can see the settings
here. You have org level one, that's the
top level. Org level two, the second
level down. So you when you're doing
your outline and or mode, all the way
down to org level 8. And I set these to
various font sizes. For the top level, I
did 1.6. So basically, we're making it
60% bigger font for the top level
header. 50% bigger font for the second
level, 40% bigger font for the third
level, all the way down until, you know,
the seventh and eighth level headers,
which I almost will never get an outline
that's that far deep, but if I do, it's
just normal 1.0 font. So, it's basically
your standard font size. The other thing
I set here was this here, or document
title, and I set that to 1.8, 80%
bigger, a really big font. What is a org
document title? Well, let me go back
into the org document or just any org
document and go to the top. There is the
title. It's the title tag. And you can
see it makes the title of the document,
you know, a gigantic kind of font that
really stands out. And of course, you
could set it to bold or not. I set bold
to T. I set underline to Neil false so
it doesn't underline it. But if I wanted
it underlined, I could set that to T. So
those were the first things I really
wanted to do with the Doom Max
configuration. Get those org headers
right. Get a a key binding set for
commenting lines and uncommenting lines.
The next thing is some basic settings.
So in the default Doomaxconfig.el,
you have a line for setting the default
org directory. So the directory where
your org documents go. Typically this is
set to your home directory/org
with a lowercase o. In my case, I have
my org uh folder, my org directory set
to a nextcloud server. So I have a
folder on my system called NC for
nextcloud, which is a nextcloud server
that I used to file sync across all my
devices. And in that I have org with a
capital O, and that's what I want to set
my org directory to. Some other things I
want to set here is if I go down to this
line here and just do space minus. Let's
go ahead and unset this. And I'll go
ahead and uncomment this as well. So
they use a program in Doomax now called
modern table or org modern table. It
basically makes your org tables look a
little fancy. Now when I say Doomax is
using or modern table by default, it's
not turned on by default. Although if
you turn it on, these I believe are
default settings. To turn on the uh or
modern table, you might have to do the
uh the pretty addition to or So if you
go into your enit.ele, remember the
init.el file. This is where you turn on
and off some of the default Doom
modules. So these are modules that are
just part of Doomax. So you can just
comment outlines, uncomment outlines and
turn these on. Org mode, of course, is
one of the default modules and you could
turn it on and off as well. For example,
if you don't want to use org mode for
some reason, you could turn it off. I
don't know why you would be using Emacs
though and not want to use org mode. But
by default, you have org here and it's
uncommented. And if you want to turn on
the pretty mode, just add plus pretty
inside parenthesis to org in the init.
And I think I might have done that in
order to uh to get the org modern table
look. Now, these settings I think may be
default settings they're using. I just
put these in my config just to remind me
that they're using org modern table and
because I may or may not want to turn
off this program at some point. By
default, it's turned on. Set Q. By the
way, if you're unfamiliar with how EMAC
list works and you know configuring
EMAC, set Q is assigning a variable to a
value. So set Q, the variable is or
modern table. And what are we assigning
it as a value? It needs to be either T
or new. So true or false. If it's T,
then or modern table is turned on. And
what that is is you got the fancy tables
in your org documents. Let me scroll
down. You know, I got tables here. You
see, you got these wide bars. You got a
little bit of a gap, you know, in
between the u basically your separator
lines as well. You know, it looks a
little fancy. Now, one thing I didn't
like about the default Doomax config,
and this was not the case when I used it
years ago. Let me search for to-do.
Okay, here is a line that has the word
to-do in it. Uh, let me get out of that
search. You know, by default, you know,
in previous years, you had these to-do
keywords, these org to-do keywords. You
can see this variable here, and they
would be highlighted in a certain way,
and that is not the case uh out of the
box, I don't think, with Doom EMAX, the
default config now. But what I've done
is I've added this hook. So, I've added
hook, org mode hook. So, anytime you're
in an org document and or mode is turned
on, the hook, the major mode is um org
mode, right? The org mode hook. What I
want you to do is I want you to turn on
highlight to-do mode. Highlight to-do is
a Emacs program that highlights the word
to-do. For example, turning it orange in
this case. So, you know, now that I've
got all of these lines uncommented, let
me go ahead and space HRR to reload
Emacs. So, let me get into an Word
document.
You know, now I've got to-do. If I do
to-do here, you know, now I get some
fancy coloring. I I get actually a
yellow background. Uh, and this is
customizable. You could actually change
some of this, but this really stands
out, right? Where before if I had just
typed the word to-do, it would just be
the word to-do colored, you know, the
same as the rest of the font in this
header. But I wanted it to visually
stand out. So that is the highlight
to-do mode. The next thing I wanted to
change, let's scroll down here to some
other changes that I have made. One
thing I don't like about Doom EMAX out
of the box and GNU Emacs out of the box
is that anytime you decide to get out of
Emacs, kill a window, kill a frame, uh
it it asks you for confirmation. Hey, do
you really want to close Emacs or close
this window? And you know it gets
annoying because you're constantly
closing out of things and then having to
answer Y or N, yes or no, you know, to
kill EMAC. In this case, I want to set
this variable. So set Q confirm kill
EMAC. That's a variable, right? And that
needs to be set to T or nil, true or
false. In this case, I want it to be set
to nil. I do not want to be asked for
confirmation when I'm killing a EMAC
window. So let me go ahead and write
that space hrR to restart.
And actually, I think I'm just going to
kill Emacs all the way. So, let me open
a terminal. Let me kill all Emacs. Let
me restart the Emacs Damon.
So, we're just restarted the Emacs
server. So, now let me restart Emacs.
Uh, and now when I close it, it doesn't
ask me anything. Let me restart it
again. One thing I want to do though is
uh I don't like this dashboard. Uh, the
dashboard is cool if you're brand new to
Doom EMAC because it gives you some
basic key bindings. For me, I already
know the key bindings. I'm going to set
my own key bindings for a lot of this
stuff. This screen really doesn't do
much for me. I don't need it. So, I
could pick any starting buffer I want in
Emacs. I could have Emacs launch any
buffer as the initial buffer rather than
the dashboard. So, what would be
something appropriate? Well, it could be
I could set the initial buffer to be my
EMAC config if I know I'm going to play
in my EMAC config a lot every time I
open my EMAC config. But opening to a
specific file, not great uh for most
people, I would imagine. Uh opening deer
ed the file manager as the initial
buffer could be cool, you know, just
opening dear ed in my home directory for
example. And from here I could navigate
wherever. But I also, you know, most of
the time when I'm doing something in
Emacs, I'm either editing a file or I'm
going to do something in a terminal. So
I was thinking about setting my initial
buffer to the EShell, the EMAC EShell
because I think that makes sense for the
initial buffer here. So let me go ahead
and launch the EShell. You know, this is
ESL just a standard kind of shell except
this is not a shell like bash or fish.
This shell is actually written in Emacs
lisp and you can configure it using
Emacs list. You can create custom EMAC
functions that would run inside the
eShell. Kind of a neat little shell. So
let's go ahead and add this to my
config. So let me spacefr for find
recent file and let's go to my
config.el.
And the very last line here if I
uncomment it is another we're setting a
variable, right? uh set q initial buffer
choice is the variable and this could be
whatever you want that initial buffer to
be in this case I want the initial
buffer choice to be I want you to run
the eh shell program so that's what the
uh single quote and then eh shell you
know that's run that program and now
that I've done that if I space QR to
just you know quit out of Doom EMAC and
then restart it is what it's supposed to
do supposed to restart the Damon I don't
know it actually did restart the Damon I
don't think it did uh Uh let's go ahead.
I'll do it at the terminal. Kill all
Emacs. Then I will manually restart the
Damon. It looks like it has to install
some EShell stuff. Okay. And now when I
do my keybinding to launch Emacs, it
should launch us into the EShell. It did
not. Now why did it not launch me into
the ESHell as the initial uh buffer
choice? This because Doom has one of its
custom configs. So if I do space FP for
find the private files other than
config.el Eel probably the most
important config file for Doom Emacs is
the anit.el. So let's go into it. You
will remember this where you have all
these lines that you comment or
uncomment depending on whether you want
to turn off the default modules or not.
So for me, Doom dashboard right here.
No, we actually we're on that line. So
just comment out the Doom dashboard
program. And now let's write and quit.
And if I well let me go ahead and space
hrrrr to reload. And now if I kill that
window and restart Doom EMAC now my
initial buffer choice anytime I launch
Emacs will be the eShell. So I'm already
in the eShell if I want to do a shell
command which again most of the time and
I won't say most of the time but a good
percentage of the time I want a terminal
anyway. So this is good to have as an
initial buffer choice if you spend a lot
of time at the shell. Anyway, one final
thing I want to do is I do want to
convert my config.l over into an org
document because Emacs you can configure
using org rather than Emacs list as far
as you can do a literate config. So you
can write a org document with a table of
contents and you know tables of key
bodies you know it can be a proper it
can be the source code and it can be the
documentation uh for the source code all
in one document. It's really neat. So, I
want to convert my config.l over into a
config.org.
How do we do that? Well, let's space FP
for find private files. Let's go into a
nit.l. One of the modules should be
turning on literate config right here.
Config. Let's uncomment that. So, turn
on the literate config. Let's write
that. Space HR.
And now, it may complain. And yeah, it's
going to give an error because I don't
have a config.org yet. But that's fine.
What I'm going to do is I'm going to go
back into DoomX and let's create a
config.org. So, let me do a space period
for find file and let me navigate into
config /doom
slash and then there's no config.org.
Let's just create one. Let's config.org.
And here you go. And then what we need
to do is inside this document. The
easiest way to get started is do the
less than sign. So the uh the left
pointing chevron and then s for source
block and hit tab. And you get these two
uh tags, the beginning tag and the
ending tag for source. You need to tell
it what language you're writing in. So
let's do emac-l.
And now anything inside this source code
block will be interpreted as emacs list
code. And by default everything in a
config.org file will get written to
config.elel unless you specify it to
write it somewhere else. So now let me
open a second window and let's go to the
config.ele.
And all I really need to do is just take
all the code here. So, let me get into
visual line mode. And we're just going
to copy the entire document. And I'm
going to put it inside this block. And
now let's go ahead and write that. And
then let's go ahead write and quit. And
then going to open a terminal once
again. Kill all Emacs. Let's restart the
Damon and see if we get any errors.
Everything looks good. And now, you
know, we can configure Emacs now just
using our config.org file. and to clean
this up a little bit. I mean, there's a
lot of comments here for people that are
new to Doom Max. Uh, and maybe some of
these comments are appropriate to keep,
but for me, you know, I think I'm just
going to delete most of the comments.
I'll add comments back in on my own
later. But a large block of comments for
some stuff here, for example, this huge
block of comments. I'm just going to get
rid of all of that just to make it a
little easier. So, you can see we're not
dealing with much stuff here. So the
first thing I want to do, let's go ahead
and create a couple of different source
blocks. So let's go ahead and create
another Emacs list source block. And
let's have one specifically for Doom
stuff. So how about just Doom settings?
So stuff that is specific to your Doom
config. So that would include things.
For example, I think the Doom theme
makes sense for that header, right? So,
we'll have that and we could probably
add the font as well. So, I think these
make sense. You got your setting the
theme, setting the font, and then the
next source code block I think should be
org stuff, right? Just because I'm
already there. So, let's make this a
tople header and title it or this block
will have our org level headers, right?
And I think we should probably add all
of this org stuff. So all the uh setting
the org directory org modern table. So
let's move this up up here
and then let's go ahead and create
another source code blob emac lisp
and then everything that is not org
related I'm just going to go ahead and
put in this block. We'll get rid of
these comments as well. And for now I'm
just going to put the title other stuff
here. Right. So this is what an org
document looks like. You make an
outline. So you know only the stuff
inside the source code blocks gets
written to config.el. So your headers
they get ignored. They don't get written
to config.el. This is just for people
reading the document. You know people
can see this block has something to do
with org mode. This block has something
to do with Doom settings. This block has
something to do with the eh shell. this
block has something to do with key
bindings, whatever it happens to be. And
of course, this document is going to
become a rather lengthy document as I go
forward in the coming weeks and
configure it. So, we're going to need at
some point a proper table of contents.
Let's go ahead and create it now. Uh
even though this document is not very
lengthy yet. So, first thing you need to
do go to the top of the document, create
a top level header, call it table of
contents, and then give it this tag. So,
colon to Oc colon is a tag in Emacs. And
now Emacs knows this is supposed to be a
table of contents. Let's write that. And
when you write it, all of your top level
headers, they're here listed under the
table of contents. And this will
automatically get changed and you
repopulated as I add more headers along
the way. As I customize this, the table
of contents takes care of itself. And as
this becomes a gigantic file, it becomes
really easy to navigate the document
just going to the table of contents, for
example, and using your mouse and just
clicking on something like other stuff
and I'm immediately there. This was a
thousand lines long. You know, that
would be a quick way to get to the end
of the document. So, there you have it.
My current Doom EMAC config. Still in
the beginning stages of it. I'm going to
push that, by the way, over to my GitLab
for those of you that are following
along and want this rather basic config.
Now before I go, I need to thank a few
special people. I need to thank the
producers of the show. Matt Steve, 40
millimeter, Capcake Man, Darloff, Lee,
Jersey Killer, Mark, Methos, Uran Paul,
Peace, Arch of Door, Reality for Less,
Red Profit, Roland War, and Abuntu, and
Willie. These guys, they're my highest
tiered patrons over on Patreon without
these guys. This quick look at DoomX
would not have been possible. The show
is also brought to you by each and every
one of these fine ladies and gentlemen.
All these names you're seeing on the
screen right now, these are all my
supporters over on Patreon. Without
these guys, I couldn't do what I do. I
depend on you guys, the community, for
supporting the channel. If you like my
work and want to support what I do here,
subscribe to Dro Tube over on Patreon.
Peace, guys.