 I'm beginning to think that my Emacs configuration file will be a never-ending project. It's going to be a perpetual thing that I work on from now until the end of my life. I will be forever working on my Emacs configuration file. And because I haven't talked about my config file here in recent weeks, it's been probably three or four weeks since the last time I showed you guys an updated version of my Emacs config. I thought today I'd show you some of the additions I've made here recently to my config.org. So let me switch over to the desktop and let me go ahead and launch Emacs. I'm going to go ahead and open my Emacs config and I'm going to zoom in here a little bit. So I've added a couple of new sections to my Emacs config. The first one I want to talk about is this section here that I titled PDFs. I installed this Emacs program called PDF-Tools. What this does, it allows me to actually read PDFs inside Emacs. And you're probably wondering, don't you already have a document viewer, a PDF viewer, most Linux distributions, ship things like events or Zathura. There's a million different PDF viewers available on Linux and pretty much every distribution. Ships went out of the box. So why do you have to read PDFs inside Emacs? Well, if you're already in Emacs, you're already using Dear Ed, the file manager in Emacs. When you click on a PDF, why not just open that PDF inside Emacs? It kind of makes sense when you think about it. So to install this program PDF-Tools, I simply did a use package PDF-Tools. Those of you that followed along with my configuring Emacs series, we've already talked about use package. And it's very simple to install a program in Emacs, use-package and then name of the program. And then you can have these various sections here and then you may or may not need all of these sections. Some of the ones that really stand out here, though, colon mode. So anytime I'm in a mode that involves PDFs, obviously I want this PDF-Tools program in action, right? I also added some custom bindings that I wanted to use because I didn't like the standard Emacs style key bindings. The standard Emacs style key bindings use N and P for next and previous. So going down line by line would be N, going up would be P. I wanted to use the standard Vim key bindings J and K for moving up and down by line. I also wanted to do control equals and control minus for zooming in and out. Those are standard key bindings that are often used in text editors and terminal emulators. Those are just standard key bindings, but they weren't binded to these bindings by default in PDF-Tools. So I've, again, I added some of these key bindings just for me. Then one other thing I did outside of the use package block, which is this block, I added one other line because I wanted to make sure that I disabled display line numbers mode. You see display line numbers mode minus one. So if it's minus one, it's turned off. I want to make sure that anytime I'm in PDF view mode, so anytime I'm viewing a PDF, I do not want display line numbers turned on, right? So that would be these line numbers you're seeing right here on the side of this org document. In most of my Emacs buffers, I have line numbers because most of it is plain text buffers that it kind of makes sense. But in a PDF file, it really doesn't make sense because the line numbers don't really correspond to the lines of text that you're seeing because of the word wrapping not to mention PDFs are going to have tables and images and all kinds of other stuff in it. So just turn off the line numbers mode. So let me show you PDF tools in action. If I just open a PDF, so if I do space FR for find recent files and I search for this file here, which is learn you a Haskell for great good.pdf. So this is a book called learn you a Haskell for great good, teaching you, of course, about the Haskell programming language. And I can scroll up and down with the mouse or I could go up and down line by line with N and P if you're using the standard Emacs key bindings. But remember, I rebinded it to use J and K. And if I want to go up and down page by page, I can do control J to go down a page and control K to go up by page. So that are my new key bindings. And remember, I also did control equals to zoom in and control minus to zoom out. If you have the popular library installed on your Linux system, which most Linux distributions, desktop Linux distributions are already going to have popular installed. What this does, it has a, it's a library that allows you to do things like annotate PDF. So if I right click somewhere in this PDF file and I add text annotation. Now it's got a key binding, control C, control A, followed by T. Horrible key binding. If I actually used annotations all the time, I'd rebind that. But honestly, I never annotate PDFs. I just read them, right? But if I wanted to, I could click here, add annotation. And now you've got this little icon here. If I click on it again, now this split here opens at the bottom where I could add an annotation. So let me get into insert mode and I'll do annotation, all caps, exclamation, hit escape to get back into normal mode. And then control C, control C to commit changes. It's very similar to making a commit and maggot, the get client within a, within Emacs, very similar. So control C, control C, the split goes away. And now that annotation is there. If I want to read the annotation, I could click on it and it'll open in a split or let me do control C, control C to get out of that split again. What I could do is I could right click again and I could display annotations. And by default, that's control C, control A, control L. Once again, I would rebind that if I use this all the time. But display annotations opens a split. It tells me what this annotation is, the annotations that I currently have in this document. I only have one, it's on page five, it's just text. And in the split, it will tell me what that annotation is. And if I had multiple annotations, you know, I could scroll through them and in the split, it would tell me what each of the annotations are. Let me cue to quit out of the annotations and let me cue to quit out of the PDF viewer. One other thing I've been playing around with here in recent weeks is edif. Now what edif is, this is a built in Emacs program. It's a diff program. Those are you that are familiar with like the standard diff command that you use in your Linux terminals, for example. A diff is a way to compare two files and see the changes, right? See the differences between two files. Now with edif, you don't have to install it because it's built into Emacs. There's a couple of different edif programs. If I just search for edif, and let me scroll down here. This program here, edif-files, which I have minded to space EF. What edif-files does, it runs a diff on two files. You're comparing two files, but there's also a edif-files three. And I've minded that to space E capital F. And what this does, it runs a diff on three files. So edif-files, if you want to compare two files, edif-files three, if you want to compare three files. And again, I've minded these. So let me show you this in action. Space EF runs edif-files. So let me find two files to compare. So let me go into my home directory and compare my bash RC with my bash RC dot backup. And they are similar, but they are different. And this is edif. Now by default, edif compares the files not in this side-by-side split, which is a vertical split if you're using VIM terminology. Emacs terminology actually calls this a horizontal split. But again, most people have that VIM kind of mindset, especially if you're an evil mode user. You know, I like this side-by-side vertical split. So this is not the standard. Again, the standard, unless you change it, is a horizontal split, but I'll show you how to get to that here in a second. And you see at the bottom, I have a horizontal split and it says type question mark for help. So let me do question mark. And then I get some key bindings and you can see I can go to the next diff with N and the previous diff with P. I also have a JNK set here. I added JNK for bindings to that. So if I do J, I'll go to the next diff. So this is the next area in these two files where they differ, right? So this section right here, there's a difference. If I go J again, it will go to the next diff. And the next diff and the next diff. And K would go back up. Now, if you want to use the standard Emax key bindings in for next diff P for previous diff. Now, one interesting thing you can do if you don't like the side-by-side viewer or sometimes you want to change between a vertical split and a horizontal split, especially depending on the size of the window. Maybe you had another window opened out to the side. Let me open a terminal. Now this side-by-side vertical split doesn't make much sense. Well, there was a key binding. You can't really see it because the table's all messed up now. But a pipe symbol. If I type the pipe character on the screen, it will change all of this now to a horizontal split. You can see here's the top section. Here is the bottom section. And this is a little easier to read since I had that terminal open. Let me close the terminal. And now that I've closed the terminal, let me do the pipe character again to go back to the side-by-side vertical split. Now eDiff calls these files a and b. So if you look down here under the manipulate section, you have the characters a and b on the keyboard. They copy a or b's region to the other file, b or a, right? So this is file a, this is file b. So we're at this diff here. If I want to take a's region and move it to b, if I hit a on the keyboard, you can see I just changed what was over here now. And if I go j to go to the next diff and maybe this is the right one, this is the wrong one, once again, I'll do a on the keyboard to make that change. If it had been b was actually the correct code that I wanted, I'd hit b on the keyboard and it would actually copy the file b diff over to file a. I hope that makes sense. Then you have a wx and wd for writing. So wd is interesting because it saves the diff output and that is an interesting kind of command. If you just wanted to save the file with just the diffs and not the whole file, you can do q to quit out of this e diff help information. And so you're out of e diff. Now the files are still here. You haven't actually written anything as of yet or at least I haven't. For me, I'm actually gonna use to undo all of this backup file because I may use this as a comparison and future video. So I do want these files to remain different. Then let me do a space wc to close that split and space bp for previous buffer space bp for previous buffer. Where is my config file? Well, I have a key binding for it. I can do space fc for find my config.org. So my e diff section here, again, I didn't have to use a use package block or anything because e diff is built into Emacs but I did want to specify a few things. So I've got set q, set q assigns values to variables. The first variable I wanted to assign something to is the e diff split window function. So how does it split windows? I want it to split window horizontally. And again, Emacs calls this a horizontal split. Vim users would call it a vertical split. That's the side by side split. Some weird terminology, right? They're a little different. I also have e diff window setup function. This variable set to e diff setup windows plane. What this does is that help information that was in the bottom split with the question mark that you had to type to get your key bindings. If you have this set, you get that. If you don't have this set by default, what it does, it has a separate Emacs frame, a pop out frame that has that information. And it's annoying. I don't know why that's the default behavior for e diff. I think most people are going to want this default behavior for e diff. And then I wanted to add j and k for a next diff, previous diff. And to accomplish that, what I had to do was define my own function here, which I call dt dash e diff dash hook. And within this, we are defining a key, right? Defining a key binding. And you can see set j to e diff next difference and k to e diff previous difference. And finally, when I've created this function here, we need to add hook. So add hook to the e diff mode hook. And what are we adding? Well, we're adding dt dash e diff hook, which we created here. That way, my custom key bindings work. Now I mentioned space e f was e diff and I had space e capital F for e diff dash files three, comparing three files. Let me just briefly show you this. It works exactly the same. Once again, compare my dot bash RC with my dot bash RC dot backup. And for a third file, I don't have anything really that similar. How about my ZSH RC? Because it will have some similarities. So what it does, again, you have AB and C files. Now, right, you have three files in a split. Again, at the bottom, you have your help information and that horizontal split. And if I go J, you know, for down to the next diff, we will find all the diffs. If I do the question mark to get the help information, it's basically the exact same commands whether you're using e diff files, comparing two files or e diff files three to compare three files. Let me queue to get out of e diff three and let me make sure that these are actually not changed. So some other things I've been playing around with, let me get back toward the top of my config file is same defaults. I have this section here, same defaults, which is what I consider the defaults that most Emacs users will enable. These are mainly global settings, for example, turning off the toolbar and the scroll bar and the menu bar, things like that. And on the last video, when I was discussing my config file, I did not have these last three, but I have since added these, which is turning off file dialogue, dialogue boxes and pop up windows. So Emacs, of course, is a GTK application and being a GTK application. Sometimes you do get things like pop up windows and menus and things like that, a file download dialogues and stuff like that. I don't wanna see any of that as far as a graphical dialogue box in the middle of the screen. Instead, turn all of that off and just display that information in the echo area. The mini buffer down here, right? So if something needs a pop-up box, just ask me that yes or no question that would appear in the pop-up box. Just ask me that down here in the mini buffer. I think that makes sense. Again, for most Emacs users, that's why I put that under this section here that I call same defaults. Some other things I did added some key bindings. So let me go to the general key binding section of my config and actually the last section will be when I went too far, the W key bindings, which were mainly windows-related key bindings. So managing splits, but you see now I have it as windows and words-related key bindings because I have these three here that I've since added. So I've been doing a lot of creative writing here in recent weeks. And one of the things is when you're doing this kind of creative writing, sometimes you want to emphasize words by having it all caps, right? So Emacs actually has this kind of functionality built into it where you can downcase a word or upcase a word with these particular functions. Downcase dash word, upcase dash word. So I thought those were so useful. I wanted to bind those. For example, if I put the cursor point right here on the word upcase, if I do space w u for upcase, it upcases that word. I move the point back to the word space w d for downcase, downcase is it. Let me use twice to get back to the way I had it where it was actually the word was capitalized at the beginning as it should be. So those are such powerful commands, the such useful commands that they needed bindings. In my opinion, one other binding I added was space w equals for count dash word. So it's a word count. Kind of like the word count program, the standard GNU core util w c program, right? It gives you this information. It gives you a lot of information actually right down here in the mini buffer. Let me show you this in action on this document. We're looking at space w equals. And buffer has 1,013 lines. It gives us a line count, 224 sentences. So that's just how many sentences are in the document. 6,231 words, so word count and 41,684 characters. So that is, again, very useful information, especially, again, if you're one of these people that do writing for a living, maybe you write articles, blogs, you're a journalist, maybe you're a novelist, whatever it is you happen to be. If you want to keep track of things like word count and line count, that's a very useful built-in Emacs function that's available for you. So that's just a little bit of the changes I have made here in the last couple of weeks with my Emacs config. As always, I will go ahead and push these changes that I've made over to my GitLab. Go to gitlab.com slash dwt1, that's my GitLab. Look for my .files repository and grab my Emacs config. You'll find it in .config slash emacs slash config.org. 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 game games, Matt, Paul, Steve, Wes, Arkotic, Armor Dragon, Commander, Angry, George, Lee, Matthew, Matt, those Nate or Yon Paul, Peace, Archim, Adore, Realities4less, Red Prophet, Roland, Soulastry, ToolsDevlar, Wargent2 and Ubuntu and Willie. These guys, they're my highest tier patrons over on Patreon without these guys. This quick look at my Emacs config it wouldn't 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. These are all my supporters over on Patreon. I don't have any corporate sponsors. If you like my work and want to see more videos about Linux and friend open source software like Emacs, subscribe to DistroTube over on Patreon. Peace guys.