aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lisp/ChangeLog12
-rw-r--r--lisp/replace.el27
2 files changed, 35 insertions, 4 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index f6b8fea964d..06e80db356d 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,15 @@
12010-03-21 Juri Linkov <juri@jurta.org>
2
3 Fix message of multi-line occur regexps and multi-buffer header lines.
4 http://lists.gnu.org/archive/html/emacs-devel/2010-03/msg00457.html
5
6 * replace.el (occur-1): Don't display regexp if it is longer
7 than window-width. Use `query-replace-descr' to display regexp.
8 (occur-engine): Don't display regexp in the buffer header for
9 multi-buffer occur. Display a separate header line with total
10 match count and regexp for multi-buffer occur.
11 Use `query-replace-descr' to display regexp.
12
12010-03-20 Teodor Zlatanov <tzz@lifelogs.com> 132010-03-20 Teodor Zlatanov <tzz@lifelogs.com>
2 14
3 * net/secrets.el: Fix parenthesis. 15 * net/secrets.el: Fix parenthesis.
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