开发者

Setting up .emacs file for mac ruby development

I am having a difficult time loading ruby-mode in emacs on my mac.

The .emacs file is located at ~/.emacs I've a开发者_运维技巧dded several commands to it (many pasted from this site) and none seem to get loaded. Any advise? I"m not sure if the file isn't loading or I have the command syntax wrong.

All I need is the following

  • 4 space indent (auto-intedent would be great as well)
  • ruby mode loaded for .rb files.

Thanks!


Put the line (warn "Loading .emacs") as the first line of .emacs. When you start emacs does it show you that message in a warning buffer? If so, it at least started loading the file.

If this does nothing, try opening the file in emacs, and running M-x eval-buffer.

Also, at startup, does the Messages buffer indicate any errors in your .emacs? This is the most common reason for a .emacs not to take effect.


This is how emacs finds the .emacs file.

57.6.4 How Emacs Finds Your Init File

Normally Emacs uses the environment variable HOME (see HOME) 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.

From http://www.gnu.org/software/emacs/manual/html_node/emacs/Find-Init.html#Find-Init

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