emacs does not open a file from argument and syntax highlight does not work

In my latest ubuntu box,

  1. When I type for example emacs ~/.bashrc, Emacs will start but not open .bashrc. This is true for any file I pass in. I've used Emacs for several years, and have never experienced this problem before.

  2. I added (global-font-lock-mode 1);; to my .emacs file, and Emacs does recognize it, for example. "(C++/; Abbrev)", but it won't do syntax highlighting.

If you can solve any of these problems, it will be very appreciated. The following is my machine's configuration:

uname -a
Linux 2.6.35-28-generic-pae #49-Ubuntu SMP Tue Mar 1 14:58:06 UTC 2011 i686 GNU/Linux

~/.emacs
(global-font-lock-mode 1);;


I got the same problem. It was due to the fact I first used emacs with sudo. As a consequence the .emacs.d was created with super user right and I could not access it as a regular user.

By removing the .emacs.d created as root let emacs generate a new one with your user account.


You can have both ~/.emacs file and ~/.emacs.d/ directory, but Emacs will ignore ~/.emacs.d/init.el file. Emacs only evaluates ~/.emacs.d/init.el when there is no ~/.emacs. (Thanks, pyrocrasty).

See: The Emacs Initialization File @ GNU Emacs Manual.