emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Calling occur from within isearch


From: Juri Linkov
Subject: Re: Calling occur from within isearch
Date: Wed, 21 Nov 2007 22:03:14 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.50 (gnu/linux)

> Sometimes I think it would be good to call occur from within isearch.
> Anyone else that thinks it would be good to be able to do so?

This is possible with the following patch.  I'm still not sure
whether it is better to quit isearch before calling occur or not.
Anyway, it works without quitting isearch, and displays the results
of occur in another window.

Index: lisp/isearch.el
===================================================================
RCS file: /sources/emacs/emacs/lisp/isearch.el,v
retrieving revision 1.306
diff -c -r1.306 isearch.el
*** lisp/isearch.el     10 Nov 2007 23:03:24 -0000      1.306
--- lisp/isearch.el     21 Nov 2007 20:01:07 -0000
***************
*** 1256,1265 ****
--- 1257,1276 ----
    (interactive)
    (isearch-query-replace t))
  
+ (defun isearch-occur (regexp &optional nlines)
+   "Run `occur' with string to search from the current search string.
+ REGEXP is a regexp from the last search queted when the search was not regexp.
+ NLINES has the same meaning as in `occur'."
+   (interactive
+    (list
+     (if isearch-regexp isearch-string (regexp-quote isearch-string))
+     (when current-prefix-arg
+       (prefix-numeric-value current-prefix-arg))))
+   (let ((case-fold-search isearch-case-fold-search))
+     ;; (isearch-done)
+     ;; (isearch-clean-overlays)
+     (occur regexp nlines)))
+ 
  
  (defun isearch-delete-char ()
    "Discard last input item and move point back.

-- 
Juri Linkov
http://www.jurta.org/emacs/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]