Typing the pound, or hash (#) key in emacs on Uk Macbook

My first foray into customising emacs that didn’t involve copy and paste from something on the internet.

The problem with OS X and the uk keyboard is that the pound key actually has a £ on it. To get “#” you have to press alt+3

Of course, in emacs, the alt key is the meta key which is trapped by emacs. The simple function above inserted into your .emacs file should map the keys correctly.

Another option would be to re-map the apple key to be the meta key, perhaps another yak.

For copy and paste-ability:

;; Allow hash to be entered
(defun insert-pound ()
  “Inserts a pound into the buffer”
  (insert “#”))
(global-set-key (kbd “M-3”) ‘(lambda()(interactive)(insert-pound)))

Windows: Anti-aliased fonts don’t work

I was recently installing a new machine and getting a strange feeling that something was awry with my IntelliJ fonts. They looked like they were not being anti-aliased, even though I had checked the correct option. Also I noticed that generally fonts were looking a bit ropey.

After some puzzling I discovered the dialog above. If you right click on the desktop then to properties->appearance->effects… you will see it and you need to make sure the font smoothing is checked.

Phew, now I have beautiful code again.


A proper shell in windows

Thanks to a posting on our mailing list I am trying out mintty, a tty shell emulator for windows which runs on top of cygwin.

So far so good, feels like the real deal.

You can install it by running “setup.exe” in the cygwin folder and install it from the package list under “shells”.

I added a couple of lines to my ~/.bash_profile

export PS1="\W> "
alias clear='echo -e "\033c"'

As there didn’t seem to be a default “clear” command to clear the terminal. Got the trick from here. Also good is The tips and tricks page

To get a nice “Bash prompt here” you can install the chere package from the cygwin setup (same as above) and then run:

chere -i -c -t mintty -s bash

One oddity I’ve found is that if you execute a batch file which uses CMD.exe, CTRL+C doesn’t seem to work. It breaks out of the program but then output still appears! So you need to run .sh files in there.


Add a proxy to subversion configuration

If you need to access subversion from outside a proxy, you need to edit ~/.subversion/servers and add this:

mySubversionGroup = *.some.domain
http-proxy-host = my.proxy.server
http-proxy-port = 8080

Since Intellij 9.0.3 you now also need to set this information in the svn settings.

Posted in svn

Installing JRuby with Intellij (OS X)

GET it from http://jruby.org/

There is a download page, download and exract the tar file somehwere.

I put it in /System/Library/Frameworks/JRuby.framework/jruby-1.5.1

I then created a symbolic link to jruby_current

ln -s jruby-1.5.1/ jruby_current

And then simply add it to my ~/.bash_profile

$vi ~/.bash_profile
export PATH=/System/Library/Frameworks/JRuby.framework/jruby_current/bin:$PATH
#Reload the profile…
$. ~/.bash_profile
#Try out jruby…
$jruby -v
jruby 1.5.1 (ruby 1.8.7 patchlevel 249) (2010-06-06 f3a3480) (Java HotSpot(TM) 64-Bit Server VM 1.6.0_17) [x86_64-java]

Now you can add the JRuby SDK to your Java Module in Intellij:

Now you can have ruby and Java in the same project. Awesome.