Archive for the ‘Uncategorized’ Category

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)

The first post

May 5, 2008

Hello, everyone! Welcome to my blog! I’ll post here bits and pieces inspired by my humble experience as a software developer. Expect to see here primarily stuff about Java and Ruby, but also about software development in general. As a fan of the Star Wars franchise I often like to quote characters from the movies. I feel that this is the time for one such quote – “Always two there are, no more, no less. A master and an apprentice.”. I’m no dev wizard by any means, but I hope that I can help someone learn something helpful and maybe I’ll learn something from the readers of my blog(if I have any that is:)). In this sense one can say that in life we’re always the master and the apprentice at the same time… I hope you’ll enjoy reading my blog!