unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Mark Oteiza <mvoteiza@udel.edu>
To: 19394@debbugs.gnu.org
Subject: bug#19394: 25.0.50; mpc does not handle MPD_HOST=socket
Date: Sun, 02 Aug 2015 14:36:37 -0400	[thread overview]
Message-ID: <874mkhr0zu.fsf@udel.edu> (raw)
In-Reply-To: <87y4q7wkdc.fsf@udel.edu> (Mark Oteiza's message of "Tue, 16 Dec 2014 12:54:39 -0500")

[-- Attachment #1: Type: text/plain, Size: 1333 bytes --]

Mark Oteiza <mvoteiza@udel.edu> writes:

> mpc.el treats MPD_HOST only as an address or hostname, when it can also
> be a socket. So, doing ‘M-x mpc RET’ here gives
>
>     /run/user/1000/mpd/socket/6600 Name or service not known
>
>>From the mpd manual:
>
>     bind_to_address <ip address or hostname or any>
>            This specifies which address mpd binds to and listens on.
>            Multiple bind_to_address parameters may be specified.  The
>            default is "any", which binds to all available addresses.
>
>            You can set a port that is different from the global port
>            setting, e.g.  "localhost:6602".  IPv6 addresses must be
>            enclosed in square brackets if you want to configure a
>            port, e.g. "[::1]:6602".
>
>            To bind to a Unix domain socket, specify an absolute path
>            or a path starting with a tilde (~).  For a system-wide
>            MPD, we suggest the path "/var/run/mpd/socket".
>
> ‘bind_to_address’ is the mpd config option corresponding to MPD_HOST.

Here's a patch for handling the MPD_HOST being a socket.  I don't really
get the wording "or a path starting with a tilde (~)." because no mpd
clients that I have (mpc, ncmpcpp) actually do tilde expansion
themselves, so I ignored that case.


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-mpc.el-mpc-proc-connect-attempt-socket-connection-if.patch --]
[-- Type: text/x-diff, Size: 1221 bytes --]

From 706b3c005aac0d3b606b4265c315bdd3bc6d1a5a Mon Sep 17 00:00:00 2001
From: Mark Oteiza <mvoteiza@udel.edu>
Date: Sat, 1 Aug 2015 00:46:02 -0400
Subject: [PATCH] mpc.el (mpc--proc-connect): attempt socket connection if host
 is an absolute path (Bug#19394)

---
 lisp/mpc.el | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/lisp/mpc.el b/lisp/mpc.el
index 76c08db..4d04cf8 100644
--- a/lisp/mpc.el
+++ b/lisp/mpc.el
@@ -279,7 +279,10 @@ defaults to 6600 and HOST defaults to localhost."
       (let* ((coding-system-for-read 'utf-8-unix)
              (coding-system-for-write 'utf-8-unix)
              (proc (condition-case err
-                       (open-network-stream "MPC" (current-buffer) host port)
+                       (make-network-process :name "MPC" :buffer (current-buffer)
+                                             :host host :service port
+                                             :remote (if (string-prefix-p "/" host)
+                                                         host))
                      (error (user-error (error-message-string err))))))
         (when (processp mpc-proc)
           ;; Inherit the properties of the previous connection.
-- 
2.5.0


  reply	other threads:[~2015-08-02 18:36 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-12-16 17:54 bug#19394: 25.0.50; mpc does not handle MPD_HOST=socket Mark Oteiza
2015-08-02 18:36 ` Mark Oteiza [this message]
2015-08-02 19:09   ` Eli Zaretskii
2015-08-02 21:47     ` Mark Oteiza
     [not found]       ` <8737z4hcmi.fsf@udel.edu>
2015-09-02 17:29         ` Mark Oteiza
2015-09-03 15:47           ` Stefan Monnier

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://www.gnu.org/software/emacs/

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

  git send-email \
    --in-reply-to=874mkhr0zu.fsf@udel.edu \
    --to=mvoteiza@udel.edu \
    --cc=19394@debbugs.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/emacs.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).