[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/subed fcc1951 288/389: Add subed-mpv-file-loaded-hook
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/subed fcc1951 288/389: Add subed-mpv-file-loaded-hook |
Date: |
Fri, 3 Dec 2021 11:00:43 -0500 (EST) |
branch: elpa/subed
commit fcc19514280c01c73ed09bf1c9ece87ac7d7dabf
Author: Random User <rndusr@posteo.de>
Commit: Random User <rndusr@posteo.de>
Add subed-mpv-file-loaded-hook
---
subed/subed-mpv.el | 17 +++++++++++++----
1 file changed, 13 insertions(+), 4 deletions(-)
diff --git a/subed/subed-mpv.el b/subed/subed-mpv.el
index e4da997..f2484e2 100644
--- a/subed/subed-mpv.el
+++ b/subed/subed-mpv.el
@@ -50,6 +50,9 @@
(defvar-local subed-mpv-playback-position-hook nil
"Functions to call when mpv changes playback position.")
+(defvar-local subed-mpv-file-loaded-hook '(subed-mpv-jump-to-current-subtitle)
+ "Functions to call when mpv has loaded a file and starts playing.")
+
(defvar-local subed-mpv--server-proc nil
"Running mpv process.")
@@ -262,12 +265,18 @@ See \"List of events\" in mpv(1)."
(let ((pos-msecs (* 1000 (or (alist-get 'data json-data) 0))))
(setq subed-mpv-playback-position (round pos-msecs))
(run-hook-with-args 'subed-mpv-playback-position-hook
subed-mpv-playback-position))))
- ((or "unpause" "file-loaded")
+ ("file-loaded"
(setq subed-mpv-is-playing t)
- (subed-debug "Playing status changed: playing=%s" subed-mpv-is-playing))
+ ;; Because mpv can report the player position AFTER the file was loaded
+ ;; we disable automatic movement of point for a while so that the effect
+ ;; of `subed-mpv-jump-to-current-subtitle' isn't cancelled immediately.
+ (subed-disable-sync-point-to-player-temporarily)
+ (run-hooks 'subed-mpv-file-loaded-hook))
+ ("unpause"
+ (setq subed-mpv-is-playing t))
((or "pause" "end-file" "shutdown" "idle")
- (setq subed-mpv-is-playing nil)
- (subed-debug "Playing status changed: playing=%s"
subed-mpv-is-playing)))))
+ (setq subed-mpv-is-playing nil)))))
+
;;; High-level functions
- [nongnu] elpa/subed b988a17 257/389: subed-replay-adjusted-subtitle-p: Fix if/when in docstring, (continued)
- [nongnu] elpa/subed b988a17 257/389: subed-replay-adjusted-subtitle-p: Fix if/when in docstring, ELPA Syncer, 2021/12/03
- [nongnu] elpa/subed 080e512 262/389: Make variable subed-subtitle-format private, ELPA Syncer, 2021/12/03
- [nongnu] elpa/subed e7e791f 265/389: Activate support for multiple subtitle formats, ELPA Syncer, 2021/12/03
- [nongnu] elpa/subed 831b0ea 267/389: Produce better error message when buffer-file-name is nil, ELPA Syncer, 2021/12/03
- [nongnu] elpa/subed 864748c 270/389: Point to subed-mode docstring in "Commentary", ELPA Syncer, 2021/12/03
- [nongnu] elpa/subed 802a603 272/389: Add a real version number, ELPA Syncer, 2021/12/03
- [nongnu] elpa/subed 9557ba9 273/389: Standardize/Rename subtitle loop functions, ELPA Syncer, 2021/12/03
- [nongnu] elpa/subed ccc4c0e 274/389: Loop over current subtitle by default, ELPA Syncer, 2021/12/03
- [nongnu] elpa/subed 11a1993 275/389: Don't modify kill-ring when regenerating IDs, ELPA Syncer, 2021/12/03
- [nongnu] elpa/subed e3d4f46 283/389: Reword test description, ELPA Syncer, 2021/12/03
- [nongnu] elpa/subed fcc1951 288/389: Add subed-mpv-file-loaded-hook,
ELPA Syncer <=
- [nongnu] elpa/subed d87e2cd 290/389: Add save-place-local-mode to example config, ELPA Syncer, 2021/12/03
- [nongnu] elpa/subed e7ae26e 292/389: Add target: clean, ELPA Syncer, 2021/12/03
- [nongnu] elpa/subed 73e11d4 291/389: Define subed-mode as derived mode, ELPA Syncer, 2021/12/03
- [nongnu] elpa/subed df96747 297/389: Rename subed-mpv--handle-event -> subed-mpv--client-handle-event, ELPA Syncer, 2021/12/03
- [nongnu] elpa/subed 4ef1646 298/389: subed-mpv-find-video: Kill previous mpv instance if existing, ELPA Syncer, 2021/12/03
- [nongnu] elpa/subed 0872ab7 299/389: Remove "subed-mode enabled" message, ELPA Syncer, 2021/12/03
- [nongnu] elpa/subed 6215cb1 300/389: Add test-compile target, ELPA Syncer, 2021/12/03
- [nongnu] elpa/subed 9078a46 303/389: subed-srt--validate: Don't complain if buffer contains only whitespace, ELPA Syncer, 2021/12/03
- [nongnu] elpa/subed f2f11ca 305/389: subed-mpv-find-video: Gracefully handle new file, ELPA Syncer, 2021/12/03
- [nongnu] elpa/subed fabc7dc 306/389: Move function around, ELPA Syncer, 2021/12/03