A month long Atom test drive from an Emacs fanatic – day 0

It’s no secret I am an Emacs fanatic. I previously talked about my emacs setup on this blog, and I try to convert my coworkers to Emacs everytime I can, as Emanuel wrote in his Emacs love/hate piece.

Nonetheless I am writing this article in Atom, the newest kid on the block, an open-source editor by Github that recenty reached the 1.0 milestone.

Why Atom you ask? The reason why I eventually ended up in the Emacs world is that as a programmer I think the editor is the most intimate piece of software you work with. The editor is your tool. The editor is to the programmer what the brush is to the painter, the scalpel to the sculptor, the sword to the swordsman, … you get it.

This strong relationship with the text editor is what makes me want to find the best possible one. I tried many editors, most of them probably, and eventually mustered the strength to learn Emacs, and haven’t looked away from it since then.

Atom though shares a lot of principles with Emacs, so many that I decided to give it a test drive. This is my inaugural piece. In a month from now I’ll tell you how the experience was.

I use Emacs to write posts, work with git, write code in several languages and organize my work. In the past I used to use it for IRC and email too, but I don’t do it anymore.

The first thing I noticed when firing up Atom to write this article is that Atom is visibly slower than Emacs. I don’t know if I’ll be able to survive one whole month with a slower editor, so beware, my concluding article might come out sooner.

I am also undecided whether I like it visually more than I do like Emacs. I know people say Emacs sucks visually, but whoever says that never configured it to their own taste.

There are several things going for Atom though. Coffeescript is a more popular language than Lisp (and its hackers are for sure friendlier than the Lisp ones), also, I know it better, so writing my own Atom extensions won’t be as hard as writing my Emacs extensions.

Everything is integrated with Github. That is a good thing for me. I know Richard Stallman won’t approve (god bless him!), but I am more pragmatic than he is about open-source at all costs.

Just a note: while writing I already changed my themes 3 times. I really can’t find a way to make it look exactely the way it should, that is, to my liking 🙂

I already installed several community packages I read about somewhere, I like minimap and hope to try linter very soon.

I am waiting to discover how and if I can integrate it with rspec and docker and see my projects building in background in a tab. I gotta say, once you get used to navigating among files and buffers with helm, the project navigation with the tree on the left seems a bit antiquated. I guess I can hide it, I’ll have to see how.

This is basically it. I hope to like Atom. Emacs has a lot of legacy, that’s its power and also its curse. Atom on the other hand is a clean slate, and sometimes everyone needs a reboot.

Talk to you in a month!

My love-hate relationship with Emacs

Hi, I’m Emanuel and I have a problem: I love and hate Emacs.

Today instead of offering a solution of a known problem or posting a link to cool stuff, I’m here to ask for hints: I want to hear from other Emacs users what do they use to address my UI problems.

I’ve always been a Vim user (compulsory editor flame war image here) but I wanted to take the red pill and try to embrace Emacs for a while and then take an informed decision. Will I be able to go back? Well it seems I wasn’t and I want to stick with Emacs, the change wasn’t easy: I always kept relapsing to my editor of choice due to impending deadlines, but almost a year ago I decided to take the plunge and I installed only Emacs on my new laptop (I am on OSX, use Emacs with Cocoa installed via homebrew), no other serious editor available.

And I loved it! For a RoR developer, Emacs was a perfectly viable solution, I fell in love with its bindings (after the necessary hiatus to forget dd to delete a line) and my muscle memory reset to the new environment.

But I don’t always write software and I’d love to use Emacs (switching editors is almost more taxing than context switching) to jot down thoughts and write articles, and whenever I do, I feel it goes in the way. When I thought of writing this article I was sure I’d come up with a list of different problems, but in the end I found out my gripes are mainly with the UI and almost anything points to the buffers. My Emacs feels like a one window program, I usually split the screen in 2 or 3 parts, but I’d love to use tabs or multiple windows to arrange my thoughts and get the most of my screen estate. Sure, I could navigate through buffers, but sometimes it feels like throwing everything in a black hole where it’s hard to get something back or at least know what’s there.

And when I need to start some plain text editing, I’d love to find a zero friction way to just open a tab and start jotting down words, like a markdown default mode for empty files (did I mention I don’t want to even start thinking of where I want to save the file beforehand?) something that will make my Notational Velocity setup obsolete.

