diff options
author | Mike Kazantsev <mk.fraggod@gmail.com> | 2018-06-30 21:45:49 +0500 |
---|---|---|
committer | fraggod@malediction <mk.fraggod@gmail.com> | 2018-06-30 21:45:49 +0500 |
commit | f5a09d93c86c676cbce490cf670f95e6fe127c9f (patch) | |
tree | d9e69f97de9fc97979a5cb6ed8ddaf914d801774 | |
parent | b0b406189b96ba9b0773e1c40449a0f0c9abf95e (diff) |
* lisp/emms-player-mpv.el: use blocking ipc sockets as a workaround for emacs-26 issue #31901
Workaround is used for all future emacs versions, until known-working release
will be available. It can be bad for performance if mpv becomes unresponsive.
-rw-r--r-- | lisp/emms-player-mpv.el | 33 |
1 files changed, 22 insertions, 11 deletions
diff --git a/lisp/emms-player-mpv.el b/lisp/emms-player-mpv.el index 8c4aa66..1dc92d5 100644 --- a/lisp/emms-player-mpv.el +++ b/lisp/emms-player-mpv.el @@ -237,6 +237,12 @@ to indicate that playback should stop instead of switching to next track.") "Delay before issuing `emms-player-stopped' when mpv unexpectedly goes idle.") +(defvar emms-player-mpv-ipc-conn-emacs-26-workaround (> emacs-major-version 26) + "Non-nil to enable workaround for issue #31901 in emacs 26.0-26.1 and possibly later versions. +These seem to fail to call sentinel function for unix socket network processes +that were started with :nowait t, so blocking connections are used there instead.") + + ;; ----- helpers (defvar emms-player-mpv-debug nil @@ -447,17 +453,22 @@ MEDIA-ARGS are used instead of --idle, if specified." so it can be rescheduled further until function runs out of DELAYS values. Sets `emms-player-mpv-ipc-proc' value to resulting process on success." (emms-player-mpv-debug-msg "ipc: connect-delay %s" (car delays)) - (setq emms-player-mpv-ipc-proc - (make-network-process - :name "emms-player-mpv-ipc" - :family 'local - :service emms-player-mpv-ipc-socket - :nowait t - :coding '(utf-8 . utf-8) - :buffer (get-buffer-create emms-player-mpv-ipc-buffer) - :noquery t - :filter #'emms-player-mpv-ipc-filter - :sentinel #'emms-player-mpv-ipc-sentinel)) + (let ((use-nowait (not emms-player-mpv-ipc-conn-emacs-26-workaround))) + (setq emms-player-mpv-ipc-proc + (condition-case nil + (make-network-process + :name "emms-player-mpv-ipc" + :family 'local + :service emms-player-mpv-ipc-socket + :nowait use-nowait + :coding '(utf-8 . utf-8) + :buffer (get-buffer-create emms-player-mpv-ipc-buffer) + :noquery t + :filter #'emms-player-mpv-ipc-filter + :sentinel #'emms-player-mpv-ipc-sentinel) + (file-error nil))) + (when (and emms-player-mpv-ipc-proc (not use-nowait)) + (emms-player-mpv-ipc-sentinel emms-player-mpv-ipc-proc 'open))) (when (and (not emms-player-mpv-ipc-proc) delays) (run-at-time (car delays) |