Re: CVS Emacs fails to remove server.el socket on exit

2006-12-18 Thread Trent Buck
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


Re: CVS Emacs fails to remove server.el socket on exit

2006-12-18 Thread Stefan Monnier
> I believe CVS Emacs is not correctly removing the socket file created
> by server-start (from server.el).

This is not specific to Emacs-CVS.  Emacs-21, Emacs-20, and Emacs-19 did
the same, AFAIK.


Stefan


___
emacs-pretest-bug mailing list
emacs-pretest-bug@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-pretest-bug


Re: CVS Emacs fails to remove server.el socket on exit

2006-12-18 Thread Juanma Barranquero

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

   /L/e/k/t/u


___
emacs-pretest-bug mailing list
emacs-pretest-bug@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-pretest-bug


CVS Emacs fails to remove server.el socket on exit

2006-12-17 Thread Trent Buck
I believe CVS Emacs is not correctly removing the socket file created
by server-start (from server.el).  The following transcript
demonstrates the issue:

$ ls /tmp/emacs$UID
ls: /tmp/emacs1000: No such file or directory

$ emacs -q --no-site-file -f server-start -f save-buffers-kill-emacs

$ ls /tmp/emacs$UID
ls: /tmp/emacs1000: No such file or directory

$ emacs-snapshot -q --no-site-file -f server-start -f 
save-buffers-kill-emacs

$ ls /tmp/emacs$UID
server

In GNU Emacs 22.0.91.1 (i486-pc-linux-gnu, X toolkit, Xaw3d scroll bars)
 of 2006-12-13 on rocinante, modified by Debian
 (Debian emacs-snapshot package, version 1:20061201-1)
configured using `configure  '--build' 'i486-linux-gnu' '--host' 
'i486-linux-gnu' '--prefix=/usr' '--sharedstatedir=/var/lib' 
'--libexecdir=/usr/lib' '--localstatedir=/var' '--infodir=/usr/share/info' 
'--mandir=/usr/share/man' '--with-pop=yes' 
'--enable-locallisppath=/etc/emacs-snapshot:/etc/emacs:/usr/local/share/emacs/22.0.91/site-lisp:/usr/local/share/emacs/site-lisp:/usr/share/emacs/22.0.91/site-lisp:/usr/share/emacs/site-lisp:/usr/share/emacs/22.0.91/leim'
 '--with-x=yes' '--with-x-toolkit=athena' '--with-toolkit-scroll-bars' 
'build_alias=i486-linux-gnu' 'host_alias=i486-linux-gnu' 'CFLAGS=-DDEBIAN 
-DSITELOAD_PURESIZE_EXTRA=5000 -g -O2''
-- 
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