[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Editing different files in the same emacs
From: |
Jim McCloskey |
Subject: |
Re: Editing different files in the same emacs |
Date: |
Sun, 10 Jun 2001 11:08:48 -0700 |
|> Every time I type "emacs <file> &" in my bash shell a
|> new emacs window appears . Is there a way to open a
|> new file as a new buffer instead of a opening a new
|> emacs?. I know a possibility is just to open that file
|> pressing C-x C-f, but I use a interpreter which, each
|> time an error is found in a script it opens a new
|> emacs window instead of going to the one is already
|> open.
|>
|> Ive heard the existance of a thing called gnuclient
|> and emacsclient. How do they work? Can they help me?
You can start emacsclient from within emacs with the command
M-x server-start.
(or add the expression `server-start' to your .emacs to start it
automatically). Emacsclient listens for calls from other programs to
use an already-running emacs as editor, and tells that already-running
emacs session to visit a file whose name is specified in the call from
the other program.
So that part (setting up the `server' on the emacs side) is very easy.
To get other programs to use emacsclient, it is often enough to set
the environment variable EDITOR to `emacsclient' (say in .bash_profile
if you use bash). A lot of programs will let you set a more specific
environment variable. Mutt, for instance, allows you to:
set editor=emacsclient
in .muttrc so that it will always call a running emacs as its editor.
When you've finished editing the file, the command Ctl-x # saves the
changes and sends a message back to emacsclient to exit. The
cooperating program waits for emacsclient to exit.
You can find full documentation in `Using Emacs as a Server' in the
Info system,
Jim