Mercurial > emacs
comparison lisp/replace.el @ 10069:badc25c57780
(occur): Put number of matches in the header line.
author | Richard M. Stallman <rms@gnu.org> |
---|---|
date | Thu, 24 Nov 1994 08:39:41 +0000 |
parents | 460fecc93446 |
children | 8a04af3511c1 |
comparison
equal
deleted
inserted
replaced
10068:1f0008bd7e46 | 10069:badc25c57780 |
---|---|
350 ;;; (setq linenum (1+ (count-lines (point-min) (point)))) | 350 ;;; (setq linenum (1+ (count-lines (point-min) (point)))) |
351 ;;; (setq prevpos (point))) | 351 ;;; (setq prevpos (point))) |
352 (with-output-to-temp-buffer "*Occur*" | 352 (with-output-to-temp-buffer "*Occur*" |
353 (save-excursion | 353 (save-excursion |
354 (set-buffer standard-output) | 354 (set-buffer standard-output) |
355 (insert "Lines matching ") | 355 ;; We will insert the number of lines, and "lines", later. |
356 (insert " matching ") | |
356 (prin1 regexp) | 357 (prin1 regexp) |
357 (insert " in buffer " (buffer-name buffer) ?. ?\n) | 358 (insert " in buffer " (buffer-name buffer) ?. ?\n) |
358 (occur-mode) | 359 (occur-mode) |
359 (setq occur-buffer buffer) | 360 (setq occur-buffer buffer) |
360 (setq occur-nlines nlines) | 361 (setq occur-nlines nlines) |
423 (setq tem (1+ tem)))) | 424 (setq tem (1+ tem)))) |
424 (forward-line 1))) | 425 (forward-line 1))) |
425 (set-buffer standard-output) | 426 (set-buffer standard-output) |
426 ;; Put positions in increasing order to go with buffer. | 427 ;; Put positions in increasing order to go with buffer. |
427 (setq occur-pos-list (nreverse occur-pos-list)) | 428 (setq occur-pos-list (nreverse occur-pos-list)) |
429 (goto-char (point-min)) | |
430 (if (= (length occur-pos-list) 1) | |
431 (insert "1 line") | |
432 (insert (format "%d lines" (length occur-pos-list)))) | |
428 (if (interactive-p) | 433 (if (interactive-p) |
429 (message "%d matching lines." (length occur-pos-list))))))) | 434 (message "%d matching lines." (length occur-pos-list))))))) |
430 | 435 |
431 ;; It would be nice to use \\[...], but there is no reasonable way | 436 ;; It would be nice to use \\[...], but there is no reasonable way |
432 ;; to make that display both SPC and Y. | 437 ;; to make that display both SPC and Y. |