diff options
| author | Richard M. Stallman | 1993-03-29 19:09:05 +0000 |
|---|---|---|
| committer | Richard M. Stallman | 1993-03-29 19:09:05 +0000 |
| commit | dde92ca68981042128f7c6759505611eb522542d (patch) | |
| tree | 29d6fc7f5972cd701ab0fbafbcb06458568b76fd | |
| parent | 125def1c78dfecbdc4d5a18bd2c92d41acae4e22 (diff) | |
| download | emacs-dde92ca68981042128f7c6759505611eb522542d.tar.gz emacs-dde92ca68981042128f7c6759505611eb522542d.zip | |
(count-lines): Use save-match-data.
| -rw-r--r-- | lisp/simple.el | 25 |
1 files changed, 13 insertions, 12 deletions
diff --git a/lisp/simple.el b/lisp/simple.el index a07ce68a9fe..ef6a011afdf 100644 --- a/lisp/simple.el +++ b/lisp/simple.el | |||
| @@ -321,18 +321,19 @@ that uses or sets the mark." | |||
| 321 | This is usually the number of newlines between them, | 321 | This is usually the number of newlines between them, |
| 322 | but can be one more if START is not equal to END | 322 | but can be one more if START is not equal to END |
| 323 | and the greater of them is not at the start of a line." | 323 | and the greater of them is not at the start of a line." |
| 324 | (save-excursion | 324 | (save-match-data |
| 325 | (save-restriction | 325 | (save-excursion |
| 326 | (narrow-to-region start end) | 326 | (save-restriction |
| 327 | (goto-char (point-min)) | 327 | (narrow-to-region start end) |
| 328 | (if (eq selective-display t) | 328 | (goto-char (point-min)) |
| 329 | (let ((done 0)) | 329 | (if (eq selective-display t) |
| 330 | (while (re-search-forward "[\n\C-m]" nil t 40) | 330 | (let ((done 0)) |
| 331 | (setq done (+ 40 done))) | 331 | (while (re-search-forward "[\n\C-m]" nil t 40) |
| 332 | (while (re-search-forward "[\n\C-m]" nil t 1) | 332 | (setq done (+ 40 done))) |
| 333 | (setq done (+ 1 done))) | 333 | (while (re-search-forward "[\n\C-m]" nil t 1) |
| 334 | done) | 334 | (setq done (+ 1 done))) |
| 335 | (- (buffer-size) (forward-line (buffer-size))))))) | 335 | done) |
| 336 | (- (buffer-size) (forward-line (buffer-size)))))))) | ||
| 336 | 337 | ||
| 337 | (defun what-cursor-position () | 338 | (defun what-cursor-position () |
| 338 | "Print info on cursor position (on screen and within buffer)." | 339 | "Print info on cursor position (on screen and within buffer)." |