branch: elpa/subed
commit 430ba0334fe601bdeeaad77626947c9b11fe3a50
Author: Sacha Chua <[email protected]>
Commit: Sacha Chua <[email protected]>
subed-for-each-subtitle: handle WebVTT header
* subed/subed-common.el (subed-for-each-subtitle): Don't get confused
by the WebVTT header. Allow edebugging.
---
subed/subed-common.el | 23 +++++++++++++----------
1 file changed, 13 insertions(+), 10 deletions(-)
diff --git a/subed/subed-common.el b/subed/subed-common.el
index cd5494c7d9..5a81703603 100644
--- a/subed/subed-common.el
+++ b/subed/subed-common.el
@@ -109,7 +109,8 @@ If END is nil, it defaults to `point-max'.
If BEG and END are both nil, run BODY only on the subtitle at point.
If REVERSE is non-nil, start on the subtitle at END and move backwards.
Before BODY is run, point is placed on the subtitle's ID."
- (declare (indent defun))
+ (declare (indent defun)
+ (debug 1))
`(atomic-change-group
(if (not ,beg)
;; Run body on subtitle at point
@@ -134,15 +135,17 @@ Before BODY is run, point is placed on the subtitle's ID."
(unless (subed-backward-subtitle-id)
(throw 'first-subtitle-reached t)))))
;; Iterate forwards
- (save-excursion (goto-char begm)
- (subed-jump-to-subtitle-id)
- (catch 'last-subtitle-reached
- (while t
- (when (> (point) endm)
- (throw 'last-subtitle-reached t))
- (progn ,@body)
- (unless (subed-forward-subtitle-id)
- (throw 'last-subtitle-reached t))))))))))
+ (save-excursion
+ (goto-char begm)
+ (unless (subed-jump-to-subtitle-id)
+ (subed-forward-subtitle-id))
+ (catch 'last-subtitle-reached
+ (while t
+ (when (> (point) endm)
+ (throw 'last-subtitle-reached t))
+ (progn ,@body)
+ (unless (subed-forward-subtitle-id)
+ (throw 'last-subtitle-reached t))))))))))
(defmacro subed-with-subtitle-replay-disabled (&rest body)
"Run BODY while automatic subtitle replay is disabled."