How do I get my cocoa emacs on Mac OS X to load my .emacs visual customizations for new windows (any document opened after the first)?

1

So I just downloaded emacs 23.1 for my new snow leopard macbook pro from http://emacsformacosx.com/ and it works like a charm, except...

I have visual customizations in my .emacs, a few lines are extracted here:

(set-background-color "black")
(set-cursor-color "green") (set-default-font "--Lucida Console-normal-r-normal-normal-18--96-96-c-*-iso10646-1")

I also have some key bindings set up, here are a few lines of those

(global-set-key "\C-l" `goto-line)

(global-set-key [(control ?%)] `query-replace-regexp)

The first time I start emacs or open a document with emacs, everything loads perfectly. When I issue a command-N or open another file through finder, a new window opens with the key binding customizations loaded but without the visual customizations (including window size, etc)

I think this has something to do with how emacsclient is being invoked and the emacs server, but despite my avid usage of emacs for development, I'm pretty clueless when it comes to setting up the editor itself outside of .emacs level customization

Here are potential behaviors I would like to achieve when a new window is opened (via command-n or opening a document in finder), in order of preference:

  1. Have the new window create a new emacs process (not just a new buffer) so that I can manage and navigate multiple projects similar to how textmate does it, using one emacs process for each project.

  2. Have those visual customizations be persistent so that each new window loads with the correct sizing, fonts, and colors.

  3. Have each new document open as a buffer within the current active emacs window.

Let me know if you guys can help, thanks!

NeilSarkar

Posted 2009-12-15T19:20:55.600

Reputation: 111

Answers

0

OK I figured out how to do this (start a new emacs server for each new file opened and manage your projects that way) from the terminal, I'm sure it would be trivial to get it working from the finder too but since I'm usually in terminal anyway it works for me.

You just add this to your ~/.profile

function emacs-open() {
    /Applications/Emacs.app/Contents/MacOS/Emacs $1 &
}

then when you want to open a file in a new project (emacs server) with all ur frame customizations and .emacs loaded correctly, it's just

$ emacs-open index.php

I know this may seem really obvious to some, but as far as i could tell it's not done for you anywhere when u dl the package from http://emacsformacosx.com/ so hopefully this helps somebody

NeilSarkar

Posted 2009-12-15T19:20:55.600

Reputation: 111