Maybe there’s no solution (I doubt it) and I’ll have to keep using nv, Emacs and Xcode or there’s a simple one and someone will just RTFM-me, but I’d love to hear what’s your setup and how you addressed similar problems. So, any suggestion is most welcomed, you can find me on Twitter (@onigiri) and no, please, don’t reply with suggestions to switch back to Vim or Sublime and that Textmate is open source now, or Atom, the new kid on the block. It’s not the goal of this article 😉

Emacs My Way

Everyone knows Emacs is a way of life.

You start learning it the first day and you never stop learning. If you think you’ve learned it all then you’re doing it wrong.

I started reading about Emacs when a funny joke about it was “EMACS: Eight Megabytes and Constantly Swapping”, but I never thought I would eventually get into it.

About twenty years have passed before I decided to give it a try, and since then I had to spend around two full years memorizing key chords. I am a happy user now, and here’s some tips to shorten your learning path 🙂

image

I will assume you have your standard Emacs installation working. I use homebrew on OSX to install it with:

    brew install emacs --HEAD --use-git-head --cocoa --srgb

Once you do that make sure it runs, and then clone my emacs.d repo. Save it as ~/.emacs.d, launch emacs and you’re almost done 🙂

It will take a while installing several libraries and it might require you a couple of Emacs reboots to finish installing everything.

Since you’re here reading and waiting that Emacs is done doing its magic stuff let’s discuss how my setup works.

Everything is based on el-get. El-get is a kind of meta-package-manager for Emacs.

It allows you to install and manage packages from multiple sources. Package.el, Emacswiki, github, you name them!

El-get also allows you to quickly whip up your recipes for forked or newer version of packages, very useful (check ~/.emacs.d/el-get-user-recipes/autotest.rcp to check one).

El-get also has a way to neatly package custom init files for the packages you install with it (check ~/.emacs.d/el-get-user/init). 

I use el-get to install all the different packages I use in my daily routine. As of today, but it varies wildly with time, I use:

  • ag, emacs frontend to the silver_searcher, blazing fast search in your projects. AMAZING!)
  • autotest, to continously run your test suite in a buffer
  • bundler, to run bundler commands from emacs, kinda quirky for now
  • coffee-mode, for your Coffeescript needs
  • gist, very useful when there’s a snippet you want to share with the outside world right now
  • go-mode, because the cool guys program in Go now, don’t they?
  • ido-ubiquitous, extends the essential ido-mode to every type of minibuffer query
  • magit, because once you learn to use git from emacs you won’t ever go back to the terminal anymore
  • markdown-mode, for your README.md 🙂
  • paredit, when you want to hack lisp dialects you also want your parentheses not to get in your way
  • php-mode, no comment here
  • powerline, to improve the look and feel of your status line
  • rspec-mode, run specs from emacs, get back results that are hotlinked to the sources. Very useful.
  • ruby-compilation, run scripts and rake and other Ruby stuff from Emacs
  • rvm, allows you to switch ruby versions and gemsets from the editor
  • smex, similar to ido-mode, for M-x commands
  • yaml-mode, sooner or later you’ll need to edit yaml files too 🙂
  • zenburn-theme, for a color theme that improves your health

As you can see from my packages, I am mostly a Ruby developer, but you can easily switch, remove and add to the packages you use by using M-x el-get-install, or edit ~/.emacs.d/init.el.

In addition to init.el and the el-get-user folder, there are four more files in my installation:

  • functions.el, here you can find some functions I defined for general usage. I am moving most of the things you can find here in el-get-user/init
  • defaults.el sets up most of your environment. You know, defaults 🙂
  • languages.el holds configuration for programming languages major modes. I am also moving code away from here and into their el-get-user/init files
  • system.el contains information about your system. You should for sure edit the following line to match your system, or lots of things won’t work
    (if (not (getenv "TERM_PROGRAM"))
    (setenv "PATH"
            (shell-command-to-string "source $HOME/.bash_profile && printf $PATH")))

In addition to using lots of packages to help your daily endeavor, there are some defaults I put it to ease the transition from other less powerful  younger editors (I used to use Textmate).

Remember, you will get lost in Emacs at first, and you will panic. Don’t! Just remember that C-x C-c allows you to quit and try again 🙂

Once your muscle memory wraps around the key chords you need for your programming needs, you’ll be a better person, and a happier programmer.

And you’ll also love Emacs, like I do 😉

Kim Jong Un approves

Note from the editorial staff: This is the last post on dev.mikamai.com until next year! Thanks everyone for following us, on January we’ll be back with more Emacs Lisp, Ruby, Arduino, Raspberry PI, Python, Go, PHP, Prestashop, …