title: Emacs keybinding changes between Emacs 23 and Emacs 24
body: <p>I recently upgraded to Emacs24, and a number of my custom keybindings broke as a result of it. </p>
  
  <p>According to <a href="http://www.gnu.org/software/emacs/manual/html_node/emacs/Named-ASCII-Chars.html">the fine manual,</a> it is possible to make Emacs stop conflating function keys with their ASCII control codes (eg, it is possible to have <code>C-m</code> and <code>RET</code> bound to different things, or <code>C-i</code> and <code>TAB</code>, and so on). This has always been a large pet peeve of mine with Emacs, that such valuable "first level" keyboard shortcuts are wasted on things for which I already have dedicated keys on my keyboard. I want to bind them to different things, in my case, to 'modernize' the keybindings by mimicking gedit. In Emacs23, this was working beautifully:</p>
  
  <pre><code>(global-set-key (kbd "C-i") 'goto-line)
  (global-set-key (kbd "C-m") 'comment-or-uncomment-region)
  (global-set-key (kbd "C-d") 'kill-whole-line)
  
  ;; Fix some stuff broken by the above
  (global-set-key [delete] 'delete-char)
  (global-set-key (kbd "TAB") 'indent-for-tab-command)
  (global-set-key (kbd "RET") 'newline)
  </code></pre>
  
  <p>Then, I upgraded to Emacs24 and it broke, kinda. It still "works" in the sense that <code>C-m</code> certainly does one thing, and <code>RET</code> does another, but the problem is that the return key no longer behaves properly in terminal mode or in the minibuffer. Instead of activating the command I've just typed, in both cases, the return key simply moves the cursor down to the next line and I'm left with no way of activating the commands I type in to either the minibuffer or the terminal.</p>
  
  <p>Ironically, Emacs24 introduced a lot of changes to the behavior of deleting, and in the process they decoupled <code>C-d</code> from <code>DEL</code> so that it's actually now safe to bind <code>C-d</code> to something without needing to bind <code>DEL</code> back to the expected behavior, so it would be great if I could achieve similar "it just works" behavior for my return key, while <code>C-m</code> is bound to something else.</p>
  
  <p>So, I can envision two possible solutions to this problem. One might look like this:</p>
  
  <pre><code>(global-set-key (kbd "C-m") 'comment-or-uncomment-region)
  (global-set-key (kbd "RET") 'do-what-i-expect-the-return-key-to-do-in-any-mode)
  </code></pre>
  
  <p>OR, something like this would be even nicer:</p>
  
  <pre><code>(setq decouple-ascii-control-codes-from-function-keys t)
  </code></pre>
  
  <p>But I'm not aware of any such variable or function that would help me out in this scenario.</p>
  
  <p>I've made several unsuccessful attempts at using mode-hooks to restore the correct bindings in terminal and minibuffer modes, but I just can't seem to get anything to work. Help!</p>
  
  <p>Thanks.</p>