[OS X Emacs] init file not being read

xah lee xah at xahlee.org
Tue Dec 25 20:11:43 EST 2007


don't really know what could be the prob, but here's something to try...

backup your .emacs, then replace its content by some random text.  
This way, if emacs loads it, you'll know for sure because it'll  
complaint syntax error.

also, try to start emacs in terminal with the apple default “/usr/ 
bin/emacs”. This will reduce more variables. (i.e. as opposed to  
using os x's “open” command or launch from gui )

also, try
  --no-site-file -no-init-file -nw -u «someUserName»

the user name can be yours, or try somebody else's. (put the random  
file there.) The “-nw” is no gui window mode.

also, do “echo $HOME” on your shell to see what's your home path  
set to. Sometimes i forgot i'm root... The shell command “id” will  
tell you who you currently are.

and, did you upgrade OS X recently? or any utility you installed,  
etc? You mentioned something in last few months... so maybe you  
haven't used emacs for a while?


Here's part of emacs manual that might help:

57.6.4 How Emacs Finds Your Init File
-------------------------------------

Normally Emacs uses the environment variable `HOME' (*note HOME:
General Variables.) to find `.emacs'; that's what `~' means in a file
name.  If `.emacs' is not found inside `~/' (nor `.emacs.el'), Emacs
looks for `~/.emacs.d/init.el' (which, like `~/.emacs.el', can be
byte-compiled).

    However, if you run Emacs from a shell started by `su', Emacs tries
to find your own `.emacs', not that of the user you are currently
pretending to be.  The idea is that you should get your own editor
customizations even if you are running as the super user.

    More precisely, Emacs first determines which user's init file to  
use.
It gets your user name from the environment variables `LOGNAME' and
`USER'; if neither of those exists, it uses effective user-ID.  If that
user name matches the real user-ID, then Emacs uses `HOME'; otherwise,
it looks up the home directory corresponding to that user name in the
system's data base of users.

   Xah
   xah at xahlee.orghttp://xahlee.org/


On Dec 25, 2007, at 2:24 PM, Roger Levy wrote:

Thanks for the thought -- indeed invoking emacs from the command line
with --no-site-file seems to result in exactly the same situation as
invoking it with no options, but I'm not sure how much insight that
gives me :(

Any other thoughts?

Thanks again for the help.

Roger

xah lee wrote:
> sorry i misread your original post.
>
> maybe try starting with --no-site-file, to see anything in side-wide
> init file reset your init file path. (also, you prob knew, -q or
> --no-init-file is for not loading personal init file.)
>
> um... but since you said the problem happens in aquamacs and carbon
> emacs too (presumably started from GUI, and each of these has their  
> own
> site wide file)... so maybe the problem is something not related to
> emacs, but rather with OS X...
>
>  Xah
>
>>
>> On Dec 24, 2007, at 5:19 PM, Roger Levy wrote:
>>
>> Some time in the last couple of months, my emacs stopped reading my
>> ~/.emacs init file at startup.  This affects Carbon Emacs,  
>> Aquamacs, and
>> emacs invoked from the terminal.  Does anyone have suggestions for  
>> where
>> I should start poking around to see what's wrong?
>>
>> Many thanks,
>>
>> Roger
-- 

Roger Levy                      Email: rlevy at ucsd.edu
Assistant Professor             Phone: 858-534-7219
Department of Linguistics       Fax:   858-534-4789
UC San Diego                    Web:   http://ling.ucsd.edu/~rlevy


More information about the MacOSX-Emacs mailing list