From mboxrd@z Thu Jan 1 00:00:00 1970 From: ludo@gnu.org (Ludovic =?utf-8?Q?Court=C3=A8s?=) Subject: Re: [PATCH] emacs: Use socket instead of port. Date: Sat, 12 Dec 2015 19:07:02 +0100 Message-ID: <87poybzgl5.fsf@gnu.org> References: <87y4d08304.fsf@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:59550) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1a7oZY-0005m0-Cp for guix-devel@gnu.org; Sat, 12 Dec 2015 13:07:09 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1a7oZV-0006a8-6B for guix-devel@gnu.org; Sat, 12 Dec 2015 13:07:08 -0500 In-Reply-To: <87y4d08304.fsf@gmail.com> (Alex Kost's message of "Sat, 12 Dec 2015 11:50:19 +0300") List-Id: "Development of GNU Guix and the GNU System distribution." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-devel-bounces+gcggd-guix-devel=m.gmane.org@gnu.org Sender: guix-devel-bounces+gcggd-guix-devel=m.gmane.org@gnu.org To: Alex Kost Cc: guix-devel@gnu.org Alex Kost 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=E2=80=99s a good idea, indeed. > There is one small thing though: Guile does not remove socket file after > exiting from "guile --listen=3D/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=E2=80=99t 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 > 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=E2=80=99.