[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/subed 9d54f39 005/389: Be more robust when getting start/s
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/subed 9d54f39 005/389: Be more robust when getting start/stop time |
Date: |
Fri, 3 Dec 2021 10:59:45 -0500 (EST) |
branch: elpa/subed
commit 9d54f396fffadb1af26ca97d236e4e3883393237
Author: Random User <rndusr@posteo.de>
Commit: Random User <rndusr@posteo.de>
Be more robust when getting start/stop time
---
subed/subed-srt.el | 18 ++++++++++--------
1 file changed, 10 insertions(+), 8 deletions(-)
diff --git a/subed/subed-srt.el b/subed/subed-srt.el
index 272750f..9d98cc7 100644
--- a/subed/subed-srt.el
+++ b/subed/subed-srt.el
@@ -91,18 +91,20 @@ after MSECS if there is one and its start time is >= MSECS +
(subed-srt--subtitle-id)))
(defun subed-srt--subtitle-msecs-start (&optional sub-id)
- "Subtitle start time in milliseconds."
+ "Subtitle start time in milliseconds or nil if it can't be found."
(let ((timestamp (save-excursion
- (subed-srt-move-to-subtitle-time-start sub-id)
- (buffer-substring (point) (+ (point)
subed-srt--length-timestamp)))))
- (subed-srt--timestamp-to-msecs timestamp)))
+ (when (subed-srt-move-to-subtitle-time-start sub-id)
+ (buffer-substring (point) (+ (point)
subed-srt--length-timestamp))))))
+ (when timestamp
+ (subed-srt--timestamp-to-msecs timestamp))))
(defun subed-srt--subtitle-msecs-stop (&optional sub-id)
- "Subtitle stop time in milliseconds."
+ "Subtitle stop time in milliseconds or nil if it can't be found."
(let ((timestamp (save-excursion
- (subed-srt-move-to-subtitle-time-stop sub-id)
- (buffer-substring (point) (+ (point)
subed-srt--length-timestamp)))))
- (subed-srt--timestamp-to-msecs timestamp)))
+ (when (subed-srt-move-to-subtitle-time-stop sub-id)
+ (buffer-substring (point) (+ (point)
subed-srt--length-timestamp))))))
+ (when timestamp
+ (subed-srt--timestamp-to-msecs timestamp))))
(defun subed-srt--subtitle-relative-point ()
"Point relative to subtitle's ID, i.e. point within subtitle."
- [nongnu] branch elpa/subed created (now d0dfa1a), ELPA Syncer, 2021/12/03
- [nongnu] elpa/subed 6a12f22 002/389: When debugging, don't autoscroll if debug-window is hidden, ELPA Syncer, 2021/12/03
- [nongnu] elpa/subed d8bf4ed 001/389: Initial commit, ELPA Syncer, 2021/12/03
- [nongnu] elpa/subed 2ff368b 004/389: Move subed-subtitle-time-adjusted-hook where it belongs, ELPA Syncer, 2021/12/03
- [nongnu] elpa/subed 9d54f39 005/389: Be more robust when getting start/stop time,
ELPA Syncer <=
- [nongnu] elpa/subed 433f7b4 003/389: subed-disable-sync-point-to-player-temporarily: Remove debug msgs, ELPA Syncer, 2021/12/03
- [nongnu] elpa/subed 70e6cea 015/389: README: Test unicode non-breaking space, ELPA Syncer, 2021/12/03
- [nongnu] elpa/subed d98325c 011/389: Add tests for getting subtitle start/stop time, ELPA Syncer, 2021/12/03
- [nongnu] elpa/subed 73419ca 021/389: Make forward/backward movement tests pass, ELPA Syncer, 2021/12/03
- [nongnu] elpa/subed 99a235a 019/389: Spoon trailing parens, ELPA Syncer, 2021/12/03
- [nongnu] elpa/subed 46aeb10 020/389: Add more tests for forward/backward movement, ELPA Syncer, 2021/12/03
- [nongnu] elpa/subed fd7c2ba 017/389: Add tests for getting relative point within subtitle, ELPA Syncer, 2021/12/03
- [nongnu] elpa/subed ac4bc87 025/389: Add more tests for moving to subtitle ID, ELPA Syncer, 2021/12/03
- [nongnu] elpa/subed 7d4caaa 018/389: Move time adjustment tests, ELPA Syncer, 2021/12/03
- [nongnu] elpa/subed f8a7c6a 029/389: Fix test that failed because of lexical scoping, ELPA Syncer, 2021/12/03