A piece of intertube about the Clojure programming language, algorithms and artificial intelligence.

Friday, November 11, 2011

Updating Clojure namespaces

Continuing my experimentations with Emacs Lisp, I created a function that automatically updates the namespace of a Clojure buffer in conformity with its pathname. This is useful after renaming a file, since changing a file pathname requires to change its namespace, which is sometimes annoying to do by hand.
Once added to your .emacs file, you can call it with:
M-x clojure-update-ns

It assumes clojure-mode is already loaded.

Tuesday, November 1, 2011

Earmuffs and variables

According to the Clojure coding standards for libraries, variables names should be written with *earmuffs* only when they are intended to be rebind.

Here and there I forget this rule and use earmuffs most of the time, so I decided to create an Emacs Lisp function to add/remove earmuffs to variable:

Add it to your .emacs file and then place your cursor on a variable and call it with
M-x earmuffy
to add earmuffs, or type
C-u M-x earmuffy
to remove them.