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

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

[nongnu] elpa/subed 918ba6f 370/389: Prevent showing the "Match data clo


From: ELPA Syncer
Subject: [nongnu] elpa/subed 918ba6f 370/389: Prevent showing the "Match data clobbered" message
Date: Fri, 3 Dec 2021 11:01:00 -0500 (EST)

branch: elpa/subed
commit 918ba6fa9841d09a7326b6cc9649345ad401c8e3
Author: Marcin Borkowski <mbork@mbork.pl>
Commit: Marcin Borkowski <mbork@mbork.pl>

    Prevent showing the "Match data clobbered" message
---
 subed/subed-common.el | 25 +++++++++++++------------
 1 file changed, 13 insertions(+), 12 deletions(-)

diff --git a/subed/subed-common.el b/subed/subed-common.el
index 5fdc61c..0c80cf5 100644
--- a/subed/subed-common.el
+++ b/subed/subed-common.el
@@ -1073,18 +1073,19 @@ Return nil if function `buffer-file-name' returns nil."
 (defun subed-calculate-cps (&optional print-message)
   "Calculate characters per second of the current subtitle."
   (interactive "p")
-  (let* ((msecs-start (ignore-errors (subed-subtitle-msecs-start)))
-        (msecs-stop (ignore-errors (subed-subtitle-msecs-stop)))
-        (text (if (fboundp subed-transform-for-cps)
-                  (funcall subed-transform-for-cps (subed-subtitle-text))
-                (subed-subtitle-text)))
-        (length (length text))
-        (cps (when (and (numberp msecs-stop)
-                        (numberp msecs-start))
-               (/ length 0.001 (- msecs-stop msecs-start)))))
-    (if (and print-message cps)
-       (message "%.1f characters per second" cps)
-      cps)))
+  (save-match-data
+    (let* ((msecs-start (ignore-errors (subed-subtitle-msecs-start)))
+          (msecs-stop (ignore-errors (subed-subtitle-msecs-stop)))
+          (text (if (fboundp subed-transform-for-cps)
+                    (funcall subed-transform-for-cps (subed-subtitle-text))
+                  (subed-subtitle-text)))
+          (length (length text))
+          (cps (when (and (numberp msecs-stop)
+                          (numberp msecs-start))
+                 (/ length 0.001 (- msecs-stop msecs-start)))))
+      (if (and print-message cps)
+         (message "%.1f characters per second" cps)
+       cps))))
 
 (defvar-local subed--cps-overlay nil)
 



reply via email to

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