branch: elpa/subed
commit e8a68c25aa012a5403eb8150453e5db3912ae649
Author: Random User <[email protected]>
Commit: Random User <[email protected]>
subed-srt--msecs-to-timestamp: Explain save-match-data
---
subed/subed-srt.el | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/subed/subed-srt.el b/subed/subed-srt.el
index 6c86163..6ef5c3d 100644
--- a/subed/subed-srt.el
+++ b/subed/subed-srt.el
@@ -59,9 +59,10 @@ Return nil if TIME-STRING doesn't match the pattern."
(defun subed-srt--msecs-to-timestamp (msecs)
"Convert MSECS to string in the format HH:MM:SS,MS."
- (save-match-data
- (concat (format-seconds "%02h:%02m:%02s" (/ msecs 1000))
- "," (format "%03d" (mod msecs 1000)))))
+ ;; We need to wrap format-seconds in save-match-data because it does regexp
+ ;; stuff and we need to preserve our own match-data.
+ (concat (save-match-data (format-seconds "%02h:%02m:%02s" (/ msecs 1000)))
+ "," (format "%03d" (mod msecs 1000))))
(defun subed-srt--subtitle-id ()
"Return the ID of the subtitle at point or nil if there is no ID."