GeekSocket Plug in and be Geekified

Entering The Church of Emacs

From the title you may think this is another post or debate on <your favorite editor here> vs GNU Emacs. I will be talking about how I started using Emacs and why it is the best tool I have ever used.

How it started

During dgplug summer-training 2018, we had series of sessions on GNU Emacs. Thanks to mbuf, the whole series helped me a lot to get started with Emacs and now I use it for all my editing. The series starts with basic navigation and covers up to Org mode and Magit. Before this, I had only seen a demo of Emacs by Sachin during a session in our college. I was very impressed by all the things he showed us during the demo, though I did not try to use it myself after that.

Before switching to Emacs I was using PyCharm and vim and then later started using Code along with vim for editing files.

Why one should use Emacs as their editor

We spend most of our time in writing different things. It includes writing code, writing emails, blog posts, documents etc. Basically our whole work includes a lot of writing. So the tool one uses for doing this all the stuff must be something which we craft according to our needs and powerful enough to be sufficient to help to do us all the required things.

The Editor of a Lifetime by Perry Metzger (~1h)

Here are some of the points I would like to highlight

Doing all the stuff without using mouse

This is my one of the favorite thing about this editor. You don’t even have to touch mouse to get things done. So it helps you to just focus on your keyboard which in turn, saves a lot of context switching time.

Easy and fluent navigation

When I was using PyCharm, Code and even vim, I used to feel irritating whenever I wanted to navigate through the file while I’m editing it. Either I had to bring my hand near arrow keys or I had to press Esc in case of vim. Both the ways were not as fluent as I wanted them to be. In case of Emacs, it is far more easier to navigate through the file while you are editing because of the default key bindings we get.

Highly customizable

You have freedom to choose whatever package you want to install in order to add support for a particular language. Basically there are a lot of packages (similar to plugins in some of the editors) which are written in Emacs lisp. You can install them and get things done without even learning elisp.

And the most important: Slowly you will realize that, how all the packages and modes are designed to increase your productivity and help you to get things done very quickly.

Challenges I faced

We all learned to touch type during summer-training 2017, but I had habit of using wrong fingers for Ctrl and Alt keys. For example if I want to press Ctrl+C I used to do it with my left hand’s pinky finger and index finger which is not correct at all. In Emacs most of the default key binding are dependent on the Ctrl (C) and the Alt/Meta (M) key. That was the thing I unlearned and learned to do correctly.

How I use Emacs

I have my .emacs file hosted on GitLab. It has some basic configurations. I use elpy mode for Python, Go mode, YAML mode etc.

Org mode

The most favorite thing is the Org mode. I write my all the notes in Org mode, it provides ways to export the org files to various formats, which is really helpful. It helps you to get all of your tasks organized very easily. I use it to manage my personal as well as work related tasks and to maintain a daily diary. Org mode website.

Magit

The next favorite mode is Magit. It’s an interface to use git. As I said earlier following the effort of increasing productivity, it makes time consuming git commands very easy. For example git add -p, you will just have to select the region and press s it will stage only the selected lines. Magit website

Other stuff

  • I use Org mode to generate presentations as well. (Will be writing a blog post about this)
  • I use shell inside Emacs (I just do C-u M-x shell and then give a name to the shell). In some cases I need to use ansi-term. Related discussion on reddit
  • I have spacemacs-dark theme which looks really nice
  • I found keyboard macros feature useful, I use them frequently
  • The EDITOR environment variable is set to emacsclient and emc is alias for emacsclient Link to .bashrc

Having all the things inside Emacs itself helps a lot to save the context switch time. Idea is to stay inside the tool

Emacs Org mode
Emacs Magit mode

Things to keep in mind

Emacs does have a little steep learning curve but it worth the effort. So be patient when you start learning things. It will take some time to get used to it and completely switch to it.

People frequently ask these questions to me when they see me using Emacs

  1. Do I need to remember all these shortcuts, there are a lot of them?
    No, you won’t be remembering all of them. Once you start using them, those will get into your muscle memory.
  2. I will have to keep customizing this whenever I need support for some new language
    Yes, but that’s the whole point behind having a highly customizable editor. As mbuf says, A tailored suit looks much better than a ready-made one
  3. How does Emacs follow Unix philosophy?
    I think it does help us to focus on our one task by giving us the power to have all things inside one tool

References


Comments

comments powered by Disqus