emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: The emacsclient socket vs. etc/emacs.bash


From: Andreas Schwab
Subject: Re: The emacsclient socket vs. etc/emacs.bash
Date: Fri, 15 Dec 2006 22:07:29 +0100
User-agent: Gnus/5.110006 (No Gnus v0.6) Emacs/22.0.91 (gnu/linux)

address@hidden (Kim F. Storm) writes:

> I typically have a "master emacs" instance running all the time.
> Sometimes I start another instance (e.g. in a terminal window)
> just to make some small change to a config file - and blammo - 
> the server is no longer associated with the master emacs.

I have this in my .emacs:

(when (and (file-exists-p (expand-file-name server-name server-socket-dir))
           (let ((status (call-process "/usr/bin/lsof"
                                       nil nil nil
                                       (expand-file-name server-name
                                                         server-socket-dir))))
             (or (not (numberp status)) (equal status 0))))
  (setq server-name (format "%s-%d" server-name (emacs-pid)))
  (add-hook 'kill-emacs-hook
    (lambda () (condition-case nil
                   (delete-file (expand-file-name server-name
                                                  server-socket-dir))
                 (error nil))))
  (setenv "EDITOR" (concat "emacsclient -s " server-name)))

I regularily have 2 or 3 instances of Emacs running, this way I can
control each of them as necessary.

Andreas.

-- 
Andreas Schwab, SuSE Labs, address@hidden
SuSE Linux Products GmbH, Maxfeldstraße 5, 90409 Nürnberg, Germany
PGP key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."




reply via email to

[Prev in Thread] Current Thread [Next in Thread]