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

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

[nongnu] elpa/subed 05ba952 320/389: Only add subtitles file if subed-su


From: ELPA Syncer
Subject: [nongnu] elpa/subed 05ba952 320/389: Only add subtitles file if subed-subtitle-id returns non-nil
Date: Fri, 3 Dec 2021 11:00:49 -0500 (EST)

branch: elpa/subed
commit 05ba952e5ac08dfd5280a6629ba557c89f603622
Author: Random User <rndusr@posteo.de>
Commit: Random User <rndusr@posteo.de>

    Only add subtitles file if subed-subtitle-id returns non-nil
---
 subed/subed-mpv.el | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/subed/subed-mpv.el b/subed/subed-mpv.el
index dfa8f1e..dbdd4bf 100644
--- a/subed/subed-mpv.el
+++ b/subed/subed-mpv.el
@@ -353,11 +353,16 @@ Video files are expected to have any of the extensions 
listed in
 
 (defun subed-mpv--add-subtitle-after-first-save ()
   "Tell mpv to load subtitles from `buffer-file-name'.
+
+Don't send the load command to mpv if `subed-subtitle-id' returns
+nil because that likely means the file is empty or invalid.
+
 This function is supposed to be added to `after-save-hook', and
 it removes itself from it so mpv doesn't add the same file every
 time the buffer is saved."
-  (subed-mpv-add-subtitles (buffer-file-name))
-  (remove-hook 'after-save-hook #'subed-mpv--add-subtitle-after-first-save 
:local))
+  (when (subed-subtitle-id)
+    (subed-mpv-add-subtitles (buffer-file-name))
+    (remove-hook 'after-save-hook #'subed-mpv--add-subtitle-after-first-save 
:local)))
 
 (defun subed-mpv-kill ()
   "Close connection to mpv process and kill the process."



reply via email to

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