diff options
| author | Richard M. Stallman | 1994-10-16 08:20:07 +0000 |
|---|---|---|
| committer | Richard M. Stallman | 1994-10-16 08:20:07 +0000 |
| commit | e406700d6968d41fe8292201d97611d35f48beca (patch) | |
| tree | 67934f17afc397d370a0793b80ec573fd8f9fb10 | |
| parent | b0b1ed3b65d8d32dceb8fbb0d7ad008a86b1c13a (diff) | |
| download | emacs-e406700d6968d41fe8292201d97611d35f48beca.tar.gz emacs-e406700d6968d41fe8292201d97611d35f48beca.zip | |
(count-lines): Do save-match-data only when necessary.
| -rw-r--r-- | lisp/simple.el | 16 |
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." | |||
| 324 | This is usually the number of newlines between them, | 324 | This is usually the number of newlines between them, |
| 325 | but can be one more if START is not equal to END | 325 | but can be one more if START is not equal to END |
| 326 | and the greater of them is not at the start of a line." | 326 | and 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)." |