branch: elpa/subed commit 3bc609d9669a8543dbdab97e9d89d27012b94799 Author: Random User <rnd...@posteo.de> Commit: Random User <rnd...@posteo.de>
Make run-subtitle-time-adjusted-hook not srt specific --- subed/subed-config.el | 8 ++++++++ subed/subed-srt.el | 12 ++---------- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/subed/subed-config.el b/subed/subed-config.el index 010f229..a9887a8 100644 --- a/subed/subed-config.el +++ b/subed/subed-config.el @@ -231,6 +231,14 @@ hardcoded." The functions are called with the relevant subtitle ID and the subtitle's start time.") +(defun subed--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--subtitle-id) + (subed--subtitle-msecs-start)))) + (defvar-local subed-point-motion-hook nil "Functions to call after point changed.") diff --git a/subed/subed-srt.el b/subed/subed-srt.el index 9f71320..81244c2 100644 --- a/subed/subed-srt.el +++ b/subed/subed-srt.el @@ -315,7 +315,7 @@ Return point or nil if there is no previous subtitle." (subed-srt-jump-to-subtitle-time-start) (when (looking-at subed-srt--regexp-timestamp) (replace-match (subed-srt--msecs-to-timestamp msecs-new)))) - (subed-srt--run-subtitle-time-adjusted-hook)))) + (subed--run-subtitle-time-adjusted-hook)))) (defun subed-srt--adjust-subtitle-stop-relative (msecs) "Add MSECS milliseconds to stop time (use negative value to subtract)." @@ -336,15 +336,7 @@ Return point or nil if there is no previous subtitle." (subed-srt-jump-to-subtitle-time-stop) (when (looking-at subed-srt--regexp-timestamp) (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)))) + (subed--run-subtitle-time-adjusted-hook)))) (defun subed-srt-increase-start-time (&optional arg) "Add `subed-milliseconds-adjust' milliseconds to start time of current subtitle.