Archive for May, 2009

Emulate the behaviour of Return+Shift(insert new line) from popular IDEs(IDEA, Eclipse) in Emacs

May 19, 2009

I’m very fond of the ability to insert a new line below the line I’m currently at, and to position the cursor at the beginning of that new line, offered by most IDEs, such as IntelliJ IDEA, Eclipse. It’s usually bound to  Return(Enter)+Shift. Emacs(as far as I know) doesn’t have a function that does this thing by default, but one can easily create one, combining several well known functions in the process and bind that new function to the desired key combination. Here’s the snippet one might have in his .emacs(or other) “configuration” file:

;; insert an empty line after the current line and position the cursor on its beginning
(defun insert-empty-line ()
 (interactive)
 (move-end-of-line nil)
 (open-line 1)
 (next-line 1))

(global-set-key [(shift return)] 'insert-empty-line)

A switch on String idiom for Java

May 4, 2009

I’ve always been frustrated with the inability to write a switch on String in Java.  However the enum type introduced in Java 5.0 somewhat diminishes the issue. Read this excellent article on the subject.

Generating X Logical Font Descriptions(XLFD) for Emacs with xfontsel

May 2, 2009

Emacs prior to version 23 was unable to use TTF fonts. The type1 fonts that it uses are described by a XLFD line containing all the info about the font – its family, slant, weight and stuff like that. Guessing all of these while trying to find the perfect font for Emacs is boring and the process can the eased substantially with the help of the xfontsel application, which is generally available by default on most Linux installations with X.

The xfontsel application provides a simple way  to  display  the  fonts
known  to  your  X  server, examine samples of each, and retrieve the X
Logical Font Description (“XLFD”) full name for a font.

In other words you simply fire it up, select the properties of the font you need, see a preview of you selection and receice  XLFD line that you can pass to an Emacs Lisp function set-default-font for instance.

I myself am a fan of the terminus font and the XLDF line that I generated with xfontsel looks like that:

“-*-terminus-medium-r-*-*-20-*-*-*-*-*-*-*”

Ubuntu 9.04

May 1, 2009

As most of you probably know I generally use Arch Linux, at least at home. Recently the Arch Linux developers decided to drop the support for the ATI Catalyst proprietary video driver and I happen to own a RadeonHD 2900PRO so I was not very happy about this decision. So I thought I might give Ubuntu another try and installed the latest and greatest version 9.04 hot off the press. Here are some quick thoughts of mine about that release.

The installer was very polished. No issues, no complaints. I’d like however to see someday the option to select packages in the default installer.

The boot time was fantastic. Great job, Ubuntu team. I was pleasantly surprised by it. The new artwork looked great as well. Especially the New Wave theme which I simply love(except the issues it has with non-native GTK applications such as firefox, thunderbird). I found the new OSD notifications system good, although it seemed pretty much stolen from OSX :) As Pablo Picasso once said – “Good artists create, great artists simply steal”

The default software selection was decent enough. And there are the rich Ubuntu repos in which you can find almost everything. No worries here.

PulseAudio with OSS is still problematic, but I guess this is to be expected since probably only X-Fi owners use OSS. Flash performance is terrible on the 64 bit version at least. Skype 64bit is buggy as well. This is no fault of the Ubuntu team however. Video performance was satisfactory with Catalyst, though Desktop Effects are still almost unusable with it in the long run.

The overall experience with the system has  been overwhelmingly positive so far. I hope it’ll remain in the same general area. Stay tuned for further updates.