aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJuri Linkov2012-02-23 02:36:49 +0200
committerJuri Linkov2012-02-23 02:36:49 +0200
commit0bd1e07406f0140d699a0d12a655753cf77cdf8a (patch)
tree808edfb94fdd77e6907cb3913cad9ba8a68832b4
parent19e9789e196ba5eea44ecac3ccf25658a6ffc04b (diff)
downloademacs-0bd1e07406f0140d699a0d12a655753cf77cdf8a.tar.gz
emacs-0bd1e07406f0140d699a0d12a655753cf77cdf8a.zip
* lisp/isearch.el (isearch-occur): Sync interactive spec with occur's
new feature in `occur-read-primary-args'. Doc fix. * etc/NEWS: Add new "collect" feature of `occur'. Fixes: debbugs:10705
-rw-r--r--etc/NEWS6
-rw-r--r--lisp/ChangeLog5
-rw-r--r--lisp/isearch.el40
3 files changed, 42 insertions, 9 deletions
diff --git a/etc/NEWS b/etc/NEWS
index 583c86b901d..65b6e532fc8 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -965,6 +965,12 @@ Its functions and variables have been similarly renamed.
965** Occur Edit mode applies edits made in *Occur* buffers to the 965** Occur Edit mode applies edits made in *Occur* buffers to the
966original buffers. It is bound to "e" in Occur mode. 966original buffers. It is bound to "e" in Occur mode.
967 967
968** When `occur' is called with the prefix argument `C-u'
969the matching strings are collected into the `*Occur*' buffer
970without line numbers. If there are parenthesized subexpressions
971in the specified regexp, `occur' reads replacement text that
972may contain \\& and \\N whose convention follows `replace-match'.
973
968+++ 974+++
969** New global minor mode electric-pair-mode. 975** New global minor mode electric-pair-mode.
970When enabled, typing an open parenthesis automatically inserts the 976When enabled, typing an open parenthesis automatically inserts the
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index eaf04e72ecd..d69231fd806 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,8 @@
12012-02-23 Juri Linkov <juri@jurta.org>
2
3 * isearch.el (isearch-occur): Sync interactive spec with occur's
4 new feature in `occur-read-primary-args'. Doc fix. (Bug#10705)
5
12012-02-22 Juri Linkov <juri@jurta.org> 62012-02-22 Juri Linkov <juri@jurta.org>
2 7
3 * international/mule-cmds.el (read-char-by-name): Use \` and \'. 8 * international/mule-cmds.el (read-char-by-name): Use \` and \'.
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'.