[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/subed 5c51000 101/389: Call time-adjusted-hook functions w
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/subed 5c51000 101/389: Call time-adjusted-hook functions with start time, not stop time |
Date: |
Fri, 3 Dec 2021 11:00:06 -0500 (EST) |
branch: elpa/subed
commit 5c510001a2e6a53181db37ecf9230cbb21c3d636
Author: Random User <rndusr@posteo.de>
Commit: Random User <rndusr@posteo.de>
Call time-adjusted-hook functions with start time, not stop time
---
subed/subed-config.el | 5 +++--
subed/subed-srt.el | 3 ++-
tests/test-subed-srt.el | 4 ++--
3 files changed, 7 insertions(+), 5 deletions(-)
diff --git a/subed/subed-config.el b/subed/subed-config.el
index f4120c9..4d6fa2f 100644
--- a/subed/subed-config.el
+++ b/subed/subed-config.el
@@ -243,8 +243,9 @@ hardcoded."
;; Hooks
(defvar subed-subtitle-time-adjusted-hook ()
- "Functions to call when a subtitle's start or stop time has
-changed.")
+ "Functions to call when a subtitle's start or stop time has changed.
+The functions are called with the relevant subtitle ID and the
+subtitle's start time.")
(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 ac8b536..135c363 100644
--- a/subed/subed-srt.el
+++ b/subed/subed-srt.el
@@ -316,7 +316,8 @@ Return point or nil if there is no previous subtitle."
(replace-match (subed-srt--msecs-to-timestamp msecs-new))))
(when subed-subtitle-time-adjusted-hook
(let ((sub-id (subed-srt--subtitle-id)))
- (run-hook-with-args 'subed-subtitle-time-adjusted-hook sub-id
msecs-new)))))
+ (run-hook-with-args 'subed-subtitle-time-adjusted-hook sub-id
+ (subed-srt--subtitle-msecs-start))))))
(defun subed-srt-increase-start-time (&optional arg)
"Add `subed-seconds-adjust' milliseconds to start time of current subtitle.
diff --git a/tests/test-subed-srt.el b/tests/test-subed-srt.el
index efa2d6c..9a0ff2e 100644
--- a/tests/test-subed-srt.el
+++ b/tests/test-subed-srt.el
@@ -616,7 +616,7 @@ Baz.
(expect 'foo :to-have-been-called-times 1)
(subed-srt-jump-to-subtitle-id 1)
(subed-srt-increase-stop-time)
- (expect 'foo :to-have-been-called-with 1 65223)
+ (expect 'foo :to-have-been-called-with 1 61000)
(expect 'foo :to-have-been-called-times 2)
(subed-srt-jump-to-subtitle-end 2)
(subed-srt-decrease-start-time)
@@ -624,7 +624,7 @@ Baz.
(expect 'foo :to-have-been-called-times 3)
(subed-srt-jump-to-subtitle-text 3)
(subed-srt-decrease-stop-time 100)
- (expect 'foo :to-have-been-called-with 3 195400)
+ (expect 'foo :to-have-been-called-with 3 183550)
(expect 'foo :to-have-been-called-times 4))))
(it "adjusts the start/stop time."
(with-temp-buffer
- [nongnu] elpa/subed 96e7fcf 086/389: Add subed--get-seconds-move, (continued)
- [nongnu] elpa/subed 96e7fcf 086/389: Add subed--get-seconds-move, ELPA Syncer, 2021/12/03
- [nongnu] elpa/subed 189e5aa 088/389: Make more functions available format-agnosticly, ELPA Syncer, 2021/12/03
- [nongnu] elpa/subed 14d52d7 089/389: Add subed--for-each-subtitle, ELPA Syncer, 2021/12/03
- [nongnu] elpa/subed 7710790 090/389: Add subed-move-subtitle-forward/backward, ELPA Syncer, 2021/12/03
- [nongnu] elpa/subed 3511026 091/389: Move utilities to the top, ELPA Syncer, 2021/12/03
- [nongnu] elpa/subed 81aca87 008/389: Be more robust when moving forward/backward to subtitle text, ELPA Syncer, 2021/12/03
- [nongnu] elpa/subed 8e4bd20 069/389: Fix indentation, ELPA Syncer, 2021/12/03
- [nongnu] elpa/subed 6e525b9 079/389: Add screenshot, ELPA Syncer, 2021/12/03
- [nongnu] elpa/subed bf9ceeb 094/389: Reduce word count by 1, ELPA Syncer, 2021/12/03
- [nongnu] elpa/subed 42199eb 095/389: Workaround for GitHub's lack of support for ~~/path/in/home~, ELPA Syncer, 2021/12/03
- [nongnu] elpa/subed 5c51000 101/389: Call time-adjusted-hook functions with start time, not stop time,
ELPA Syncer <=
- [nongnu] elpa/subed 53d1e33 102/389: Fix error when adjusting start/stop time in empty buffer, ELPA Syncer, 2021/12/03
- [nongnu] elpa/subed a0cb0f1 108/389: Keep region active during subtitle movement, ELPA Syncer, 2021/12/03
- [nongnu] elpa/subed 2c7554a 109/389: Wrap subed--for-each-subtitle in atomic-change-group, ELPA Syncer, 2021/12/03
- [nongnu] elpa/subed e792e0f 122/389: Fix test description, ELPA Syncer, 2021/12/03
- [nongnu] elpa/subed 489bbea 130/389: Remove subed-milliseconds-move, ELPA Syncer, 2021/12/03
- [nongnu] elpa/subed a7dda70 137/389: Add subtitle shifting to features, ELPA Syncer, 2021/12/03
- [nongnu] elpa/subed a819a93 139/389: Fix test description, ELPA Syncer, 2021/12/03
- [nongnu] elpa/subed 06851d8 143/389: Prevent overlapping when adjusting subtitle start/stop time, ELPA Syncer, 2021/12/03
- [nongnu] elpa/subed 651c6de 031/389: Wrap some function bodies in save-match-data, ELPA Syncer, 2021/12/03
- [nongnu] elpa/subed 57c902a 068/389: subed-srt-sanitize: Don't change buffer unless it's necessary, ELPA Syncer, 2021/12/03