[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH] emacs: Use socket instead of port.
From: |
Ludovic Courtès |
Subject: |
Re: [PATCH] emacs: Use socket instead of port. |
Date: |
Sat, 12 Dec 2015 19:07:02 +0100 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.5 (gnu/linux) |
Alex Kost <address@hidden> skribis:
> Currently, if you try to run a repl command (for example, "M-x
> guix-installed-packages") in a second Emacs instance, you'll get an
> unfriendly error. That's because `guix-default-port' is busy already
> (by another Guix REPL), so you either have to change it manually or use
> (setq guix-use-guile-server nil). So with the attached patch, a socket
> file with a generated name will be used instead of a port, which allows
> you to run as many Emacs instances with Guix REPLs as you want.
>
> Many thanks to Florian for the great idea!
That’s a good idea, indeed.
> 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.
It may be good to fix it upfront though. WDYT?
> From d12c0e0909491b5522cf08015c8dbd684d526d51 Mon Sep 17 00:00:00 2001
> From: Alex Kost <address@hidden>
> Date: Sat, 12 Dec 2015 11:23:03 +0300
> Subject: [PATCH] emacs: Use socket instead of port.
>
> Suggested by Florian Paul Schmidt.
>
> * emacs/guix-backend.el (guix-default-port): Remove.
> (guix-repl-socket-file-name-function, guix-repl-current-socket): New
> variables.
> (guix-repl-socket-file-name): New procedure.
> (guix-get-guile-program): Take socket as an optional argument.
> (guix-start-repl-maybe): Adjust accordingly.
Otherwise LGTM.
Thanks,
Ludo’.