summaryrefslogtreecommitdiff
path: root/devdocs/elisp/searching-and-case.html
diff options
context:
space:
mode:
authorCraig Jennings <c@cjennings.net>2024-04-07 13:41:34 -0500
committerCraig Jennings <c@cjennings.net>2024-04-07 13:41:34 -0500
commit754bbf7a25a8dda49b5d08ef0d0443bbf5af0e36 (patch)
treef1190704f78f04a2b0b4c977d20fe96a828377f1 /devdocs/elisp/searching-and-case.html
new repository
Diffstat (limited to 'devdocs/elisp/searching-and-case.html')
-rw-r--r--devdocs/elisp/searching-and-case.html12
1 files changed, 12 insertions, 0 deletions
diff --git a/devdocs/elisp/searching-and-case.html b/devdocs/elisp/searching-and-case.html
new file mode 100644
index 00000000..afbcf942
--- /dev/null
+++ b/devdocs/elisp/searching-and-case.html
@@ -0,0 +1,12 @@
+ <h3 class="section">Searching and Case</h3> <p>By default, searches in Emacs ignore the case of the text they are searching through; if you specify searching for ‘<samp>FOO</samp>’, then ‘<samp>Foo</samp>’ or ‘<samp>foo</samp>’ is also considered a match. This applies to regular expressions, too; thus, ‘<samp>[aB]</samp>’ would match ‘<samp>a</samp>’ or ‘<samp>A</samp>’ or ‘<samp>b</samp>’ or ‘<samp>B</samp>’. </p> <p>If you do not want this feature, set the variable <code>case-fold-search</code> to <code>nil</code>. Then all letters must match exactly, including case. This is a buffer-local variable; altering the variable affects only the current buffer. (See <a href="intro-to-buffer_002dlocal">Intro to Buffer-Local</a>.) Alternatively, you may change the default value. In Lisp code, you will more typically use <code>let</code> to bind <code>case-fold-search</code> to the desired value. </p> <p>Note that the user-level incremental search feature handles case distinctions differently. When the search string contains only lower case letters, the search ignores case, but when the search string contains one or more upper case letters, the search becomes case-sensitive. But this has nothing to do with the searching functions used in Lisp code. See <a href="https://www.gnu.org/software/emacs/manual/html_node/emacs/Incremental-Search.html#Incremental-Search">Incremental Search</a> in <cite>The GNU Emacs Manual</cite>. </p> <dl> <dt id="case-fold-search">User Option: <strong>case-fold-search</strong>
+</dt> <dd><p>This buffer-local variable determines whether searches should ignore case. If the variable is <code>nil</code> they do not ignore case; otherwise (and by default) they do ignore case. </p></dd>
+</dl> <dl> <dt id="case-replace">User Option: <strong>case-replace</strong>
+</dt> <dd>
+<p>This variable determines whether the higher-level replacement functions should preserve case. If the variable is <code>nil</code>, that means to use the replacement text verbatim. A non-<code>nil</code> value means to convert the case of the replacement text according to the text being replaced. </p> <p>This variable is used by passing it as an argument to the function <code>replace-match</code>. See <a href="replacing-match">Replacing Match</a>. </p>
+</dd>
+</dl><div class="_attribution">
+ <p class="_attribution-p">
+ Copyright &copy; 1990-1996, 1998-2022 Free Software Foundation, Inc. <br>Licensed under the GNU GPL license.<br>
+ <a href="https://www.gnu.org/software/emacs/manual/html_node/elisp/Searching-and-Case.html" class="_attribution-link">https://www.gnu.org/software/emacs/manual/html_node/elisp/Searching-and-Case.html</a>
+ </p>
+</div>