15 votes
Accepted

How to perform case-sensitive query-replace?

(customize-set-variable case-fold-search nil) Or bind that variable (option) in your own command that is otherwise just a wrapper around query-replace. This has the advantage that it doesn't change ...
  • 70.9k
9 votes
Accepted

How to do case sensitive searches using evil's evil-search?

What to do You can customize the variable evil-ex-search-case to tell it what you want evil to do when searching. Here's the docstring: evil-ex-search-case is a variable defined in evil-vars.el. ...
  • 31.3k
7 votes
Accepted

Search and replace with case preservation and plurals

Retaining the cases on replacing By default, emacs retains the cases when replacing. From the emacs manual, When the newstring argument is all or partly lower case, replacement commands try to ...
7 votes
Accepted

how do I do case sensitive searches using evil/spacemacs?

Short and narrow answer You need to set the variable case-fold-search to nil in order to have case sensitive search. So: put this somewhere in your init file: (setq case-fold-search nil) See the ...
  • 31.3k
6 votes
Accepted

How to turn every ALL CAP word in a buffer into Title case?

How about using keyboard macros: <f3> -- start recording C-M-s \b[A-Z]\{2,\}\b RET -- find the next word of only upper-case letters and at least 2 letters. M--M-c -- Call capitalize-word on the ...
  • 44.2k
6 votes
Accepted

in Emacs regex, how to search for uppercase letters only?

You can temporarily bind case-fold-search using let: (let ((case-fold-search nil)) (looking-at "[\n\t ]*[A-Z]")) Also, I changed your regexp for matching whitespace and newlines -- a ] was missing ...
  • 5,865
3 votes
Accepted

I-search - case sensitive

You can toggle case sensitivity during incremental search by typing M-c. Documentation here.
  • 5,065
3 votes
Accepted

How to ignore case when switching buffers?

Customize option read-buffer-completion-ignore-case to non-nil. C-h v read-buffer-completion-ignore-case tells you: read-buffer-completion-ignore-case is a variable defined in C source code. ...
  • 70.9k
3 votes
Accepted

How can I query replace region from top case-sensitively?

You need to let-bind case-fold-search to nil: (defun query-replace-region-or-from-top () (interactive) (let ((case-fold-search nil)) (progn ... (goto-char orig-point))))) See ...
  • 21.1k
2 votes

in Emacs regex, how to search for uppercase letters only?

Be aware that there are some mistakes in that code. I don't know if \* means anything at all in this context (\\* does). You also need to escape + with two backslashes as that has a meaning in emacs ...
  • 788
2 votes
Accepted

case-fold-search apparently not taking effect in re-search-forward

What is wrong with my use of case-fold-search? You've set it to t instead of nil. case-fold-search is a variable defined in C source code. [...] Non-nil if searches and matches should ignore ...
  • 44.2k
2 votes
Accepted

How to query-replace with exact match with the exact given word in case-sensetive manner?

Do M-x toggle-case-fold-search (message is Case-Insensitive Search disabled globally) before Q. toggle-case-fold-search isn't a standard variable but rather a function. Perhaps you wanted to set ...
  • 81
2 votes

How do I search/replace with case sensitive search?

Use isearch (C-s), turn on case sensitivity (M-c) then launch replace (M-%) from there. M-c runs the command isearch-toggle-case-fold M-% runs the command isearch-query-replace
  • 13.8k
1 vote
Accepted

How can I recursively find and replace text in case sensetive?

As already mentioned in the comments the variable case-fold-search is buffer-local. The following line in your init file sets this variable only for the buffer to nil where the init file is evaluated: ...
  • 30.7k
1 vote
Accepted

How do I search/replace with case sensitive search?

Bind or set case-fold-search to nil. C-h k M-% tells us: M-% runs the command query-replace (found in global-map), which is an interactive compiled Lisp function in replace.el. It is bound to M-%, &...
  • 70.9k
1 vote

Why after search-toggle-case-fold text is select?

Note, that I assume that isearch-toggle-case-fold is not supposed to be run outside of isearch-mode. Cause of the effect: The highlighting belongs to the overlay stored in variable isearch-overlay ...
  • 30.7k
1 vote

I-search - case sensitive

C-s M-c C-s for isearch and when in minibuffer type M-c
1 vote

Highlight regexp case insensitive

You can easily do what you want with library Highlight (highlight.el. Just set or bind case-fold-search to t and call any of the regexp-highlighting functions: hlt-highlight-regexp-to-end - Matches ...
  • 70.9k
1 vote

Case-sensitive search and replace in elisp in spacemacs

The following change to xx-replace-regexp-and-return solves the problem: (defun xx-replace-regexp-and-return (from to) (let ((case-fold-search nil))) (save-excursion (while (re-search-...
  • 1,712
1 vote

How to turn every ALL CAP word in a buffer into Title case?

If you want to take @phils answer and wrap it in a command that handles the region, here's one approach: (defun caps-to-title-case (start end) "Convert words in CAPS to Title Case in the current ...
  • 19.5k
1 vote
Accepted

How can i keep the case when I am using select and paste to C-s input field?

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 ...
  • 19.5k

Only top scored, non community-wiki answers of a minimum length are eligible