unofficial mirror of guix-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: ludo@gnu.org (Ludovic Courtès)
To: Alex Kost <alezost@gmail.com>
Cc: guix-devel@gnu.org
Subject: Re: [PATCH] emacs: Use socket instead of port.
Date: Sat, 12 Dec 2015 19:07:02 +0100	[thread overview]
Message-ID: <87poybzgl5.fsf@gnu.org> (raw)
In-Reply-To: <87y4d08304.fsf@gmail.com> (Alex Kost's message of "Sat, 12 Dec 2015 11:50:19 +0300")

Alex Kost <alezost@gmail.com> 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 <alezost@gmail.com>
> 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’.

  parent reply	other threads:[~2015-12-12 18:07 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-12-12  8:50 [PATCH] emacs: Use socket instead of port Alex Kost
2015-12-12  9:00 ` Florian Paul Schmidt
2015-12-15  9:33   ` Alex Kost
2015-12-12 18:07 ` Ludovic Courtès [this message]
2015-12-15  9:33   ` Alex Kost
2015-12-15 11:13     ` Ludovic Courtès
2015-12-15 18:39       ` Alex Kost

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://guix.gnu.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87poybzgl5.fsf@gnu.org \
    --to=ludo@gnu.org \
    --cc=alezost@gmail.com \
    --cc=guix-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).