Fix most of compilation errors when running on Emacs trunk.