Lets Emacs in 21st Century
Text processing software also called editor (by coders) are very important part of programmers or a writers day to day activity. Optimizing your workflow can help you to be more productive. Don’t confuse productivity with getting more work done, it actually quite the opposite. It’s about getting the same amount of work done in less time and effort and in the best case getting more work done with even less effort. So by this definition of productivity, our editor should help us to produce the same amount of work with less keystrokes. There are lots of editors out that which are trying to help you be more productive but nothing comes close to Emacs. Emacs is an editor you can program and customize the way you want. The purpose of this post is to motivate you to get started and evangelize you to make Emacs as your primary editor.
Well I have tried to adopt Emacs as my primary editor before but I fall on my face multiple time for one reason I DIDN’T HAVE ENOUGH PATIENCE that Emacs demands, but this time I had a couple of strong reasons for which the I am ready to pay the price which Emacs demanded, there were those reason which made me switch to Emacs or better yet give it another shot :
- Portability of configuration : your editor configurations are defined in one place which can be exported or backed up. I recently had to format my machine and I was using Atom as my main editor unfortunate it didn’t have the option to export all the plugin which I had installed and the configured, I was furious as had worked on my plugin and configuration and doing it all again boiled my blood. Emacs has a nice feature of specifying the configuration from which it picks up all the setting, it also has package manager from where you can install a plugin with just few commands. you can create a git repository of your configuration and back it up on Github. This all may sound trivial but when you will the see the changes of the Emacs configuration that you have done one machine to be reflected on your other machines it will be like a magic, all you have to do is just sync up you git repository. Emacs will take care of installing all the new packages and configuration.
- Productivity : Emacs discourages you to lift off your hand from the keyboard and use the mouse to carry out a task. Its nothing I Emacs has against mouse but switching back and forth between mouse and keyboard is so unproductive and irritating. There is nothing that you can’t do using keyboard shortcuts in Emacs, and if there is anything you are doing using a mouse in Emacs then you are probably doing it wrong and you need to figure it out how to do it with shortcuts or command. That’s the level faith I want to have it in my editor and you should too.
- Helps me to focus better and organize my task : in your daily workflow its not very unusual to get thoughts and idea that you feel like it needs your attention they might be some household chore you forgot or you where curious about Michael Jordan’s height, I get it these are all important matters but when you coding its important to focus on the work. The best way to deal with this situation is to make note of this thought, deal them when you have time and get back to your code. Capturing these thoughts in a very low friction way with your editor with just a small prompt would be great. That’s what exactly org-mode is for, it helps you to take notes, organize tasks, write books, journaling, etc list goes on and on. People have used org-mode in many creative ways. There is a lot to say about org-mode I will give more details about org-mode in later part of the post.
- Future proofness of the tools : The reason any software may die is, it is platform dependent, demand is no longer there and fails to evolve with and time and need. Well, Emacs seems to have survived all these reasons of extinctions. Emacs is cross-platform, there is still a large community of users who are using and improving the editor and Emacs is evolving for past 25 years. So probably this will be my editor for life.
- One place to use them all : one of the good things about Emacs is you can bring lots of daily used tools in it, in my case I have configured my email client, music player, git tool, and terminal in my Emacs which were different independent software earlier. The advantage of this approach is you can use the muscle memory that you have gained in other software’s as well and you don’t have to leave Emacs.
This section is about my past mistakes which failed to adopt Emacs. I have explained how to not make those mistake.
- Its going to be frustrating to not remember all the shortcut key and you might even feel overwhelmed by all the gazillion shortcuts you have found on Google. But don’t worry it normal first-timer experience, you don’t have to remember it all and memorize it today. The first couple of weeks are going to be frustrating but you need to have patience. Once you have passed these first few weeks you will build the muscle memory that will put you on autopilot mode. Then you just have to think, your fingers will do the job for you without you even realizing.
- Read the tutorial which you see on the home page of freshly installed Emacs and download the reference the Emacs shortcut from here. Keep the file open and refer it when needed, which will be very frequent in the beginning but later you wouldn’t need it.
- Don’t just switch to Emacs right away. Make it a slow transition from your current editor to Emacs. Take it slow first week make it a target to do 10% of your work on Emacs, next week 20%, next 40%, keep the pace as you feel comfortable. But keep it consistent and increasing.
- Emacs by default comes with very basic configurations but you will have to install lots of packages and do lots of configuration to make it fully functional for your day to day work, like code lint, debugging, auto-completion etc. It can be very tedious to learn all the configuration installing packages and survive the frustrating of the overwhelming shortcuts. My advice will be to use some start packs like prelude, spacemacs, etc to get started. These packages are Emacs configuration which has lots of development environment ready to use, they have very well document guides. You can get up and running in just a couple of hours. I had used prelude.
Now that you’re little convinced to give a shot at Emacs and a bit scared to try it. So let me give you a good starter syllabus that you should master in next 6 months, some of the functions may sound really stupid but I have tried to included ever keystroke which I use in my daily workflow. I have used prelude starter pack which minimized my configuration efforts. I have described my functional expectation from a moderns text editor, fortunately, most of it is provided by prelude, if the functionality is not provided by prelude then I have mentioned the link to the blog post which will help you to set it up.
- File management - this is the most basic thing you will do with any editor so get comfortable with opening, saving and creating new files.
- Email management - emails are the very important form of communication in any organization, so it would be convenient to get it done in your editor and it would be great to not to leaving the editor for such trivial matters, this is the link to a nice post on how to setup email in Emacs. Another good thing about it is you will have your entire email account offline which is available to you all the time and you can make complex filter and search.
- Project management: if you are working on a project then you are most likely dealing with a couple of hundred files and classes. There is an awesome project management plugin called projectile, below I have listed few of the functionality it provides :
- switch between different projects
- compile a project and running test cases
- exploring code files and directory structure
- Version control git - although git functionality is not provided by projectile, there is a great plugin called magit, besides providing all the basic functionality of git it does also provide many of advanced functionality which git is capable of. I highly recommend you to check magit official website https://magit.vc/ to get the details of the tool.
- auto-completion - this functionality can help you to minimize the number of keystrokes to accomplish something, could be spelling, variable name completion, etc, there are two competing frameworks in this space, Helm and Ivy here is the link to the post which describes the pros and cons of both the tool.
- auto indenting/reformatting the file/section.
- code lint
- inbuilt function library documentation
- navigating the code source
- Shell tools - by shell tools I mean all the types of the shell-like bash shell, ipython shell scala (using ensime scala plugin).
- Multiline Edits - this the cool feature provided by sublime and atom which I absolutely can’t live without, fortunately, there is a multi-cursor package which you can install, this link to the Github project has __MultiGood instruction on how to set it up.
- swapping line, moving line/lines of code up and down, moving a block of code up and down
- flycheck: spelling correction and suggestions.
- ido-mode: buffer switch made easy. When you switch buffer all the name of the buffer are made available and the command shell instead of opening up the list of buffer and then selecting it from there.
- helm - autocomplete framework to auto complete anything and everything it has tons of feature
- ivy - helm alternative which is very fast and minimulist, you probably won’t use every feature helm provides so ivy is light weight and minimul memory footprint alternative. A nice blog post comparing both helm and ivy link
- neotree - give you project exploration on the side view, like Atom and sublime editor.
- org-mode - organize your life, note taking, blogging, writing document, this link gives full capability of org-mode in short, here is the full(long) version of the book.
- yasnippet - template system, you can define your own code template which can expand on few keystrokes, fortunately, it also has another repository which there are collection of snippets for popular programming language which are ready to use you can check the repository at this link
- Motivational Video: in this video, the guy gives a deep justification as to what an editor should be and why should one invest time and effort to learn about editor and shares his experience about Emacs as well.
- emacsrocks.com good tricks and tips about Emacs
- Emacs for writer by writer(non-programmer) talk link
- Emacs ocean of knowledge none other than emacswiki.org
- Manage your Finances and Ledger with Emacs link
- Nice introduction video on org-mode link
- How to use Org-capture link
Hopefully, I have convinced you to inspire you to start using Emacs as you secondary editor and soon as your primary. I will keep updating this post as I get new insights or obstacle as the beginner. Emacs is a big ocean no dough about, you have to swim through it sure there are pearls and diamonds in it but there are sharks and there won’t be dolphins in every tide to help you, what I am trying to tell is it you don’t have to make Emacs as your it an ultimate fighting machine, but just enough to get your work done and evolve it over time slow and steady. I am telling you this because you might start over work on the configuration and get drown in it, just a word of caution. Happy Emacsing.