Lazy Programmer

tips for open source software

Emacs: Do what I mean when commenting

I should know this command earlier. It’s so convenient.

M-x comment-dwim

I always run M-x comment-region and M-x uncomment-region manually except when using C Mode since I can use C-c C-c when commenting.

Don’t do it that way any more. And even fortunately, M-x comment-dwim is bound to M-; by default.

According to help, this command runs different commenting command on different situation. For example, if you mark a region, this command comments code in the region. If you mark comments, this command uncomments them. Read more on help, and read now.

September 17, 2007 Posted by Wang Liang | Emacs | | No Comments Yet

Upgrade cygwin perl to 5.8.8-4

Cygwin perl is broken after I upgrate to version 5.8.8-4. Let’s fix it!

You have to remove Compress::Zlib first. Otherwise, cpan wouldn’t work.

$ rm -fr `find /usr/lib/perl5/ | grep Compress | grep Zlib`

Then, you have to recompile Scalar::Util yourself because weaken is not supported by default.

cpan[1]> force install Scalar::Util

Now, it’s time to upgrade CPAN.

cpan[2]> install CPAN

If you want Compress::Zlib back, remove IO::Uncompress::Inflate first. There is a circular dependence between IO::Compress::Bzip2 and IO::Uncompress::Inflate. Unless you remove this inconsistency, Compress::Zlib can’t be installed.

$ rm -fr `find /usr/lib/perl5/ | grep Uncompress | grep '\bInflate'`

Finally, I recommend you reinstall Bundle::CPAN and Bundle::Test.

September 10, 2007 Posted by Wang Liang | Cygwin, Perl | | No Comments Yet

Emacs is not an island

Emacs is not an island. It can communicate with other programs smoothly, with a little tweak.

Tip 1: to enable copy-and paste between emacs and other X Window programs, put the following line into your .emacs file.

(setq x-select-enable-clipboard t)

Tip 2: install firefox extension, It’s All Text!, to edit textareas using external editor, including emacs.

September 9, 2007 Posted by Wang Liang | Emacs | | 1 Comment