1. Home
  2. Computing & Technology
  3. Linux

Find Init
Emacs Documentation

By Juergen Haas, About.com

How Emacs Finds Your Init File

Normally Emacs uses the environment variable HOME to find .emacs; that's what ~ means in a file name. But 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 the 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.

* Emacs Manual Index

Explore Linux
About.com Special Features

Stay connected and entertained with reviews on tips on the latest HDTVs, cellphones and more. More >

Easy ways to connect two computers for networking purposes. More >

  1. Home
  2. Computing & Technology
  3. Linux
  4. Linux Software
  5. Editors
  6. Emacs
  7. Emacs Documentation - Find Init

©2009 About.com, a part of The New York Times Company.

All rights reserved.