emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[nongnu] elpa/subed 4e50796 052/389: Fix subed-srt-backward-subtitle-id


From: ELPA Syncer
Subject: [nongnu] elpa/subed 4e50796 052/389: Fix subed-srt-backward-subtitle-id
Date: Fri, 3 Dec 2021 10:59:55 -0500 (EST)

branch: elpa/subed
commit 4e507962eb02f4422e02d402d57b08cbf746d264
Author: Random User <rndusr@posteo.de>
Commit: Random User <rndusr@posteo.de>

    Fix subed-srt-backward-subtitle-id
    
    Point wasn't preserved if there was no previous subtitle, and it always 
ended up
    at the current subtitle ID.
---
 subed/subed-srt.el | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/subed/subed-srt.el b/subed/subed-srt.el
index d289185..a117b40 100644
--- a/subed/subed-srt.el
+++ b/subed/subed-srt.el
@@ -229,13 +229,15 @@ Return point or nil if there is no next subtitle."
 
 (defun subed-srt-backward-subtitle-id ()
   "Move point to previous subtitle's ID.
-Return point or nil if point didn't change (e.g. if called on the
-first subtitle)."
+Return point or nil if there is no previous subtitle."
   (interactive)
-  (when (subed-srt-move-to-subtitle-id)
-    (let ((orig-point (point)))
+  (let ((orig-point (point))
+        (orig-sub-id (subed-srt--subtitle-id)))
+    (when (subed-srt-move-to-subtitle-id)
       (forward-line -1)
-      (unless (= (point) orig-point)
+      (if (= (subed-srt--subtitle-id) orig-sub-id)
+          (progn (goto-char orig-point)
+                 nil)
         (subed-srt-move-to-subtitle-id)))))
 
 (defun subed-srt-forward-subtitle-text ()



reply via email to

[Prev in Thread] Current Thread [Next in Thread]