Suvayu Ali | 3 Jun 2010 12:09
Picon
Gravatar

Re: Yanking in isearch mode

On Thursday 03 June 2010 01:41 AM, Kevin Rodgers wrote:
> Drew Adams wrote:
>  >> The yank with M-y is all lower case and then the i-search
>  >> becomes case insensitive. Is their any way it can preserve the case?
>  >
>  > Sounds like a bug. But see below.
>  >
>  > What should happen is that search always respects `case-fold-search'.
>  > And that include `M-y' yanking.
>  >
>  > Suppose you copy some text "ABC" to the kill ring. If
> `case-fold-search' is
>  > non-nil when you use `M-y' then it yanks "abc" and search is
> case-insensitive.
>  > But if `case-fold-search' is nil when you use `M-y' then it yanks
> "ABC" and
>  > search is case-sensitive.
>  >
>  > You can toggle case-sensitivity during isearch with `M-c'. However,
> that doesn't
>  > change the search string. So if search is case-insensitive and the
> search
>  > string is "abc" then it stays "abc" after `M-c' and it searches for only
>  > lower-case "abc".

Hi Drew,

For some reason I didn't receive your response. Kevin's response clued 
me in that you had replied and finally read your post in the archives.

I haven't changed this variable but I checked, by default it is set to 
true. I went ahead and changed it to nil and now my isearches are case 
insensitive.

It seems to me having nil as the default would make more sense. e.g.

Lets say we have some text `Variable', on copying it to the kill ring 
and doing `C-s M-y' will yank a lower cased `variable' and does a case 
insensitive search. To go back to case sensitive, as per your 
suggestion, we can use `M-c' but the text is already down-cased! So then 
we have to edit the text again.

Whereas with nil as the default, doing `C-s M-y' will preserve case of 
the yanked string. Now we can switch between case sensitive/insensitive 
with a simple `M-c'. Much more sane, Don't you agree?

>
> And isearch-case-fold-search has this comment:
>
> ; 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)
>

Kevin:

This one shows up as this in my Emacs install.

> isearch-case-fold-search is a variable defined in `isearch.el'.
> Its value is nil
>
> Documentation:
> Not documented as a variable.

Thank you both for the responses. :)

--

-- 
Suvayu

Open source is the future. It sets us free.


Gmane