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

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

[nongnu] elpa/subed 4e3e42f 044/389: subed-srt-sort: Wrap function body


From: ELPA Syncer
Subject: [nongnu] elpa/subed 4e3e42f 044/389: subed-srt-sort: Wrap function body in atomic-change-group
Date: Fri, 3 Dec 2021 10:59:53 -0500 (EST)

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

    subed-srt-sort: Wrap function body in atomic-change-group
---
 subed/subed-srt.el | 28 +++++++++++++++-------------
 1 file changed, 15 insertions(+), 13 deletions(-)

diff --git a/subed/subed-srt.el b/subed/subed-srt.el
index ae8e4e1..f186d14 100644
--- a/subed/subed-srt.el
+++ b/subed/subed-srt.el
@@ -495,19 +495,21 @@ each subtitle."
 (defun subed-srt-sort ()
   "Sanitize, then sort subtitles by start time and re-number them."
   (interactive)
-  (subed-srt-sanitize)
-  (subed--save-excursion
-   (goto-char (point-min))
-   (sort-subr nil
-              ;; nextrecfun (move to next record/subtitle or to end-of-buffer
-              ;; if there are no more records)
-              (lambda () (unless (subed-srt-forward-subtitle-id)
-                           (goto-char (point-max))))
-              ;; endrecfun (move to end of current record/subtitle)
-              'subed-srt-move-to-subtitle-end
-              ;; startkeyfun (return sort value of current record/subtitle)
-              'subed-srt--subtitle-msecs-start))
-  (subed-srt--regenerate-ids))
+  (atomic-change-group
+    (subed-srt-validate)
+    (subed-srt-sanitize)
+    (subed--save-excursion
+     (goto-char (point-min))
+     (sort-subr nil
+                ;; nextrecfun (move to next record/subtitle or to end-of-buffer
+                ;; if there are no more records)
+                (lambda () (unless (subed-srt-forward-subtitle-id)
+                             (goto-char (point-max))))
+                ;; endrecfun (move to end of current record/subtitle)
+                'subed-srt-move-to-subtitle-end
+                ;; startkeyfun (return sort value of current record/subtitle)
+                'subed-srt--subtitle-msecs-start))
+  (subed-srt-regenerate-ids)))
 
 (provide 'subed-srt)
 ;;; subed-srt.el ends here



reply via email to

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