aboutsummaryrefslogtreecommitdiffstats
path: root/lisp/isearch.el
diff options
context:
space:
mode:
Diffstat (limited to 'lisp/isearch.el')
-rw-r--r--lisp/isearch.el40
1 files changed, 31 insertions, 9 deletions
diff --git a/lisp/isearch.el b/lisp/isearch.el
index 27b82940043..9d69443b6a4 100644
--- a/lisp/isearch.el
+++ b/lisp/isearch.el
@@ -1433,16 +1433,38 @@ See `isearch-query-replace' for more information."
1433 (isearch-query-replace delimited t)) 1433 (isearch-query-replace delimited t))
1434 1434
1435(defun isearch-occur (regexp &optional nlines) 1435(defun isearch-occur (regexp &optional nlines)
1436 "Run `occur' with regexp to search from the current search string. 1436 "Run `occur' using the last search string as the regexp.
1437Interactively, REGEXP is the current search regexp or a quoted search 1437Interactively, REGEXP is constructed using the search string from the
1438string. NLINES has the same meaning as in `occur'." 1438last search command. NLINES has the same meaning as in `occur'.
1439
1440If the last search command was a word search, REGEXP is computed from
1441the search words, ignoring punctuation. If the last search
1442command was a regular expression search, REGEXP is the regular
1443expression used in that search. If the last search command searched
1444for a literal string, REGEXP is constructed by quoting all the special
1445characters in that string."
1439 (interactive 1446 (interactive
1440 (list 1447 (let* ((perform-collect (consp current-prefix-arg))
1441 (cond 1448 (regexp (cond
1442 (isearch-word (word-search-regexp isearch-string)) 1449 (isearch-word (word-search-regexp isearch-string))
1443 (isearch-regexp isearch-string) 1450 (isearch-regexp isearch-string)
1444 (t (regexp-quote isearch-string))) 1451 (t (regexp-quote isearch-string)))))
1445 (if current-prefix-arg (prefix-numeric-value current-prefix-arg)))) 1452 (list regexp
1453 (if perform-collect
1454 ;; Perform collect operation
1455 (if (zerop (regexp-opt-depth regexp))
1456 ;; No subexpression so collect the entire match.
1457 "\\&"
1458 ;; Get the regexp for collection pattern.
1459 (isearch-done nil t)
1460 (isearch-clean-overlays)
1461 (let ((default (car occur-collect-regexp-history)))
1462 (read-string
1463 (format "Regexp to collect (default %s): " default)
1464 nil 'occur-collect-regexp-history default)))
1465 ;; Otherwise normal occur takes numerical prefix argument.
1466 (when current-prefix-arg
1467 (prefix-numeric-value current-prefix-arg))))))
1446 (let ((case-fold-search isearch-case-fold-search) 1468 (let ((case-fold-search isearch-case-fold-search)
1447 ;; Set `search-upper-case' to nil to not call 1469 ;; Set `search-upper-case' to nil to not call
1448 ;; `isearch-no-upper-case-p' in `occur-1'. 1470 ;; `isearch-no-upper-case-p' in `occur-1'.