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: Thu, 22 Nov 2007 21:04:48 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.50 (gnu/linux)

>> +   (let ((case-fold-search isearch-case-fold-search))
>
> isearch-case-fold-search is almost but not quite the same as
> case-fold-search. Cf isearch-no-upper-case-p.
>
>     ; case-fold-search while searching.
>     ;   either nil, t, or 'yes.  'yes means the same as t except that mixed
>     ;   case in the search string is ignored.
>     (defvar isearch-case-fold-search nil)

Right, below is a more correct patch:

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     22 Nov 2007 19:02:59 -0000
***************
*** 1256,1265 ****
--- 1257,1276 ----
    (interactive)
    (isearch-query-replace 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'."
+   (interactive
+    (list
+     (if isearch-regexp isearch-string (regexp-quote isearch-string))
+     (if current-prefix-arg (prefix-numeric-value current-prefix-arg))))
+   (let ((case-fold-search isearch-case-fold-search))
+     (if (and (eq case-fold-search t) search-upper-case)
+       (setq case-fold-search
+             (isearch-no-upper-case-p isearch-string isearch-regexp)))
+     (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]