# HG changeset patch # User Richard M. Stallman # Date 782295607 0 # Node ID d3f3f3db986dd2bc44d7489d03048c04f5032bc2 # Parent 6cf77973c97f8c20cb71a387e97432417be3b60e (count-lines): Do save-match-data only when necessary. diff -r 6cf77973c97f -r d3f3f3db986d lisp/simple.el --- a/lisp/simple.el Sun Oct 16 06:17:57 1994 +0000 +++ b/lisp/simple.el Sun Oct 16 08:20:07 1994 +0000 @@ -324,12 +324,12 @@ 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-match-data - (save-excursion - (save-restriction - (narrow-to-region start end) - (goto-char (point-min)) - (if (eq selective-display t) + (save-excursion + (save-restriction + (narrow-to-region start end) + (goto-char (point-min)) + (if (eq selective-display t) + (save-match-data (let ((done 0)) (while (re-search-forward "[\n\C-m]" nil t 40) (setq done (+ 40 done))) @@ -339,8 +339,8 @@ (if (and (/= start end) (not (bolp))) (1+ done) - done)) - (- (buffer-size) (forward-line (buffer-size)))))))) + done))) + (- (buffer-size) (forward-line (buffer-size))))))) (defun what-cursor-position () "Print info on cursor position (on screen and within buffer)."