[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#19394: 25.0.50; mpc does not handle MPD_HOST=socket
From: |
Mark Oteiza |
Subject: |
bug#19394: 25.0.50; mpc does not handle MPD_HOST=socket |
Date: |
Wed, 2 Sep 2015 13:29:24 -0400 |
User-agent: |
Mutt/1.5.24+3 (62730ecbc17d) (2015-08-30) |
Mark Oteiza <mvoteiza@udel.edu> writes:
> Eli Zaretskii <eliz@gnu.org> writes:
>
>>> From: Mark Oteiza <mvoteiza@udel.edu>
>>> Date: Sun, 02 Aug 2015 14:36:37 -0400
>>>
>>> Here's a patch for handling the MPD_HOST being a socket.
>>
>> Thanks.
>>
>>> + :remote (if (string-prefix-p
>>> "/" host)
>>> + host))
>>
>> This looks wrong to me, the proper test for a remote file name is
>> file-remote-p (if this is what you want to test here).
>
> Yeah you're right, I was abusing this wording for :remote
>
> When specified for a client process, the FAMILY, HOST, and SERVICE
> args are ignored.
>
> when I should have been using :family and :service together. This should
> be better:
>
>>From 83d7ef4cc27580248c6584d2f141afa50624c951 Mon Sep 17 00:00:00 2001
> From: Mark Oteiza <mvoteiza@udel.edu>
> Date: Sun, 2 Aug 2015 17:44:27 -0400
> Subject: [PATCH] mpc.el (mpc--proc-connect): support UNIX addresses
> (Bug#19394)
>
> ---
> lisp/mpc.el | 8 +++++++-
> 1 file changed, 7 insertions(+), 1 deletion(-)
>
> diff --git a/lisp/mpc.el b/lisp/mpc.el
> index 76c08db..396e067 100644
> --- a/lisp/mpc.el
> +++ b/lisp/mpc.el
> @@ -253,6 +253,7 @@ defaults to 6600 and HOST defaults to localhost."
>
> (defun mpc--proc-connect (host)
> (let ((port 6600)
> + local
> pass)
>
> (when (string-match "\\`\\(?:\\(.*\\)@\\)?\\(.*?\\)\\(?::\\(.*\\)\\)?\\'"
> @@ -267,6 +268,8 @@ defaults to 6600 and HOST defaults to localhost."
> (if (string-match "[^[:digit:]]" v)
> (string-to-number v)
> v)))))
> + (when (string-prefix-p "/" host)
> + (setq local t))
>
> (mpc--debug "Connecting to %s:%s..." host port)
> (with-current-buffer (get-buffer-create (format " *mpc-%s:%s*" host
> port))
> @@ -279,7 +282,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 (unless local host)
> + :service (if local host port)
> + :family (if local 'local))
> (error (user-error (error-message-string err))))))
> (when (processp mpc-proc)
> ;; Inherit the properties of the previous connection.
I've been rolling with this patch for a while and have tested with mpd
configured for socket and for port. Could this please be applied?
- bug#19394: 25.0.50; mpc does not handle MPD_HOST=socket,
Mark Oteiza <=