Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

I am using Linux Fedora 13 (Constantine) and emacs 23.1.1. I am trying to set up a .emacs file for initialization, by using emacs itself to edit and save a file .emacs in my home directory. However, although the file is there, emacs does not seem to recognize it. What might I be doing wrong, and is there a simple text for .emacs that will show me if it is being used, one that will display a message on emacs start up?

share|improve this question
add comment

migrated from programmers.stackexchange.com Apr 9 '12 at 22:34

This question came from our site for professional programmers interested in conceptual questions about software development.

3 Answers

The init file is traditionally ~/.emacs, but modern versions also look at other names. There may be confusion about what your home directory is (there shouldn't be on unix platforms, though; this is mostly a problem under Windows); opening ~/.emacs inside Emacs is always right. After Emacs has started, check for messages in the *Messages* buffer. Make sure you're not running Emacs with options like -q that would tell it to bypass your init file.

share|improve this answer
add comment

You probably have an error in your .emacs file in your home directory. Try opening your .emacs file and then M-x eval-buffer RET to check if you see if you get any errors you might have missed. Emacs will run the .emacs file in any case.

share|improve this answer
add comment

If you put something illegal at the start of the .emacs file and emacs really is reading it, I would expect it to fail on startup. For example if I put a line containing

Hello William

at the first line of my .emacs the program gives me the warning

Symbol's value as variable is void: Hello

and fails to load the remainder of the file.

You could use strace (or the Fedora equivalent, perhaps truss, dtruss etc) to trace the system calls and look for where emacs tries to open .emacs in the output. For example under the bash shell:

strace emacs 2> strace-ouput.txt 
share|improve this answer
add comment

Your Answer

 
discard

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