[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/subed f1f8e2ad56 13/22: Bugfixes to make VTT editing work
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/subed f1f8e2ad56 13/22: Bugfixes to make VTT editing work |
Date: |
Tue, 1 Feb 2022 14:06:09 -0500 (EST) |
branch: elpa/subed
commit f1f8e2ad56f9573db42254899d40c6556e4c9ce9
Author: Sacha Chua <sacha@sachachua.com>
Commit: Sacha Chua <sacha@sachachua.com>
Bugfixes to make VTT editing work
* subed/subed-common.el (jump-to-subtitle-id-at-msecs): Handle
string IDs as given by VTT and ASS.
* subed/subed-mpv.el (subed-mpv--client-filter): Guard against
issues when the event is being processed from a non-subed buffer.
---
subed/subed-common.el | 2 +-
subed/subed-mpv.el | 45 +++++++++++++++++++++++----------------------
2 files changed, 24 insertions(+), 23 deletions(-)
diff --git a/subed/subed-common.el b/subed/subed-common.el
index cbdccb4bb1..da6db32bf6 100644
--- a/subed/subed-common.el
+++ b/subed/subed-common.el
@@ -125,7 +125,7 @@ Return point or nil if point is still on the same subtitle.
See also `subed-subtitle-id-at-msecs'."
(let ((current-sub-id (subed-subtitle-id))
(target-sub-id (subed-subtitle-id-at-msecs msecs)))
- (when (and target-sub-id current-sub-id (not (= target-sub-id
current-sub-id)))
+ (when (and target-sub-id current-sub-id (not (equal target-sub-id
current-sub-id)))
(subed-jump-to-subtitle-id target-sub-id))))
(subed-define-generic-function jump-to-subtitle-text-at-msecs (msecs)
diff --git a/subed/subed-mpv.el b/subed/subed-mpv.el
index 4701e07564..3575d7c0ca 100644
--- a/subed/subed-mpv.el
+++ b/subed/subed-mpv.el
@@ -214,28 +214,29 @@ string."
;; Therefore we maintain a buffer and process only complete lines.
(when (buffer-live-p (process-buffer proc))
(let ((orig-buffer (current-buffer)))
- (with-current-buffer (process-buffer proc)
- ;; Insert new response where previous response ended
- (let* ((proc-mark (process-mark proc))
- (moving (= (point) proc-mark)))
- (save-excursion
- (goto-char proc-mark)
- (insert response)
- (set-marker proc-mark (point)))
- (if moving (goto-char proc-mark)))
- ;; Process and remove all complete lines of JSON (lines are
complete if
- ;; they end with \n)
- (let ((p0 (point-min)))
- (while (progn (goto-char p0)
- (end-of-line)
- (equal (following-char) ?\n))
- (let* ((p1 (point))
- (line (buffer-substring p0 p1)))
- (delete-region p0 (+ p1 1))
- ;; Return context to the subtitle file buffer because we're using
- ;; buffer-local variables to store player state.
- (with-current-buffer orig-buffer
- (subed-mpv--client-handle-json line)))))))))
+ (when (derived-mode-p 'subed-mode)
+ (with-current-buffer (process-buffer proc)
+ ;; Insert new response where previous response ended
+ (let* ((proc-mark (process-mark proc))
+ (moving (= (point) proc-mark)))
+ (save-excursion
+ (goto-char proc-mark)
+ (insert response)
+ (set-marker proc-mark (point)))
+ (if moving (goto-char proc-mark)))
+ ;; Process and remove all complete lines of JSON (lines are
complete if
+ ;; they end with \n)
+ (let ((p0 (point-min)))
+ (while (progn (goto-char p0)
+ (end-of-line)
+ (equal (following-char) ?\n))
+ (let* ((p1 (point))
+ (line (buffer-substring p0 p1)))
+ (delete-region p0 (+ p1 1))
+ ;; Return context to the subtitle file buffer because we're
using
+ ;; buffer-local variables to store player state.
+ (with-current-buffer orig-buffer
+ (subed-mpv--client-handle-json
line))))))))))
(defun subed-mpv--client-handle-json (json-string)
"Process server response JSON-STRING."
- [nongnu] elpa/subed updated (f69c3e09f2 -> 3e99c6cb6f), ELPA Syncer, 2022/02/01
- [nongnu] elpa/subed 8120fb429f 04/22: Use defalias for non-interactive functions, ELPA Syncer, 2022/02/01
- [nongnu] elpa/subed 7a3eed2acf 14/22: New function subed-subtitle-list returns list, ELPA Syncer, 2022/02/01
- [nongnu] elpa/subed 8a9b219706 01/22: Create derived modes for the different types of subtitles., ELPA Syncer, 2022/02/01
- [nongnu] elpa/subed 0264eb4ef1 08/22: Bump version to 0.1.0 and add missing undercover-init.el, ELPA Syncer, 2022/02/01
- [nongnu] elpa/subed a0d633d7ac 09/22: Fix spaces in Makefile, ELPA Syncer, 2022/02/01
- [nongnu] elpa/subed 4cab871f58 03/22: Add undercover support for coverage testing, ELPA Syncer, 2022/02/01
- [nongnu] elpa/subed 3c7ac78393 12/22: Define jump-to-subtitle-text-at-msecs, ELPA Syncer, 2022/02/01
- [nongnu] elpa/subed f1f8e2ad56 13/22: Bugfixes to make VTT editing work,
ELPA Syncer <=
- [nongnu] elpa/subed d6b46496f8 11/22: Fix save hook name, ELPA Syncer, 2022/02/01
- [nongnu] elpa/subed e1b24bff31 05/22: Remove duplicate functions, ELPA Syncer, 2022/02/01
- [nongnu] elpa/subed 5c4ac92ddc 07/22: Add NEWS.org file, ELPA Syncer, 2022/02/01
- [nongnu] elpa/subed f3b48e319e 16/22: Use function instead of quote in subed-define-generic-function, ELPA Syncer, 2022/02/01
- [nongnu] elpa/subed 5e9518da77 18/22: Work around direct call of subed-mode by guessing format, ELPA Syncer, 2022/02/01
- [nongnu] elpa/subed 5ed05ad398 02/22: Implement mode-specific functions with cl-defmethod, ELPA Syncer, 2022/02/01
- [nongnu] elpa/subed 1f7e32e176 06/22: README.org: document branches, mention autoloads, ELPA Syncer, 2022/02/01
- [nongnu] elpa/subed a58b002fe9 15/22: Clean up undercover-init.el, ELPA Syncer, 2022/02/01
- [nongnu] elpa/subed 3e99c6cb6f 22/22: Merge branch 'derived-mode' into main, ELPA Syncer, 2022/02/01
- [nongnu] elpa/subed b3a4ae08ab 10/22: Add missing tests for merging and subtitle ID at msecs, ELPA Syncer, 2022/02/01