~:: kalyan ::~

May 16, 2008

emacs save all modified files

Filed under: emacs, open-source — Tags: — skalyanasundaram @ 10:43 pm

Few time I got bugged up with the situation where I forgot to save the buffer and trying to blame make, automake tools. It would be nice if there is some function which saves all modified buffers like “Save All” from any IDEs.

I was trying something like this

(setq var (buffer-list))
(unless (null var)
(string-match “.+.[ch].*” (buffer-name (car var)))
(save-buffer (car var))
(setq var (cdr var)))

ofcourse did not work with the last argument of string-match. Latter found save-buffer only saves current buffer and does not take buffer as argument. But which leads me to find save-some-buffers, and this what I was trying to write my own. :-/

save-some-buffers C-x s , saves all modified buffers which are all associated with files. It also ask for many questions. The beauty is if you dont remember what changes have been made in the buffer you can make a diff between the file and the buffer like the below. Review each hunk with M-n

***************
*** 19,25 ****

#include <config.h>

! #include <ctype.h>
#include <stdlib.h>
#include <string.h>
//Test
— 19,25 —-

#include <config.h>

! #kalyaninclude <ctype.h>
#include <stdlib.h>
#include <string.h>
//Test

Diff finished. Fri Jan 18 10:25:55 2008
There is an another option C-r which takes us to the modified buffer too.

Yet another nice feature 🙂

NetBeans supports emacs key bindings!!

Filed under: emacs, open-source — Tags: — skalyanasundaram @ 8:21 pm

I am working on DHCP JavaConsole recently. I though will give a try in NetBeans and I need to work on jdk1.4. Finally got NetBeans 5.0 which is compatible with jdk1.4. Surprisingly NetBeans supports the emacs key bindings. Tools=>Options in the option dialog the keybinding option need to be selected. It is satisfactory. But sometime I am getting confused with the key bindings like M-C-n M-C-p.. It would be good if NetBeans could understand .el files. So that I can customize for my own need. 😉

Create a free website or blog at WordPress.com.