* lisp/mpc.el (mpc--proc-connect): Handle unix sockets (bug#19394)
This commit is contained in:
parent
66f5720d3a
commit
41d83c2e57
1 changed files with 9 additions and 1 deletions
10
lisp/mpc.el
10
lisp/mpc.el
|
@ -253,6 +253,7 @@ defaults to 6600 and HOST defaults to localhost."
|
||||||
|
|
||||||
(defun mpc--proc-connect (host)
|
(defun mpc--proc-connect (host)
|
||||||
(let ((port 6600)
|
(let ((port 6600)
|
||||||
|
local
|
||||||
pass)
|
pass)
|
||||||
|
|
||||||
(when (string-match "\\`\\(?:\\(.*\\)@\\)?\\(.*?\\)\\(?::\\(.*\\)\\)?\\'"
|
(when (string-match "\\`\\(?:\\(.*\\)@\\)?\\(.*?\\)\\(?::\\(.*\\)\\)?\\'"
|
||||||
|
@ -267,6 +268,8 @@ defaults to 6600 and HOST defaults to localhost."
|
||||||
(if (string-match "[^[:digit:]]" v)
|
(if (string-match "[^[:digit:]]" v)
|
||||||
(string-to-number v)
|
(string-to-number v)
|
||||||
v)))))
|
v)))))
|
||||||
|
(when (string-prefix-p "/" host) ;FIXME: Use file-name-absolute-p?
|
||||||
|
(setq local t))
|
||||||
|
|
||||||
(mpc--debug "Connecting to %s:%s..." host port)
|
(mpc--debug "Connecting to %s:%s..." host port)
|
||||||
(with-current-buffer (get-buffer-create (format " *mpc-%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)
|
(let* ((coding-system-for-read 'utf-8-unix)
|
||||||
(coding-system-for-write 'utf-8-unix)
|
(coding-system-for-write 'utf-8-unix)
|
||||||
(proc (condition-case err
|
(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))))))
|
(error (user-error (error-message-string err))))))
|
||||||
(when (processp mpc-proc)
|
(when (processp mpc-proc)
|
||||||
;; Inherit the properties of the previous connection.
|
;; Inherit the properties of the previous connection.
|
||||||
|
@ -2630,6 +2636,8 @@ This is used so that they can be compared with `eq', which is needed for
|
||||||
(interactive
|
(interactive
|
||||||
(progn
|
(progn
|
||||||
(if current-prefix-arg
|
(if current-prefix-arg
|
||||||
|
;; FIXME: We should provide some completion here, especially for the
|
||||||
|
;; case where the user specifies a local socket/file name.
|
||||||
(setq mpc-host (read-string "MPD host and port: " nil nil mpc-host)))
|
(setq mpc-host (read-string "MPD host and port: " nil nil mpc-host)))
|
||||||
nil))
|
nil))
|
||||||
(let* ((song-buf (mpc-songs-buf))
|
(let* ((song-buf (mpc-songs-buf))
|
||||||
|
|
Loading…
Add table
Reference in a new issue