guix-devel
[Top][All Lists]
Advanced

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

Re: [PATCH] emacs: Use socket instead of port.


From: Alex Kost
Subject: Re: [PATCH] emacs: Use socket instead of port.
Date: Tue, 15 Dec 2015 12:33:45 +0300
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.5 (gnu/linux)

Ludovic Courtès (2015-12-12 21:07 +0300) wrote:

> Alex Kost <address@hidden> skribis:
>
>> There is one small thing though: Guile does not remove socket file after
>> exiting from "guile --listen=/tmp/foo" so these dead sockets will stay in
>> /tmp dir.  As there is no `comint-exit-hook' or alike, I don't see how a
>> socket file can be removed after the REPL is killed.
>
> You could maybe arrange to have Guile run something like:
>
>   (dynamic-wind
>     (const #t)
>     (lambda ()
>       (start-repl))  ;start a new REPL
>     (lambda ()
>       (false-if-exception (delete-file "/tmp/foo"))))
>
> Not perfect, but I don’t have a better idea.

Hm, but it doesn't delete the socket after the quit, right?  At least,
it doesn't when I tried "guile -l /tmp/repl-server.scm" with the
following "/tmp/repl-server.scm":

(use-modules (system repl server))

(let ((socket "/tmp/s1"))
  (call-with-new-thread
   (lambda ()
     (dynamic-wind
       (const #t)
       (lambda ()
         (run-server (make-unix-domain-server-socket #:path socket)))
       (lambda ()
         (false-if-exception (delete-file socket)))))))
And after ",q" the file "/tmp/s1" stayed.

> It may be good to fix it upfront though.  WDYT?

Sorry, I don't understand.  Do you mean to fix it "upstream" — i.e., in
guile?  If so, I agree as it sounds natural to me if guile will delete a
socket file it created.

Anyway, as I mentioned in the reply to Florian, I think the best would
be to add a procedure for deleting socket file to `kill-emacs-hook' (as
in the attached updated patch).  This should prevent appearing dead
sockets.

P.S.  Maybe it's a wrong impression, but it looks (to me) that
connecting to a socket is significantly faster than using a port (so all
this Guix REPL stuff starts faster).

Attachment: 0001-emacs-Use-socket-instead-of-port.patch
Description: Text Data


reply via email to

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