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

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

[nongnu] elpa/subed 2efc49757e 2/9: subed-save-excursion: go back to poi


From: ELPA Syncer
Subject: [nongnu] elpa/subed 2efc49757e 2/9: subed-save-excursion: go back to point in more cases
Date: Tue, 28 Nov 2023 19:00:19 -0500 (EST)

branch: elpa/subed
commit 2efc49757eeeb08f8a502e9c588f5608b7ee65b4
Author: Sacha Chua <sacha@sachachua.com>
Commit: Sacha Chua <sacha@sachachua.com>

    subed-save-excursion: go back to point in more cases
    
    * subed/subed-common.el (subed-save-excursion): Go back to point.
---
 subed/subed-common.el | 20 ++++++++++++--------
 1 file changed, 12 insertions(+), 8 deletions(-)

diff --git a/subed/subed-common.el b/subed/subed-common.el
index a16211bc8a..b1596a84db 100644
--- a/subed/subed-common.el
+++ b/subed/subed-common.el
@@ -93,15 +93,19 @@ subtitles) as long the subtitle IDs don't change."
   (declare (debug t))
   (save-excursion
     `(let ((sub-id (subed-subtitle-id))
-           (sub-pos (subed-subtitle-relative-point)))
+           (sub-pos (subed-subtitle-relative-point))
+           (pos (point)))
        (progn ,@body)
-       (subed-jump-to-subtitle-id sub-id)
-       ;; Subtitle text may have changed and we may not be able to move to the
-       ;; exact original position
-       (condition-case nil
-           (forward-char sub-pos)
-         ('beginning-of-buffer nil)
-         ('end-of-buffer nil)))))
+       (if sub-id
+           (progn
+             (subed-jump-to-subtitle-id sub-id)
+             ;; Subtitle text may have changed and we may not be able to move 
to the
+             ;; exact original position
+             (condition-case nil
+                 (forward-char sub-pos)
+               ('beginning-of-buffer nil)
+               ('end-of-buffer nil)))
+         (goto-char pos)))))
 
 (defmacro subed-for-each-subtitle (beg end reverse &rest body)
   "Run BODY for each subtitle between the region specified by BEG and END.



reply via email to

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