Fist of Senn

a developer's notebook

Use the Right Ruby With Emacs and Rbenv

I recently switched from rvm to rbenv to solve some annoying problems related to rvm. The switch was really painless and after half an hour I was operating again. Next up was integrating rbenv with Emacs.

simple configuration

If you only want to use the global Ruby you configured with rbenv simply add the following lines to your Emacs configuration:

1
2
3
;; Setting rbenv path
(setenv "PATH" (concat (getenv "HOME") "/.rbenv/shims:" (getenv "HOME") "/.rbenv/bin:" (getenv "PATH")))
(setq exec-path (cons (concat (getenv "HOME") "/.rbenv/shims") (cons (concat (getenv "HOME") "/.rbenv/bin") exec-path)))

described by Marc Bowes Using rbenv with Emacs

rbenv.el

Back with rvm I wrote an elisp package called rvm.el to make it easy to switch between Ruby versions. I’ve engrained to be able to switch rubies inside Emacs and I wanted to be able to do the same thing with rbenv.

Happily integrating rbenv is very simple and switching the Ruby version is as easy as setting the RBENV_VERSION environment variable. I bundled my configuration to an elisp package and thus rbenv.el was born.

The library currently supports:

  • rbenv-use-global: activate your global ruby
  • rbenv-use: allows you to choose what ruby version you want to activate
  • rbenv-use-corresponding: searches for .ruby-version or .rbenv-version and activates the corresponding ruby

Note that rbenv.el always configures the complete Emacs session. There is no way to set the Ruby version on a per buffer basis.

installation

Like most elisp packages you can simply download the source from github, add it to the load-path and require ‘rbenv. As an alternative I submitted the package to Marmalade, MELPA and opened a PR on el-get.

Take rbenv.el for a ride and let me know what you think!

Emacs and Java - Journey of a Hard Friendship

The story begins back in 2009 when I did mostly Java J2EE work. At the time I was working with windows, used a Mac at home and occasionally played around with Linux. The result was, different tools, key bindings and workflows for every platform.

I used Emacs before but because I did a lot of Java work I never got around to using it full-time. Emacs works on every platform, has a completely independent key-binding layout and with some tweaks to my configuration I got it working on every platform successfully. I quickly begun to adjust my configuration strongly and developed a personal workflow. The only gap was Eclipse to do Java. I was determined to use Emacs for my Java development.

Take Ctrl Over Your Caps Lock

For a long time I wondered if there actually is a usage for the “Caps Lock” key on your keyboard. This big key, in the perfect spot for your left hand pinky finger, is just waiting to be pressed by ACCIDENT.

When I picked up Emacs four years ago the time has come to put that key to use. The way Emacs is designed you find yourself hitting Ctrl very frequently. Instead of twisting your pinky finger to reach down for the Ctrl key just rebind Caps Lock to Ctrl. After a few days you’ll be wondering why you didn’t do this years ago.

Gear Up - Get Started With Emacs

The editor discussion is always a hot topic. At the moment vim is making the comeback in the rails scene. While many people try to make a case for vim or Sublime Text 2, this article focuses on Emacs.

First of, you should use the tools, which make you the most productive. We are software developers and as such we should learn how to use our tools to become more productive. In my opinion it’s not about what tools you use but how you use them.

Emacs is an environment that you can tailor to your workflow. Over the years you will shape it to fit your needs and adjust to new challenges (new programming languages, new version control systems, etc…) but before you jump into Emacs, there are a few things you should consider:

Grow Tasty Cucumbers Using PageObjects

Motivation

Cucumber is a wonderful tool but at the same time it can get you into deep trouble if you don’t use it correctly. Over the years I tried many different styles to write Cucumber Features but in the end most projects ended up with a verbose and brittle set of features, which was a pain to maintain.

I always liked Cucumber because you can write your thoughts without translating them into a programming language. This helps me to think more about the feature at hand and gets me into the mindset of the customer. I understood the goal of Cucumber from the beginning but as a programmer I always looked at it as a testing tool. It took me a long time (multiple years) to notice that the maintenance pain is directly coupled to that thinking.