2007-05-29

Emacsclient

Emacs can be used as a server and each file can than be opened via emacsclient. This is handy to keep session lean and to have all working files in one pot. This works however only if emacs is already running. Up to now I had some shell scripts that eased the opening of emacs if it was not running, but I have just find out that it is fairly easy to do this in the following way - I have emacs 22 now:

Set emacs-snapshot as emacs:
sudo update-alternatives --config emacs

Set emacsclient.emacs-snapshot as emacsclient:
sudo update-alternatives --config emacsclient

Set environmental variables (say in ~/.bashrc):
export EDITOR=emacsclient

export VISUAL=$EDITOR

export ALTERNATE_EDITOR=emacs

Now you can call emacsclient on any file you would like to open it. If emacs is not yet running ALTERNATE_EDITOR will startup, which we defined to be emacs. Simple!

Typing emacsclient someFile is to long so I have the following in my ~/.bashrc. Using & also unlocks the terminal, which is handy.

edit ()
{
$EDITOR $@ &
}

2007-05-18

Move to *ubuntu

I had to install GNU/Linux on my box at work and have looked yesterday at Ubuntu (uses Debian as a source of packages) and its derivatives (Kubuntu an Xubuntu). I decided to take Xubuntu, because I will use this machine for a bit more involved computing and I do not want to spend to much resources on eye-candy stuff. Additionally, Xubuntu should be the right choice for my poor laptop.

It turned out that this was very good choice. I had running linux in say 20 min. It is very nicely packed and organized. Up to now I have used RedHat and Debian and this is the best of all! Not to mention the quality of help - really clean, straight, nicely written. Impressive! Debian has great package management, but Ubuntu has pushed this even further. Very slick. I think I will install it also on my laptop over the weekend. I hope wireless will work OK.

I am installing now VirtualBox. Virtualization seems to be very easy these days. Looks like I will be able to abandon dual booting. Oh, at last.

2007-05-11

Skeleton-pair mode in Emacs

Emacs is really great editor. A bit clumsy for beginners, but powerful when you get used to it. I have just added skeleton-pair insert stuff to my .emacs file. This enables direct insert of additional character, say ), when I type (. Nice! Here is the elisp code for it - I found it at emacsWiki site


;; enable skeleton-pair insert globally
(setq skeleton-pair t)
(setq skeleton-pair-on-word t) ; apply skeleton trick even in front of a word.
(global-set-key (kbd "(") 'skeleton-pair-insert-maybe)
(global-set-key (kbd "[") 'skeleton-pair-insert-maybe)
(global-set-key (kbd "{") 'skeleton-pair-insert-maybe)
(global-set-key (kbd "\"") 'skeleton-pair-insert-maybe)
(global-set-key (kbd "\'") 'skeleton-pair-insert-maybe)