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

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

[nongnu] elpa/subed aae6f0c 123/389: Add function: subed-srt--run-subtit


From: ELPA Syncer
Subject: [nongnu] elpa/subed aae6f0c 123/389: Add function: subed-srt--run-subtitle-time-adjusted-hook
Date: Fri, 3 Dec 2021 11:00:10 -0500 (EST)

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

    Add function: subed-srt--run-subtitle-time-adjusted-hook
---
 subed/subed-srt.el | 21 ++++++++++++---------
 1 file changed, 12 insertions(+), 9 deletions(-)

diff --git a/subed/subed-srt.el b/subed/subed-srt.el
index e6b467d..228700c 100644
--- a/subed/subed-srt.el
+++ b/subed/subed-srt.el
@@ -304,10 +304,8 @@ Return point or nil if there is no previous subtitle."
       (save-excursion
         (subed-srt-jump-to-subtitle-time-start)
         (when (looking-at subed-srt--regexp-timestamp)
-          (replace-match (subed-srt--msecs-to-timestamp msecs-new))))
-      (when subed-subtitle-time-adjusted-hook
-        (run-hook-with-args 'subed-subtitle-time-adjusted-hook
-                            (subed-srt--subtitle-id) msecs-new)))))
+          (replace-match (subed-srt--msecs-to-timestamp msecs-new))))))
+  (subed-srt--run-subtitle-time-adjusted-hook))
 
 (defun subed-srt--adjust-subtitle-stop-relative (msecs)
   "Add MSECS milliseconds to stop time (use negative value to subtract)."
@@ -317,11 +315,16 @@ Return point or nil if there is no previous subtitle."
       (save-excursion
         (subed-srt-jump-to-subtitle-time-stop)
         (when (looking-at subed-srt--regexp-timestamp)
-          (replace-match (subed-srt--msecs-to-timestamp msecs-new))))
-    (when subed-subtitle-time-adjusted-hook
-      (run-hook-with-args 'subed-subtitle-time-adjusted-hook
-                          (subed-srt--subtitle-id)
-                          (subed-srt--subtitle-msecs-start))))))
+          (replace-match (subed-srt--msecs-to-timestamp msecs-new))))))
+  (subed-srt--run-subtitle-time-adjusted-hook))
+
+(defun subed-srt--run-subtitle-time-adjusted-hook ()
+  "Run `subed-subtitle-time-adjusted-hook' functions with
+subtitle ID and start time of the adjusted subtitle."
+  (when subed-subtitle-time-adjusted-hook
+    (run-hook-with-args 'subed-subtitle-time-adjusted-hook
+                        (subed-srt--subtitle-id)
+                        (subed-srt--subtitle-msecs-start))))
 
 (defun subed-srt-increase-start-time (&optional arg)
   "Add `subed-milliseconds-adjust' milliseconds to start time of current 
subtitle.



reply via email to

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