Archive for the ‘Emacs’ Category

A quick and powerful Emacs tip: Repeat last complex command

August 23, 2010

Emacs never fails to surprise me. I think I’ve discovered this much later than I should have, and pretty much by fluke, but here goes:

C-x ESC ESC runs the function repeat-complex-command which will let you “edit and re-evaluate last complex command”. A complex command is one which uses the mini-buffer. Using this, you can easily re-execute commands when you want to without having to type the whole thing out again. The command to be executed is shown to you in elisp form, so you can even modify it if you need to. What if I don’t want to execute the last complex command? What if I want to execute a command I have used a bit earlier? Well, you can traverse the mini-buffer history by using M-n and M-p! Super-cool!

Emacs : eldoc mode and c-eldoc mode

May 22, 2010

eldoc mode as the name suggests provides documentation for Elisp files. This is a very useful and cool mode and shows the function signature in the mode-line when your cursor is on a particular function.  It also provides info on the variables. Check out the screen-shots below.

eldoc : Function signatures

eldoc : Variables description

To start eldoc mode, add the following to your .emacs file

;;Turn on documentation in elisp mode
(add-hook 'emacs-lisp-mode-hook
          '(lambda ()
	     (turn-on-eldoc-mode)))

c-eldoc mode is eldoc mode for c. It displays the arguments of C functions while one is programming.

c-eldoc

To add c-eldoc mode, get the latest c-eldoc.el, copy it in your load-path and then add then following to your .emacs file.

(add-hook 'c-mode-hook 'c-turn-on-eldoc-mode)

Emacs : PKGBUILD mode

May 5, 2010

Discovered an amazing major mode for Emacs a few days back to edit PKGBUILDs. Essentially based on shell mode with the following extra bindings specific to PKGBUILDs.

C-c C-a pkgbuild-tar
C-c C-b pkgbuild-makepkg
C-c C-e pkgbuild-etags
C-c RET pkgbuild-update-md5sums-line
C-c C-r pkgbuild-increase-release-tag
C-c C-u pkgbuild-browse-url

I especially like pkgbuild-update-md5sums-line – very useful.

It also has some other cool functions. Check it out here.

My fork of the same is available here.