[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] /srv/bzr/emacs/trunk r107380: * lisp/isearch.el (isearch-o
From: |
Juri Linkov |
Subject: |
[Emacs-diffs] /srv/bzr/emacs/trunk r107380: * lisp/isearch.el (isearch-occur): Sync interactive spec with occur's |
Date: |
Thu, 23 Feb 2012 02:36:49 +0200 |
User-agent: |
Bazaar (2.3.1) |
------------------------------------------------------------
revno: 107380
fixes bug(s): http://debbugs.gnu.org/10705
committer: Juri Linkov <address@hidden>
branch nick: trunk
timestamp: Thu 2012-02-23 02:36:49 +0200
message:
* 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'.
modified:
etc/NEWS
lisp/ChangeLog
lisp/isearch.el
=== modified file 'etc/NEWS'
--- a/etc/NEWS 2012-02-19 04:44:03 +0000
+++ b/etc/NEWS 2012-02-23 00:36:49 +0000
@@ -965,6 +965,12 @@
** Occur Edit mode applies edits made in *Occur* buffers to the
original buffers. It is bound to "e" in Occur mode.
+** When `occur' is called with the prefix argument `C-u'
+the matching strings are collected into the `*Occur*' buffer
+without line numbers. If there are parenthesized subexpressions
+in the specified regexp, `occur' reads replacement text that
+may contain \\& and \\N whose convention follows `replace-match'.
+
+++
** New global minor mode electric-pair-mode.
When enabled, typing an open parenthesis automatically inserts the
=== modified file 'lisp/ChangeLog'
--- a/lisp/ChangeLog 2012-02-22 23:35:07 +0000
+++ b/lisp/ChangeLog 2012-02-23 00:36:49 +0000
@@ -1,3 +1,8 @@
+2012-02-23 Juri Linkov <address@hidden>
+
+ * isearch.el (isearch-occur): Sync interactive spec with occur's
+ new feature in `occur-read-primary-args'. Doc fix. (Bug#10705)
+
2012-02-22 Juri Linkov <address@hidden>
* international/mule-cmds.el (read-char-by-name): Use \` and \'.
=== modified file 'lisp/isearch.el'
--- a/lisp/isearch.el 2012-02-04 02:10:22 +0000
+++ b/lisp/isearch.el 2012-02-23 00:36:49 +0000
@@ -1433,16 +1433,38 @@
(isearch-query-replace delimited t))
(defun isearch-occur (regexp &optional nlines)
- "Run `occur' with regexp to search from the current search string.
-Interactively, REGEXP is the current search regexp or a quoted search
-string. NLINES has the same meaning as in `occur'."
+ "Run `occur' using the last search string as the regexp.
+Interactively, REGEXP is constructed using the search string from the
+last search command. NLINES has the same meaning as in `occur'.
+
+If the last search command was a word search, REGEXP is computed from
+the search words, ignoring punctuation. If the last search
+command was a regular expression search, REGEXP is the regular
+expression used in that search. If the last search command searched
+for a literal string, REGEXP is constructed by quoting all the special
+characters in that string."
(interactive
- (list
- (cond
- (isearch-word (word-search-regexp isearch-string))
- (isearch-regexp isearch-string)
- (t (regexp-quote isearch-string)))
- (if current-prefix-arg (prefix-numeric-value current-prefix-arg))))
+ (let* ((perform-collect (consp current-prefix-arg))
+ (regexp (cond
+ (isearch-word (word-search-regexp isearch-string))
+ (isearch-regexp isearch-string)
+ (t (regexp-quote isearch-string)))))
+ (list regexp
+ (if perform-collect
+ ;; Perform collect operation
+ (if (zerop (regexp-opt-depth regexp))
+ ;; No subexpression so collect the entire match.
+ "\\&"
+ ;; Get the regexp for collection pattern.
+ (isearch-done nil t)
+ (isearch-clean-overlays)
+ (let ((default (car occur-collect-regexp-history)))
+ (read-string
+ (format "Regexp to collect (default %s): " default)
+ nil 'occur-collect-regexp-history default)))
+ ;; Otherwise normal occur takes numerical prefix argument.
+ (when current-prefix-arg
+ (prefix-numeric-value current-prefix-arg))))))
(let ((case-fold-search isearch-case-fold-search)
;; Set `search-upper-case' to nil to not call
;; `isearch-no-upper-case-p' in `occur-1'.
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Emacs-diffs] /srv/bzr/emacs/trunk r107380: * lisp/isearch.el (isearch-occur): Sync interactive spec with occur's,
Juri Linkov <=