aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard M. Stallman1994-10-16 08:20:07 +0000
committerRichard M. Stallman1994-10-16 08:20:07 +0000
commite406700d6968d41fe8292201d97611d35f48beca (patch)
tree67934f17afc397d370a0793b80ec573fd8f9fb10
parentb0b1ed3b65d8d32dceb8fbb0d7ad008a86b1c13a (diff)
downloademacs-e406700d6968d41fe8292201d97611d35f48beca.tar.gz
emacs-e406700d6968d41fe8292201d97611d35f48beca.zip
(count-lines): Do save-match-data only when necessary.
-rw-r--r--lisp/simple.el16
1 files changed, 8 insertions, 8 deletions
diff --git a/lisp/simple.el b/lisp/simple.el
index b4edb5c7ed3..090542e3cac 100644
--- a/lisp/simple.el
+++ b/lisp/simple.el
@@ -324,12 +324,12 @@ that uses or sets the mark."
324This is usually the number of newlines between them, 324This is usually the number of newlines between them,
325but can be one more if START is not equal to END 325but can be one more if START is not equal to END
326and the greater of them is not at the start of a line." 326and the greater of them is not at the start of a line."
327 (save-match-data 327 (save-excursion
328 (save-excursion 328 (save-restriction
329 (save-restriction 329 (narrow-to-region start end)
330 (narrow-to-region start end) 330 (goto-char (point-min))
331 (goto-char (point-min)) 331 (if (eq selective-display t)
332 (if (eq selective-display t) 332 (save-match-data
333 (let ((done 0)) 333 (let ((done 0))
334 (while (re-search-forward "[\n\C-m]" nil t 40) 334 (while (re-search-forward "[\n\C-m]" nil t 40)
335 (setq done (+ 40 done))) 335 (setq done (+ 40 done)))
@@ -339,8 +339,8 @@ and the greater of them is not at the start of a line."
339 (if (and (/= start end) 339 (if (and (/= start end)
340 (not (bolp))) 340 (not (bolp)))
341 (1+ done) 341 (1+ done)
342 done)) 342 done)))
343 (- (buffer-size) (forward-line (buffer-size)))))))) 343 (- (buffer-size) (forward-line (buffer-size)))))))
344 344
345(defun what-cursor-position () 345(defun what-cursor-position ()
346 "Print info on cursor position (on screen and within buffer)." 346 "Print info on cursor position (on screen and within buffer)."