Is there any way to autosave the buffer before issuing :make? I use MacVim and make is bound to Command-B, which is very helpful but I cannot seem to figure out how to write the buffer before a make. I looked at all the autocmd events and nothing seemed to fit.

There's a QuickFixCmdPre which should be called before a make but can't seem to get it to work:

~/.vimrc

function! AutoSaveOnMake ()
    if &modified
        write
    endif
endfunction

autocmd QuickFixCmdPre *.c :call AutoSaveOnMake()  
Edit
Report