Archive for the ‘Uncategorized’ Category

Automatically execute programs after zsh login

December 5, 2009

Sometimes you may want to start a couple of programs just after an interactive login to your favourite shell, which in my case would be zsh. For example – I use Emacs as daemon process. I cannot use an init script to start it since the daemon is usable on a per user basis. The solution in this case is really simple – just create a .zlogin file in your home folder and put in it all the commands you want executed after you’ve logged into the shell.
In my case I put “emacs –daemon” there and I soon as I’m logged in, the Emacs daemon is up waiting for incoming connections.

Accessing the menu bar in Emacs

December 5, 2009

Have you ever been wondering how to access the Emacs menu bar, when using Emacs in console mode? The answer is easy – press F10 or type “M-x menu-bar-open”(both methods work in X as well, of course).
Although the menu bar is rarely used by seasoned Emacs veterans, exploring it is a great way to get started with the capabilities of the new modes, so being able to use it is generally a good thing.

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!