14 May 2010

Improving my Emacs Configurations

Dan Mayer
Dan Mayer @danmayer

Emacs, Aquamacs, emacs starter kit, developmentI have been using Emacs as my default editor for awhile now. My emacs setup was a hodge podge of various plugins, code from friends, blogs, etc… It wasn’t organized and was hard to maintain and fine tune. I decided it was time to get my emacs config under control, and under git so it was portable and easy to revert update etc. I looked at a couple options for existing Emacs configuration setups for Ruby. Emacs Starter KitTopfunky’s Emacs Starter KitAquamacs Starter Kit In the end I ended up going with Aquamacs Starter Kit, namely because I have been a fan of Aquamacs for awhile, and already new my way around it’s system pretty well. The original Starter kit, from Technomancy, doesn’t play nicely with Aquamacs and leads to some issues. Some people have forks that are supposed to work better with Aquamacs, but it seems the kit built from the ground up for Aquamacs works best. Topfunky’s project is based on the original emacs starter kit, but has been customized to work well with Carbon Emacs, which is more cross compatible than Aquamacs, so your emacs config is more likely to be portable to all unix systems as well as OS X with Carbon emacs. This looks like a really interesting option, but I decided I liked some of the nice extra sugar that Aquamacs provides. First install Aquamacs starter kit There were a few things that I couldn’t stand from the defaults in the Aquamacs Starter Kit and removed also some modifications that I added. ### Disabling/Removing some Starter Kit features You likely installed your starter kit to a location like, ‘/Users/danmayer/Library/Preferences/Aquamacs Emacs/aquamacs-emacs-starter-kit’, go there to find the files for modification. Disabling the emacs Twitter client, sorry I like my twitter to be entirely separate from my dev environment. Then edit ‘init.el’:;;(autoload 'twitter-get-friends-timeline "twitter" nil t);;(autoload 'twitter-status-edit "twitter" nil t);;(global-set-key "\C-xt" 'twitter-get-friends-timeline);;(add-hook 'twitter-status-edit-mode-hook 'longlines-mode) Disable Ruby-electric, which tries to complete various matched chars and statements as you type like ‘, {}. (), begin/end, if/end, etc… It drives me nuts and breaks my thought process. Edit ‘misc-mode-tweaks.el’:;;(require 'ruby-electric);;(add-hook 'ruby-mode-hook;; (lambda nil;; (require 'ruby-electric);; (ruby-electric-mode);; (flymake-mode-on))) ### Additions to Starter Kit I saw a Emacs package to add flog score inline to ruby method scores and thought that sounded like a great addition to help keep my methods concise, so I added that, to my .emacs: ;; ruby-complexity flog scores for methods http://github.com/topfunky/emacs-starter-kit/tree/master/vendor/ruby-complexity/(add-to-list 'load-path "~/.emacs.d/vendor/ruby-complexity/") (require 'linum)(require 'ruby-complexity)(add-hook 'ruby-mode-hook (function (lambda () (flymake-mode) (linum-mode) (ruby-complexity-mode)))) I also liked some of the options from defunkt’s Textmate minor mode. First ‘cd ~/.emacs.d/vendor; git clone git://github.com/defunkt/textmate.el.git’ Again added to my .emacs file: ;; textmate bindings for some nicer key combos for common actions(add-to-list 'load-path "~/.emacs.d/vendor/textmate.el")(require 'textmate)(textmate-mode) I am just starting to get going with improving my Emacs setup, so I am sure I will likely be making additional changes. The current changes above are checked into my fork of the project, feel free to pull the above changes if you’d like. If you have any great Emacs tips, tricks, or plugins I should add let me know as I am sure it can just keep getting better, but I am pretty happy for now.

Categories