Productivity with Emacs

One of the noticing things when working for a startup is the amount of technologies you run into. We at Manetos started out with a minimal tech stack mostly for keeping things simple and easy to fix.

But sooner or later we realised that having a small developer team we needed new technologies that give a lot of goodies out for free, so you don’t have to soak your time into writing stuff from scratch.

The need to switch context when working on different projects was a coginitive load that one can do without. I didn’t like switching between different IDEs and different packages and working on the best editor for a current language / environment.

This is my emacs setup to solve these kind of problems. This sort of invest in your tool to help you increase your producitivity is the kind of brocolli diet every programmer could deal with.

  1. We use three languages Javascript, Scala, Python and Emacs supports multiple modes elpyjs2-mode, ensime.
  2. Create desktop environment for projects, use hooks to configure on every load of a desktop the services to start. For example we use a kappa architecture pattern where every service reads / writes to a kafka stream. So it could be helpful to have kafka, zookeeper, and kafka-consumer (console), startup as processes when you load your desktop environment.
    1. This promotes a development that’s quite similar in spirit to REPL , the code you write can be easily tested by loading it in a interpretor and running it against a local kafka environment.
    2. Learn to use and write a comint mode in emacs, this is helpful to learn how emacs talks to subprocesses that you run in your editor.
    3. Load virtual environments through startup hooks of desktops.
    4. So all this helps to quickly context switch between development projects where everything loads unloads including the shell and virtual environments.
    5. Started working on a project to write a magit-popup like helper for kafka, this helps me to create/delete kafka topics from my emacs.
    6. Use directory variables in emacs to configure modes, and use your imagination on how to autoload things when a program enters a directory. (eg shell).
  3. Use helm for getting a global view of everything you have under your emacs-roof, this really changed the way I used emacs, because for a person with right brain dominance, who learns by seeing the bigger picture this tool really helped me get a oversight onto things. It’s like my mind only wants to learn after seeing the bigger picture.
  4. Use magit, it removes the context switching out of the picture, and helps work with git however you want it.
  5. Use ParEdit to work on your code this is built in the spirit of emacs which builds abstractions  over the heterogenous nature of our development projects. Paredit or S-expressions gives us abstractions that helps us treat language native expressions as a common expression forward. Helps you navigate / delete / and work through code respecting the very nature of the code itself. More on this later!
  6. Using AceJump helps with easy navigation. Bind ace-jump-to-char-mode to C-; this makes your finger navigation very minimal movement from the qwerty typing zone dock. Try this you might like it! .
  7. Using bookmark . Althought I haven’t really found them to be life changing.
  8. Associate minor modes with the comint processes you write, for example a json-mode for a kafka consumer output would highlight json structured messages. This is much better than dealing with unhighlighted, unstructured messages from the shell.
  9. Write skeleton to automatically generate code . This was useful for me in lisp linting to automatically generate file header/footer comments. Update update this with more usecases later.
  10. In emacs every editor command is a lisp function, this is a great realization for programmers who then sense their options to extend this further for example  you can spot frequently used command and clump them together. Use advice to do things before and after command, this can greatly simplify the need to wrap a function inside another function.

So in short languages that can be heavily pushed towards the REPL nature of code development benefit from this setup. So environments that use these languages like Ember, Django, Kafka, could also be brought “closer” to the instant feedback cycle that greatly keeps us interested in coding more.

I think in the end it’s about getting a faster feedback, where things end up being a type of play around stuff, rather than drudgery.

“Emacs is the ground. We run around and act silly on top of it, and when we die, may our remnants grace its ongoing incrementation.” – Thien-Thi Nguyen, comp.emacs.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your 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