title: Emacs Case Sensitive Replace String
body: <p>I just asked a related question (<a href="https://stackoverflow.com/q/5345051/627517">setq question</a>) but it's distinctly different, so I decided to branch off with this question.</p>
  
  <p>In my <code>.emacs</code> file, I define a key binding to the <code>replace-string</code> command:</p>
  
  <pre><code>(define-key global-map "\C-r" 'replace-string)
  </code></pre>
  
  <p><code>replace-string</code> does basic search and replace. Assuming the first letter of the search string is lowercase, if the <code>case-fold-search</code> is <code>nil</code> then <code>replace-string</code> does case-sensitive search, otherwise it does case-insensitive search.</p>
  
  <p>The problem is that <code>case-fold-search</code> controls the "case-sensitiveness" of both "search" (like the <code>search-forward</code> command) and "search and replace" (like the <code>replace-string</code> command).</p>
  
  <p>The question is how do I make <strong>JUST</strong> the <code>replace-string</code> command (or anything <code>C-r</code> is bound to) case-sensitive, leaving the <code>search-forward</code> case-insensitive as it is by default.</p>
  
  <p>Perhaps I would need to set <code>case-fold-search</code> to <code>nil</code> just for the <code>replace-string</code> command, but I'm not sure how to do that.</p>