From dde92ca68981042128f7c6759505611eb522542d Mon Sep 17 00:00:00 2001 From: "Richard M. Stallman" Date: Mon, 29 Mar 1993 19:09:05 +0000 Subject: [PATCH] (count-lines): Use save-match-data. --- lisp/simple.el | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/lisp/simple.el b/lisp/simple.el index a07ce68a9f..ef6a011afd 100644 --- a/lisp/simple.el +++ b/lisp/simple.el @@ -321,18 +321,19 @@ that uses or sets the mark." This is usually the number of newlines between them, but can be one more if START is not equal to END and the greater of them is not at the start of a line." - (save-excursion - (save-restriction - (narrow-to-region start end) - (goto-char (point-min)) - (if (eq selective-display t) - (let ((done 0)) - (while (re-search-forward "[\n\C-m]" nil t 40) - (setq done (+ 40 done))) - (while (re-search-forward "[\n\C-m]" nil t 1) - (setq done (+ 1 done))) - done) - (- (buffer-size) (forward-line (buffer-size))))))) + (save-match-data + (save-excursion + (save-restriction + (narrow-to-region start end) + (goto-char (point-min)) + (if (eq selective-display t) + (let ((done 0)) + (while (re-search-forward "[\n\C-m]" nil t 40) + (setq done (+ 40 done))) + (while (re-search-forward "[\n\C-m]" nil t 1) + (setq done (+ 1 done))) + done) + (- (buffer-size) (forward-line (buffer-size)))))))) (defun what-cursor-position () "Print info on cursor position (on screen and within buffer)." -- GitLab