-
Notifications
You must be signed in to change notification settings - Fork 6
Open
Description
My first thought was to allow port be nil which would indicate a unix domain socket via (make-network-process :service (expand-file-name host) :family 'local :name "mpd"), but this would most likely not work in all situations; chiefly, when MPD_HOST is set to a file path, and somehow MPD_PORT is set as well, other MPD clients will correctly connect to the unix socket, despite the port being set as an env variable. (Tested with mpc, ncmpc, ncmpcc.)
So maybe the best route will be to test if host is a path (look for the filesystem's path separator) and simply ignore port if a path separator one exists in host.
Below is a PoC patch which I found to be in the right direction, but not really suitable as per what I stated above:
diff --git a/libmpdee.el b/libmpdee.el
index 86158f6..f9a1763 100644
--- a/libmpdee.el
+++ b/libmpdee.el
@@ -479,7 +479,7 @@ before giving up waiting for a reply from the server. Unspecified or zero
TIMEOUT correspond to infinite timeout. Set automatic mode if NOAUTO is nil,
hooked automatic function if NOAUTO is a function, and do not set automatic mode
otherwise. See `mpd-set-automatic-mode' for a description of automatic mode."
- (or (and (stringp host) (wholenump port) (or (not timeout) (numberp timeout)))
+ (or (and (stringp host) (or (wholenump port) (not port)) (or (not timeout) (numberp timeout)))
(error "Invalid parameters passed for making new connection"))
(and timeout
(if (= timeout 0)
@@ -502,7 +502,9 @@ function doesn't need to be explicitly called when the connection is in
automatic mode (the default). Close the connection using `mpd-close-connection'
when you are done."
(let (proc rt welc)
- (setq proc (or (open-network-stream "mpd" nil (_mpdgh) (_mpdgp))
+ (setq proc (or (if (_mpdgp)
+ (open-network-stream "mpd" nil (_mpdgh) (_mpdgp))
+ (make-network-process :name "mpd" :service (expand-file-name (_mpdgh)) :family 'local))
(error "Unable to open connection with mpd")))
(and (_mpdgo) (delete-process (_mpdgo)))
(_mpdso proc)
Any ideas?
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels