branch: elpa/subed commit 918ba6fa9841d09a7326b6cc9649345ad401c8e3 Author: Marcin Borkowski <mb...@mbork.pl> Commit: Marcin Borkowski <mb...@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)