From 3b0f23792d50b767878f73f9c9079bcf8facea0e Mon Sep 17 00:00:00 2001 From: Henrik Lissner Date: Sun, 16 May 2021 14:44:53 -0400 Subject: [PATCH] Distinguish C-m from RET But you must bind keys to "" or [C-m] to target it. --- core/core-keybinds.el | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/core/core-keybinds.el b/core/core-keybinds.el index aa601de1f..9e9df23a1 100644 --- a/core/core-keybinds.el +++ b/core/core-keybinds.el @@ -56,6 +56,15 @@ and Emacs states, and for non-evil users.") (not (or (numberp key) (null key)))))) [C-i] [?\C-i]))) +;; HACK Fixes Emacs' disturbing inability to distinguish C-m from RET. We don't +;; need the same hacks as C-i because *nobody* binds keys to C-m otherwise. +(define-key key-translation-map [?\C-m] + (cmd! (if (let ((keys (this-single-command-raw-keys))) + (and keys + (not (cl-position 'return keys)) + (display-graphic-p))) + [C-m] [?\C-m]))) + ;; ;;; Universal, non-nuclear escape