 Welcome back to another video in configuring Emacs. This is a series of videos I've been doing. This is going to be the seventh video in this series. For those of you that have not been following along, if you go to my GitLab over at gitlab.com slash dwt1, that's my GitLab, I have a repository there called configuring Emacs and in this repository I'm gonna have six. Well after this video I'll have seven folders that when you click on them you will get the configs as it existed at that point in the video series. So go over there and check that out after today's video to get the latest Emacs configs. And today's video is gonna be a little different because now that we've spent so much time configuring Emacs, we're really getting to the point of it's kind of there, right? Today's video is more of we're gonna wrap some things up, we're gonna put a bow on it, right? Because really there's not very much I really need to tweak at this point. I've kind of got it working the way at least I want it to work. So let me switch over to my desktop and let me go ahead and launch my Emacs here. And remember on the very first video I set up a key binding to open my config.org space fc for find the config.org. So and let me zoom in a little bit. Now this config file of course has become rather lengthy in the course of seven videos. I'm not gonna cover every single thing because most of this stuff I've covered in past videos. So today I'm gonna highlight some of the things I've added since that last video. So let me scroll down here because one of the things I changed I added this on the previous video but I had to make one small adjustment to it. So what I wanted to do is I wanted to make sure that all the automatic backups that Emacs creates because Emacs has this annoying feature where automatically creates backup files of everything you open in Emacs and they all end in the tilde character and you end up with all of these backup files all over your file system because it just puts them in whatever directory that file you're editing already lives in. And I wanted all the backup files any back any file that Emacs decides to backup I just wanted to send it to the trash. And before I was sending this to my home directory slash dot trash which was a directory that Emacs created for me and we just put them all in that and then I decided why not put it in the proper trash folder. So now I've set the location to be dot local slash share slash trash slash files which is the same directory that like your GUI file manager if you click on the trash can here in PC man FM you know if I scroll down see if I see any backed up files here yeah you see config.org because I open it all the time right and sometimes I edit it and you can see they end in the tilde character. So these were automatic files backup files that Emacs created and when it created them it automatically sent them to this trash folder that way my Emacs directory for example isn't cluttered up with that config dot org backup file. And if I keep scrolling down one other thing that I added was L feed. Now this is not something that everybody will probably want to add to Emacs but for me I kind of like having an RSS news feed reader here inside Emacs because it kind of makes sense when you read RSS news feeds for the most part it's text there are images part of some of these feeds but that's fine Emacs is also a GUI program so it can display images just fine it just makes sense to have Emacs as your RSS reader. So I have this block here where I use package L feed config and really the config part of it is just the links to the various RSS feeds and then I give it some descriptions these are tags that L feed can use that way you can search among your feeds based on tags that you've assigned the feeds. So let me show you L feed in action if I do a meta X and type L feed and you can see I actually already set a key binding for it space O E so let's use that space O for open E for L feed that that's how I thought of that particular key binding and you can see I've got this list of these various feeds for example if I want to read the Emacs subreddit you know I click on that particular post right I can read if I want to a J and K where I were using the evil motion keys but if I do control J I will actually move me down by story up and down and you can see I instead of the cursor being in the preview the cursors actually the list of the RSS feeds so that's kind of neat and let me find one with an image just to verify that the images do work so let me keep going down until I find here here's a news article that had an image in it so images work just fine those might have been reddit posts that had images here's one from LXR and to get out of this to get out of L feed Q to quit quits out of the split where we were previewing that story and Q again will actually just quit out of L feed all together and go back to the previous buffer which in my case is the config.org moving along in the config file I did make some changes here in the evil section of the config by scroll down this section right here is new I'd actually had a post over on my GitLab somebody recommended me this little bit of code so by default in org mode here with the evil key bindings when you go to a link for example one of these links here in the table of contents these four mode links you know I was having to click on it to go to it so if I clicked on all the icons for example that's how I would have to go to it because just simply hitting enter on the link did not work at least it did not work until I added this block of code here and the reason it didn't work is because of course evil mode it's kind of like the Vim mode you're in insert no mode normal mode and all of that the return key just doesn't work as expected when you're using evil mode so what you have to do is with a val afterload evil maps so you know the evil key maps I want you to redefine some of what these keys typically do so basically we're saying space turn it off return turn it off tab turn it off in evil mode and that way they act the way they would act not in evil mode you know like if you were using the standard emacs key bindings because if you were using the standard emacs key bindings return actually does follow org mode links so that's how we accomplish that that little bit of magic needed to happen so you know there's always these little quirks when you're using evil mode you know there are some things that are kind of unexpected that you do have to find workarounds for now let's talk about some of the new programs that I've added to the config so I've got this section right here get programs so for those of you that use get right so you're constantly pushing and pulling from your get lab or your github or whatever then you might find these programs kind of useful first I'm installing the get time machine so that's a program that allows you to move backwards and forwards through a false commits so the commit history and this is a really cool little program that you can add to emacs so let me show you get time machine in action so let me do a vertical split and let me navigate to an actual get repo on my system so let me go into my get lab repose folder where I've got a bunch of get lab repose obviously including the configuring emacs repo and of course to see commit history you actually need to be on a file so for example how about the read me dot org here so let me go ahead and open that up and then let me do meta x and get time machine which I have binded you can see I've minded it to space GT for space yet time machine so let's use that right space GT and you can see down here in the mini buffer adding link to read me so that was the last one if I do control K for up you know or going up through the history so previous commit you can see adding read me dot org was also the commit message for that adding video 3 to the read me adding video 2 and you can see the read me actually changes as I do that right so that's kind of cool right that's a just an amazing program to add to your emacs and another get program I added was maggot so I did a simple use package maggot maggot is the full feature get client for emacs now me personally I'm not a maggot user because some of my repositories are get bear repose that maggot doesn't handle that well but it's available for you if you want it because it's obviously it's in my config so if I do a vertical split and let's navigate once again to a repository so we'll go to something that I know probably has something in it that I could go ahead and do a commit on my DM scripts repository here right and if I do a search for maggot here maggot dash status is what we're looking for and you can see I've got this file here and it's staged changes if I hit you to unstage it you know so now it's unstage now s to stage it and if I want to go ahead and push it I believe I could do P on the keyboard and then what do we want to push it to want to push it to the origin master and of course I did all that without entering a commit message so that's my bad so let me type C for commit and then see again for commit and then type a commit message I don't even know what I did in this fall so I'm just going to say not sure what I did I had no idea I know it's a horrible commit message but hey whatever for the purposes of this video we're just going to leave that as is and I believe if I do control C control C so twice then I get back to this and you can see it's unmerged into origin master and now if I do P to push and then you for origin master and now it's gone and you can see there's no more stage changes or unstage changes so I just successfully pushed that to my get lab so let me do space BP for buffer previous space WW to change the cursor to the other split there and then space WC for window close to close the split and you can see a new program I also added was the highlight to do program so I really kind of missed some of the to do kind of words being highlighted this is something that doom Emacs does out of the box and I kind of missed that so I went ahead and did a use package HL dash to do right so highlight to do and then in the config portion of it we can set different to do type words I'm going to use to do fix me hack review note and deprecated and I give it the style as far as what color to use the warning color the error color the font lock constant color and then whether I want it bold or italicized or whatever it happens to be so this is a very nice program to have especially if you're one of those people that actually do make a lot of to do list and you include words like to do or node or done or whatever it happens to be having those particular key words stand out because there are different color really does help a lot under the language support section I before the previous video I really only had two languages I needed to add I Haskell mode and Lua mode because a lot of the other stuff like Python and bash scripting and things like that already has built in support with Emacs but I found one the other day that is not built in supported by Emacs that's PHP because I was having to edit some PHP files right so I went ahead and did a use package PHP mode that way I have syntax highlighting in those PHP documents when minor gripe I was having with Emacs was the fact that anytime you're in the mini buffer by default Emacs requires you to hit escape three times to get out of the mini buffer right well I wanted a single escape to work I think that's what most users probably expect the default haveder behavior to be so what I did is we did a global set key escape keyboard escape quit so this is a function and we're binding that to a single press of escape so now when I'm in the mini buffer hitting escape one time gets me out some other things that I have added include well let me get past the fork mode section perspective so perspective is basically a way to have multiple workspaces within Emacs so think of like a tiling window manager like I'm in cutile right and I have workspace one through nine well you can actually do that inside Emacs you can assign workspaces give them their own names and you can have groups of buffers within each of these perspectives or these workspaces and what I did is I binded space equals to the perspective mode map so it lists all the perspective related bindings in this one map right so I didn't have to bind each one of these individually that's just a built-in thing with perspective you can just assign that key to give you this entire menu and you can see zero through nine switches from basically you can think of it perspective one through ten so our workspace one through ten so if I do super equals and then one that would switch me to perspective one which we're already in I don't have a second perspective but I could create one if I do space equals to get this back I could do s for perspective switch and let's give it a name because right now we just have the one perspective that defaults to the name main but maybe I want a new perspective and we just created a new perspective a new workspace that defaults to of course the scratch buffer which is kind of the default buffer if anytime you create a new emacs frame and if I want to let's just navigate to something about my dot bash RC file that way we have some buffers going on in this perspective which would be the second perspective now let me do space equals and now switch to one so I go back to that particular perspective space equals to goes back to that new perspective I created and again each one of them are going to have buffers open on their own particular perspectives and it's really if you're one of those people that ends up having dozens or even hundreds of buffers open sometimes that's a nice way to organize these things if I do space be I to open up I buffer I have configured I buffer to actually show me all the buffers that are open because by default I buffer will only show you the buffers in your current perspective but I have added some code to have every perspective and all the buffers listed and you can see the new perspective and it's two buffers the scratch buffer and the bash RC and the main perspective with all of those buffers that I had opened up previously in it so that is perspective let me do a space FC to get back to the config file here now let me scroll down one other thing I wanted to add in previous videos I added rainbow mode rainbow mode is really nice because it gives you a color a background color for a hex value for example 6 f's here ff ff ff ff that's a white right that's a completely white background and that's really nice but there's also another really popular rainbow package that I believe is also enabled by default on do me max and I really missed it and that's the rainbow delimiters so and I misspelled delimiters there let me correct that before I push this to my get lab actually should have been capitalized so one of the problems especially when you're coding is something like e max list but other languages as well as opening parentheses and closing parentheses how do you know if you've got the right number well here's the thing if they're all color coded for example this green opening parentheses and this closing green parentheses you can tell they belong to the same pair right and then the next two are green and then that one's purple because that's the closing parentheses for this one which was purple right so it's a really nice thing and this delimiter thing is not just for parentheses it works with brackets and braces moving on I created a new section here called saying defaults because I had a lot of really small code blocks that were really just one setting for one particular program and I didn't need all of these to be in their own little sections of this literate config so I created sane defaults so these are like one line kind of things and these are things that I believe should just be defaults in the max for pretty much everybody so it makes sense why label this section sane defaults so that includes things like the delete section mode so you can see you can select text and delete it by typing so for example if I'm in insert mode let me hit I on the keyboard to get into insert mode now I select this text now I start typing you know it deletes that text I had highlighted which is kind of a default behavior pretty much every text editor but that's not the default behavior in Emax and Emax by default that actually doesn't work you just start typing and whatever you have highlighted still stays there so delete selection mode to one for true and then electric indent modes turned off so that's the weird indenting which I covered on a previous video most of these like turning off the menu bar scroll bar the toolbar you know so it's basically just a plain window with no toolbars no fancy side scroll bars or anything like that now two things I want to quickly highlight is I turned on electric pair mode so electric pair mode is when you type of parentheses and opening parentheses it automatically creates the closing one for you for example I just type up opening parentheses you see I get the closing one automatically or opening double quotes I get that automatically and that really does save on typing because you never have to worry about that closing character it's already taken care of it for you so I always want to have electric pair mode turned on you see it's set to one one is on negative one would be off but there is one serious problem with electric pair mode and that is inside org mode when you're creating source code blocks which are going to do all the time so to create a source code block how do you typically do that you do a less than sign S and then tab complete right well here's the problem if you turn on the electric pair mode right you're going to do that opening less than sign and it's automatically going to create the closing greater than sign the closing tag the closing Chevron right and but then you're going to type S and tab complete and it's going to work because you know that less than S tab works but then you forget it also tacked on that so when I first turned on electric pair mode here inside my Emacs config all of a sudden everything was breaking my config was breaking any kind of literate configs that I wrote in org mode were breaking is because I was creating all these source code blocks and I didn't realize every single one of them it was tacking that greater than sign on so I needed to find a way around that and that is where this particular line here this ad hook you see we're going to do ad hook on the org mode hook so org mode documents because that's the only place where we're going to need this to happen and set q local so we're assigning a value to a particular variable the variables electric dash pair dash inhibit dash predicate so basically we're telling electric pair mode to not use a certain character so prevent this particular character from being a part of electric pair modes essentially what's happening and that is going to be the less than symbol right because that's what you open the source code block with every time I type a less than symbol now electric pair mode ignores adding that greater than sign at the end so that's how we accomplish that magic and one other program it's a really simple program but I wanted it added to my config just because I find it extremely useful I use it all the time in the terminal and I also wanted it available here in site emacs and that is the TLDR program too long didn't read right so TLDR is essentially like a really short form man page it's essentially it gives you like 10 of the most common commands for a particular program so if I do meta x TLDR and you can see I've minded that to space s t and space s key bindings I think I'm thinking of like search so space search TLDR and I hit enter and now let's view the TLDR page for a particular program for example the LS program there is the TLDR for LS you can see some of the common ways to use LS some common flags and options and the really cool thing about the emacs version of TLDR of course you get some nice highlighting so it actually kind of stands out you know the command is highlighted in this case green and then the options are highlighted and kind of a lighter gray color compared to the background so that is visually it really kind of stands out and one final thing I want to mention here as I'm tidying up what we're really just putting the finishing touches really on this emacs config because it's pretty much done at this point going back to my general key binding section I have a ton of key bindings right and I'm not gonna sit here and describe all the bindings but now I just scroll down got a lot of key bindings right lots of key bindings so at this point I feel pretty good about what this has become I this is actually pretty close to what I had when I was a doom emacs user so essentially I've recreated using a standard GNU emacs and then I slowly configured this thing myself to be what what I had back in doom emacs so I'm gonna go ahead and push this latest config file over to my get lab so look for the configuring emacs repo over on my get lab I will have that posted when I post this video on YouTube now before I go I need to thank a few special people I need to thank the producers of this episode and of course I'm talking about Daniel Gabe James Matt Paul Royal West Armored Dragon Commander Ingrid George Lee Methos Nate Erion Paul peace archon for door realities for less red-profit role in soul's astray tools Devler Ward gintu and a boon to and Willie these guys my highest tiered patrons over on patreon without these guys episode 7 of configuring emacs would not have been possible shows brought to you by each and every one of these fine ladies and gentlemen as well all these names you're seeing on the screen right now these are all my supporters over on patreon I don't have any corporate sponsors corporate sponsors don't sponsor emacs videos I depend on you guys so if you like my work want to see more videos about free and open source software subscribe to distro tube over on patreon peace guys