emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[nongnu] elpa/mpv 899559ae77 04/50: some fixes


From: ELPA Syncer
Subject: [nongnu] elpa/mpv 899559ae77 04/50: some fixes
Date: Tue, 28 Dec 2021 00:58:34 -0500 (EST)

branch: elpa/mpv
commit 899559ae77a4ead96358b5845cb39f1c471566f5
Author: Johann Klähn <kljohann@gmail.com>
Commit: Johann Klähn <kljohann@gmail.com>

    some fixes
---
 mpv-mode.el | 24 ++++++++++++++----------
 1 file changed, 14 insertions(+), 10 deletions(-)

diff --git a/mpv-mode.el b/mpv-mode.el
index 9e9276af88..02ce91de57 100644
--- a/mpv-mode.el
+++ b/mpv-mode.el
@@ -44,11 +44,12 @@
   (and -process (eq (process-status -process) 'run)))
 
 (defun -start (&rest args)
-  (-kill)
+  (kill)
   (let ((socket (make-temp-name
                  (expand-file-name "mpv-mode-" temporary-file-directory))))
     (setq -process
           (apply #'start-process "mpv-player" nil executable
+                 "--no-terminal"
                  (concat "--input-unix-socket=" socket) args))
     (set-process-query-on-exit-flag -process nil)
     (while (and (-alive-p) (not (file-exists-p socket)))
@@ -63,11 +64,13 @@
        (-tq-filter -queue string)))
     t))
 
-(defun -kill ()
-  (when (-alive-p)
-    (kill-process -process))
+(defun kill ()
+  "Kill the mpv process."
+  (interactive)
   (when -queue
     (tq-close -queue))
+  (when (-alive-p)
+    (kill-process -process))
   (setq -process nil)
   (setq -queue nil))
 
@@ -80,12 +83,13 @@ the process has finished replying to any previous questions.
 This produces more reliable results with some processes.
 
 Note that we do not use the regexp and closure arguments of
-`-tq-enque', see our custom implementation of `tq-process-buffer'
+`tq-enqueue', see our custom implementation of `tq-process-buffer'
 below."
-  (tq-enqueue
-   -queue
-   (concat (json-encode `((command . ,command))) "\n")
-   "" nil fn delay-command))
+  (when (-alive-p)
+    (tq-enqueue
+     -queue
+     (concat (json-encode `((command . ,command))) "\n")
+     "" nil fn delay-command)))
 
 (defun -tq-filter (tq string)
   (let ((buffer (tq-buffer tq)))
@@ -107,7 +111,7 @@ drops unsolicited event messages."
     ;; event messages have form {"event": ...}
     ;; answers have form {"error": ..., "data": ...}
     ;; FIXME: handle errors?
-    (unless (assoc 'event answer)
+    (unless (or (assoc 'event answer) (tq-queue-empty tq))
       (unwind-protect
           (condition-case nil
               (funcall (tq-queue-head-fn tq)



reply via email to

[Prev in Thread] Current Thread [Next in Thread]