branch: elpa/subed commit 4e3e42fef75b679b3484dc1bf085b10289f2b58b Author: Random User <rnd...@posteo.de> Commit: Random User <rnd...@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