On Mon, Dec 18, 2006 at 10:14:53AM +0100, Juanma Barranquero wrote: > On 12/18/06, Trent Buck <[EMAIL PROTECTED]> wrote: > > >I believe CVS Emacs is not correctly removing the socket file created > >by server-start (from server.el). > > It is on purpose. Note the following fragment from server.el: > > ;; Delete the associated connection file, if applicable. > ;; This is actually problematic: the file may have been overwritten by > ;; another Emacs server in the mean time, so it's not ours any more. > ;; (and (process-contact proc :server) > ;; (eq (process-status proc) 'closed) > ;; (ignore-errors (delete-file (process-get proc :server-file))))
I see. In my .emacs, I change `server-name' to be process-specific, and create a symlink to the "generic" name: ;;; Say I run "bzr commit" in a normal shell, outside of emacs. I ;;; want that to start up a full Emacs. If it used emacsclient, then ;;; buffer would show up on some random Emacs process in some GNU ;;; Screen window, and I'd have to hunt it down. ;;; ;;; HOWEVER, if I run M-x shell in Emacs, and I run "bzr commit" in ;;; THERE, I want it to talk to the parent Emacs process (via ;;; emacsclient). ;;; ;;; Since I occasionally have multiple Emacs processes running, I need ;;; to change server-name to be process-specific, so the Emacs ;;; processes' server-starts won't clobber one another's sockets. (setq server-name (format "server%d" (emacs-pid))) (let ((x (format "emacsclient -s %s" server-name))) (setenv "VISUAL" x) (setenv "EDITOR" x)) (server-start) ;; emacsclient(1) looks for a socket named "server" by default. We ;; symlink to this file, so that running emacsclient manually from the ;; command line will use the more recently opened Emacs. ;; ;; We don't bother doing this for Emacs 21 because the socket dir is ;; too difficult to deduce. (when (= emacs-major-version 22) (make-symbolic-link server-name (concat server-socket-dir "/server") t)) Is this a sensible approach to adopt as default in CVS Emacs, or would it have problems for e.g. DOS users (who have no symbolic links)? If this approach was adopted, `server-sentinel' could happily remove it's socket file, leaving a broken symlink instead of a defunct socket. -- Trent Buck, Student Errant
signature.asc
Description: Digital signature
_______________________________________________ emacs-pretest-bug mailing list emacs-pretest-bug@gnu.org http://lists.gnu.org/mailman/listinfo/emacs-pretest-bug