branch: elpa/subed
commit fc0ab908f0becde85aac796b5ea819691cb82210
Author: Sacha Chua <[email protected]>
Commit: Sacha Chua <[email protected]>

    New command subed-jump-to-next-long-subtitle
    
    * subed/subed-common.el (subed-jump-to-next-long-subtitle): New command.
    * subed/subed-config.el (subed-validate-functions): New option.
---
 subed/subed-common.el | 13 +++++++++++++
 subed/subed-config.el |  5 +++++
 2 files changed, 18 insertions(+)

diff --git a/subed/subed-common.el b/subed/subed-common.el
index 7034ee1ef6..d901303ce4 100644
--- a/subed/subed-common.el
+++ b/subed/subed-common.el
@@ -820,6 +820,19 @@ Return a filtered subtitle list.")
   "Validate format-specific rules."
   nil)
 
+;;;###autoload
+(defun subed-jump-to-next-long-subtitle ()
+  "Go to the next subtitle over `subed-validate-subtitle-too-long-msecs'."
+  (interactive)
+  (catch 'found
+    (while (not (eobp))
+      (if (subed-forward-subtitle-text)
+          (when (> (- (subed-subtitle-msecs-stop)
+                      (subed-subtitle-msecs-start))
+                   subed-validate-subtitle-too-long-msecs)
+            (throw 'found t))
+        (goto-char (point-max))))))
+
 (subed-define-generic-function regenerate-ids ()
   "Ensure consecutive, unduplicated subtitle IDs in formats that use them."
   nil)
diff --git a/subed/subed-config.el b/subed/subed-config.el
index e259be14c6..c6b80e67c7 100644
--- a/subed/subed-config.el
+++ b/subed/subed-config.el
@@ -194,6 +194,11 @@ action."
   :local t
   :group 'subed)
 
+(defcustom subed-validate-subtitle-too-long-msecs 8000
+  "Duration threshold for `subed-jump-to-next-long-subtitle'."
+  :type 'integer
+  :group 'subed)
+
 (defcustom subed-loop-seconds-before 0
   "Prelude in seconds when looping over subtitle(s)."
   :type 'float

Reply via email to