Few reasons why Emacs. Part 1.

emacs

When I say to people that I use Emacs, I get “the look”.  

    Emacs is definitely not for everyone. Using Emacs is more of a hobby that requires some level of curiosity and persistence; and learning curve is not really a curve, but more of a skyscraper with a few balconies to chill while questioning your sanity. Interesting thing happens when other people see you editing source code. They get confused about what is happening. Anyways. This post is about few cool things Emacs allows you to do. Hopefully after reading this few of you will give it a try.

emacs_vs_vi

1.  You don’t need a mouse. 

    Wait, what? The greatest invention in a history of personal computer inventions and now you saying that it is not needed. Yes, that is exactly what I’m saying. The reason is fairly simple and for any person that does blind typing and needs to type while thinking and not to think about the process of typing, but the actual material being typed. When you take your fingers off of keyboard a lot of times after placing them back on first few characters got mistyped, which disturbs the flow. The argument that developers spend most of the type thinking not typing is valid and true for the most part, but why subject your self to unnecessary mental burden when there is a way not to?

2. Repeat what I did? Not a problem. 

    If you do any kind of software development or learning to do so, then you must have heard this phrase: “If you need to do things over and over again, stop and write a script to do it.” It all sounds good and fancy, what if you don’t know any scripting languages or writing a script just not worth the effort? Emacs got your back.  Let’s say you need to:

  1.  Clear a terminal so you don’t see compilation errors from previous build
  2.  Find all compilation errors if they occurred
  3. Display them in a separate window for viewing
  4. Go to the location of a first error in a source code

    If you write any language that needs to be compiled it is very common sequence. How long do you think it’ll take you to write a script for it? Emacs makes it simple, it will record your actions (in a Macro) when you tell it to and reproduce them when you need to do your sequence again. As simple as that. I use it all the time, and it saves me time.

  3. Your config is a single file. 

    We all have preferences on our keyboard bindings. Microsoft and Apple are trying hard to force their “standard” on as, most of the developers end up tweaking default settings just a little bit to get it just right. And then fire alarm sprinklers go off and fry your computer with that precious setup that you nurtured for years. Emacs makes it easy. All your Emacs tweaks and custom function (yes there are custom functions. Emacs is build in Emacs Lisp and you can make it do whatever you want, it is just another programming language) are in a file that I personally keep on GitHub. You get your new computer, download one file, interpret it. Vua la, your set up is complete. How nice is that?

 4. The Kill Ring is awesome. 

    What a name, right? The kill ring is a place for all items that you copied or deleted during your current session. Having the ability to browse a kill ring is a great advantage. Let’s say your need to write a C++ function with the following declaration:

boost::share_ptr<PersonalItems_n::Weapons_n::ThrowingWeapons_n::IStone_c>
PersonalItems_n::Weapons_n::ThrowingWeapons_n:: Stone_c
FindInBackPack(Common_n::API_n::ObjectIds_n::UUID_c & uuid);

     Totally made up example, but I think it illustrates the point. I wouldn’t want to type return type and argument type by hand. Yes you could do a typedef to make is shorter and write using namespace bla-bla-bla. It is not the point. The point is that you need to copy multiple things from multiple file to a single file. In Emacs it is easy and fast. You copy all you need to move to the kill ring, go to the file that you need to edit and take things from the kill ring one by one. I use it all the time and does save time.

    At the end, I’d like to say that, there are things that IDEs (Integrated Development Environments – big applications that have everything included and configured for you, Eclipse, JetBrains suite, to name a few) are great at. For instance, Refactoring, and Indexing. But if you don’t have to do heavy refactoring all that often there is no reason to use 5Gb of your RAM to run Eclipse and have it “NOT RESPONDING” for a 5 seconds every time you change function definition or rename a class.

    In part 2, I’ll go over Multiple Cursors, Git integration, Shell, Emacs Directory and File Explorer.

 

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.