Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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

(global-font-lock-mode 1);;

share|improve this question

migrated from Mar 27 '11 at 8:13

This question came from our site for professional and enthusiast programmers.

Better asked on – Oded Mar 26 '11 at 21:22
What happens if you start emacs then use C-x C-f to open ~/.bashrc? Might give you a useful error message. – Tom Zych Mar 26 '11 at 21:27
Does the *Messages* buffer contain anything useful? – MatthewD Mar 27 '11 at 2:35
hi thanks a lot, it seems it is caused by the directory ~/.emacs.d, emacs actually complains upon startup :"~/.emacs.d already exists". So I removed ~/.emacs.d, and now everything works! (I can open files through command line argument and syntax highlighting also works now). @Tom, previously I can start emacs, and then use C-x C-f to open .bashrc, but cannot open by > emacs ~/.bashrc – Jus Mar 27 '11 at 5:13

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.

share|improve this answer
or you can simply change owner sudo chown -hR <groupname>:<username> .emacs.d/ – logcat Aug 5 '13 at 6:11
Yep, this fixed the problem. It'd be great if emacs showed some information about this error... – José Tomás Tocino May 1 '14 at 15:03

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.

share|improve this answer
That's not true at all. I used a ~/.emacs file for years and I certainly always had a ~/.emacs.d/ directory. There won't be any conflict unless you have a ~/.emacs file and a ~/.emacs.d/init.el file at the same time, and even then, Emacs will just ignore one (I believe it prioritizes ~/.emacs). – pyrocrasty May 16 '15 at 17:27
If you correct an error, in the future please don't strike it out, but just remove it entirely. Thanks. I left the comment stay so you can actually tell its posted that you corrected your answer. (They may upvote you or undo a downvote.) – slhck May 16 '15 at 17:44
@pyrocrasty, thanks, I edited the answer – Mirzhan Irkegulov May 16 '15 at 17:46

initial-buffer-choice in startup.el allows initial file customization.

share|improve this answer
perhaps some context would be helpful. An example config? – JoshP Sep 28 '12 at 14:34

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.