aboutsummaryrefslogtreecommitdiffstats
path: root/lisp
diff options
context:
space:
mode:
Diffstat (limited to 'lisp')
-rw-r--r--lisp/replace.el22
1 files changed, 15 insertions, 7 deletions
diff --git a/lisp/replace.el b/lisp/replace.el
index 46f672a8d1a..8a17104c599 100644
--- a/lisp/replace.el
+++ b/lisp/replace.el
@@ -973,7 +973,8 @@ the matching is case-sensitive."
973(defun multi-occur (bufs regexp &optional nlines) 973(defun multi-occur (bufs regexp &optional nlines)
974 "Show all lines in buffers BUFS containing a match for REGEXP. 974 "Show all lines in buffers BUFS containing a match for REGEXP.
975This function acts on multiple buffers; otherwise, it is exactly like 975This function acts on multiple buffers; otherwise, it is exactly like
976`occur'." 976`occur'. When you invoke this command interactively, you must specify
977the buffer names that you want, one by one."
977 (interactive 978 (interactive
978 (cons 979 (cons
979 (let* ((bufs (list (read-buffer "First buffer to search: " 980 (let* ((bufs (list (read-buffer "First buffer to search: "
@@ -993,15 +994,19 @@ This function acts on multiple buffers; otherwise, it is exactly like
993 (occur-read-primary-args))) 994 (occur-read-primary-args)))
994 (occur-1 regexp nlines bufs)) 995 (occur-1 regexp nlines bufs))
995 996
996(defun multi-occur-by-filename-regexp (bufregexp regexp &optional nlines) 997(defun multi-occur-in-matching-buffers (bufregexp regexp &optional allbufs)
997 "Show all lines matching REGEXP in buffers named by BUFREGEXP. 998 "Show all lines matching REGEXP in buffers specified by BUFREGEXP.
999Normally BUFREGEXP matches against each buffer's visited file name,
1000but if you specify a prefix argument, it matches against the buffer name.
998See also `multi-occur'." 1001See also `multi-occur'."
999 (interactive 1002 (interactive
1000 (cons 1003 (cons
1001 (let* ((default (car regexp-history)) 1004 (let* ((default (car regexp-history))
1002 (input 1005 (input
1003 (read-from-minibuffer 1006 (read-from-minibuffer
1004 "List lines in buffers whose filename matches regexp: " 1007 (if allbufs
1008 "List lines in buffers whose names match regexp: "
1009 "List lines in buffers whose filenames match regexp: ")
1005 nil 1010 nil
1006 nil 1011 nil
1007 nil 1012 nil
@@ -1014,9 +1019,12 @@ See also `multi-occur'."
1014 (occur-1 regexp nlines 1019 (occur-1 regexp nlines
1015 (delq nil 1020 (delq nil
1016 (mapcar (lambda (buf) 1021 (mapcar (lambda (buf)
1017 (when (and (buffer-file-name buf) 1022 (when (if allbufs
1018 (string-match bufregexp 1023 (string-match bufregexp
1019 (buffer-file-name buf))) 1024 (buffer-name buf))
1025 (and (buffer-file-name buf)
1026 (string-match bufregexp
1027 (buffer-file-name buf))))
1020 buf)) 1028 buf))
1021 (buffer-list)))))) 1029 (buffer-list))))))
1022 1030