branch: elpa/subed commit 2c7554af1dd2c763f80bb8092c29d436e98ab1c1 Author: Random User <rnd...@posteo.de> Commit: Random User <rnd...@posteo.de>
Wrap subed--for-each-subtitle in atomic-change-group --- subed/subed.el | 33 +++++++++++++++++---------------- 1 file changed, 17 insertions(+), 16 deletions(-) diff --git a/subed/subed.el b/subed/subed.el index aa27f78..ae63092 100644 --- a/subed/subed.el +++ b/subed/subed.el @@ -143,22 +143,23 @@ If END is nil, it defaults to `point-max'. If BEG and END are both nil, run BODY only on the subtitle at point. Before BODY is run, point is placed on the subtitle's ID." (declare (indent defun)) - `(if (not ,beg) - ;; Run body on subtitle at point - (progn (save-excursion (subed-jump-to-subtitle-id) - ,@body)) - (progn - ;; Run body on multiple subtitles - (save-excursion - (goto-char ,beg) - (subed-jump-to-subtitle-id) - (catch 'last-subtitle-reached - (while t - (when (> (point) (or ,end (point-max))) - (throw 'last-subtitle-reached t)) - (progn ,@body) - (unless (subed-forward-subtitle-id) - (throw 'last-subtitle-reached t)))))))) + `(atomic-change-group + (if (not ,beg) + ;; Run body on subtitle at point + (progn (save-excursion (subed-jump-to-subtitle-id) + ,@body)) + (progn + ;; Run body on multiple subtitles + (save-excursion + (goto-char ,beg) + (subed-jump-to-subtitle-id) + (catch 'last-subtitle-reached + (while t + (when (> (point) (or ,end (point-max))) + (throw 'last-subtitle-reached t)) + (progn ,@body) + (unless (subed-forward-subtitle-id) + (throw 'last-subtitle-reached t))))))))) (defun subed--right-pad (string length fillchar) "Use FILLCHAR to make STRING LENGTH characters long."