aboutsummaryrefslogtreecommitdiffstats
path: root/lisp/replace.el
diff options
context:
space:
mode:
Diffstat (limited to 'lisp/replace.el')
-rw-r--r--lisp/replace.el27
1 files changed, 23 insertions, 4 deletions
diff --git a/lisp/replace.el b/lisp/replace.el
index 92edd2e2657..081d5c45f1d 100644
--- a/lisp/replace.el
+++ b/lisp/replace.el
@@ -1166,12 +1166,15 @@ See also `multi-occur'."
1166 (not (eq occur-excluded-properties t))))) 1166 (not (eq occur-excluded-properties t)))))
1167 (let* ((bufcount (length active-bufs)) 1167 (let* ((bufcount (length active-bufs))
1168 (diff (- (length bufs) bufcount))) 1168 (diff (- (length bufs) bufcount)))
1169 (message "Searched %d buffer%s%s; %s match%s for `%s'" 1169 (message "Searched %d buffer%s%s; %s match%s%s"
1170 bufcount (if (= bufcount 1) "" "s") 1170 bufcount (if (= bufcount 1) "" "s")
1171 (if (zerop diff) "" (format " (%d killed)" diff)) 1171 (if (zerop diff) "" (format " (%d killed)" diff))
1172 (if (zerop count) "no" (format "%d" count)) 1172 (if (zerop count) "no" (format "%d" count))
1173 (if (= count 1) "" "es") 1173 (if (= count 1) "" "es")
1174 regexp)) 1174 ;; Don't display regexp if with remaining text
1175 ;; it is longer than window-width.
1176 (if (> (+ (length regexp) 42) (window-width))
1177 "" (format " for `%s'" (query-replace-descr regexp)))))
1175 (setq occur-revert-arguments (list regexp nlines bufs)) 1178 (setq occur-revert-arguments (list regexp nlines bufs))
1176 (if (= count 0) 1179 (if (= count 0)
1177 (kill-buffer occur-buf) 1180 (kill-buffer occur-buf)
@@ -1298,9 +1301,13 @@ See also `multi-occur'."
1298 (goto-char headerpt) 1301 (goto-char headerpt)
1299 (let ((beg (point)) 1302 (let ((beg (point))
1300 end) 1303 end)
1301 (insert (format "%d match%s for \"%s\" in buffer: %s\n" 1304 (insert (format "%d match%s%s in buffer: %s\n"
1302 matches (if (= matches 1) "" "es") 1305 matches (if (= matches 1) "" "es")
1303 regexp (buffer-name buf))) 1306 ;; Don't display regexp for multi-buffer.
1307 (if (> (length buffers) 1)
1308 "" (format " for \"%s\""
1309 (query-replace-descr regexp)))
1310 (buffer-name buf)))
1304 (setq end (point)) 1311 (setq end (point))
1305 (add-text-properties beg end 1312 (add-text-properties beg end
1306 (append 1313 (append
@@ -1308,6 +1315,18 @@ See also `multi-occur'."
1308 `(font-lock-face ,title-face)) 1315 `(font-lock-face ,title-face))
1309 `(occur-title ,buf)))) 1316 `(occur-title ,buf))))
1310 (goto-char (point-min))))))) 1317 (goto-char (point-min)))))))
1318 ;; Display total match count and regexp for multi-buffer.
1319 (when (and (not (zerop globalcount)) (> (length buffers) 1))
1320 (goto-char (point-min))
1321 (let ((beg (point))
1322 end)
1323 (insert (format "%d match%s total for \"%s\":\n"
1324 globalcount (if (= globalcount 1) "" "es")
1325 (query-replace-descr regexp)))
1326 (setq end (point))
1327 (add-text-properties beg end (when title-face
1328 `(font-lock-face ,title-face))))
1329 (goto-char (point-min)))
1311 (if coding 1330 (if coding
1312 ;; CODING is buffer-file-coding-system of the first buffer 1331 ;; CODING is buffer-file-coding-system of the first buffer
1313 ;; that locally binds it. Let's use it also for the output 1332 ;; that locally binds it. Let's use it also for the output