diff options
| author | Mark Oteiza | 2015-09-03 11:47:31 -0400 |
|---|---|---|
| committer | Stefan Monnier | 2015-09-03 11:47:31 -0400 |
| commit | 41d83c2e577998b279e808115da2892b26d16526 (patch) | |
| tree | 72dd70c1854148fcc3437512e49a80872e7201a3 | |
| parent | 66f5720d3ad1fc564d0e218822620866dc29c6f9 (diff) | |
| download | emacs-41d83c2e577998b279e808115da2892b26d16526.tar.gz emacs-41d83c2e577998b279e808115da2892b26d16526.zip | |
* lisp/mpc.el (mpc--proc-connect): Handle unix sockets (bug#19394)
| -rw-r--r-- | lisp/mpc.el | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/lisp/mpc.el b/lisp/mpc.el index 59581f3d687..fdc5aee3774 100644 --- a/lisp/mpc.el +++ b/lisp/mpc.el | |||
| @@ -253,6 +253,7 @@ defaults to 6600 and HOST defaults to localhost." | |||
| 253 | 253 | ||
| 254 | (defun mpc--proc-connect (host) | 254 | (defun mpc--proc-connect (host) |
| 255 | (let ((port 6600) | 255 | (let ((port 6600) |
| 256 | local | ||
| 256 | pass) | 257 | pass) |
| 257 | 258 | ||
| 258 | (when (string-match "\\`\\(?:\\(.*\\)@\\)?\\(.*?\\)\\(?::\\(.*\\)\\)?\\'" | 259 | (when (string-match "\\`\\(?:\\(.*\\)@\\)?\\(.*?\\)\\(?::\\(.*\\)\\)?\\'" |
| @@ -267,6 +268,8 @@ defaults to 6600 and HOST defaults to localhost." | |||
| 267 | (if (string-match "[^[:digit:]]" v) | 268 | (if (string-match "[^[:digit:]]" v) |
| 268 | (string-to-number v) | 269 | (string-to-number v) |
| 269 | v))))) | 270 | v))))) |
| 271 | (when (string-prefix-p "/" host) ;FIXME: Use file-name-absolute-p? | ||
| 272 | (setq local t)) | ||
| 270 | 273 | ||
| 271 | (mpc--debug "Connecting to %s:%s..." host port) | 274 | (mpc--debug "Connecting to %s:%s..." host port) |
| 272 | (with-current-buffer (get-buffer-create (format " *mpc-%s:%s*" host port)) | 275 | (with-current-buffer (get-buffer-create (format " *mpc-%s:%s*" host port)) |
| @@ -279,7 +282,10 @@ defaults to 6600 and HOST defaults to localhost." | |||
| 279 | (let* ((coding-system-for-read 'utf-8-unix) | 282 | (let* ((coding-system-for-read 'utf-8-unix) |
| 280 | (coding-system-for-write 'utf-8-unix) | 283 | (coding-system-for-write 'utf-8-unix) |
| 281 | (proc (condition-case err | 284 | (proc (condition-case err |
| 282 | (open-network-stream "MPC" (current-buffer) host port) | 285 | (make-network-process :name "MPC" :buffer (current-buffer) |
| 286 | :host (unless local host) | ||
| 287 | :service (if local host port) | ||
| 288 | :family (if local 'local)) | ||
| 283 | (error (user-error (error-message-string err)))))) | 289 | (error (user-error (error-message-string err)))))) |
| 284 | (when (processp mpc-proc) | 290 | (when (processp mpc-proc) |
| 285 | ;; Inherit the properties of the previous connection. | 291 | ;; 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 | |||
| 2630 | (interactive | 2636 | (interactive |
| 2631 | (progn | 2637 | (progn |
| 2632 | (if current-prefix-arg | 2638 | (if current-prefix-arg |
| 2639 | ;; FIXME: We should provide some completion here, especially for the | ||
| 2640 | ;; case where the user specifies a local socket/file name. | ||
| 2633 | (setq mpc-host (read-string "MPD host and port: " nil nil mpc-host))) | 2641 | (setq mpc-host (read-string "MPD host and port: " nil nil mpc-host))) |
| 2634 | nil)) | 2642 | nil)) |
| 2635 | (let* ((song-buf (mpc-songs-buf)) | 2643 | (let* ((song-buf (mpc-songs-buf)) |