2

I see a word in buffer1. I want to look for it in buffer2. I select the word in buffer1. I select buffer2 as my current buffer, hit C-s, and press mouse-2 (the middle mouse button).

Emacs converts the word to lowercase, and I can't find it... The word has both lower and upper cases in it. How can I prevent Emacs from downcasing the search pattern?

I am using Emacs version 23.1.1 on RHEL 6.

Drew
  • 75,699
  • 9
  • 109
  • 225
user1134991
  • 289
  • 1
  • 9

1 Answers1

1

The relevant configuration option is search-upper-case.

As with many things, you can find this information in Emacs itself. For example, use C-h r to open the Emacs manual, and use i to search the index for isearch. This leads to the Incremental Search topic, which includes a section on Isearch Yank with this:

Normally, when the search is case-insensitive, text yanked into the search string is converted to lower case, so that the search remains case-insensitive. However, if the value of the variable ‘search-upper-case’ is other than ‘not-yanks’, that disables this down-casing.

The next logical step would be to check the documentation for the variable mentioned (C-h v search-upper-case):

If non-nil, upper case chars disable case fold searching. That is, upper and lower case chars must match exactly. This applies no matter where the chars come from, but does not apply to chars in regexps that are prefixed with \. If this value is not-yanks, text yanked into the search string in Isearch mode is always downcased.

You can customize it using M-x customize-option search-upper-case. You can also just set it in your init file:

(setq search-upper-case t)
Drew
  • 75,699
  • 9
  • 109
  • 225
glucas
  • 20,175
  • 1
  • 51
  • 83
  • Thanks. I did look for online help, but not in the emacs itself. Well, I will do my best not to repeat that mistake. – user1134991 Mar 14 '17 at 11:49