2

I'm trying to adjust bindings in input-decode-map (to distinguish C-m and RET in GUI mode). None of the advice given on Stack Overflow, gnu.emacs.help, Reddit, or Super User seems to work. I ended up with this:

(defun ~/setup-C-m (&rest args)
  (define-key input-decode-map [?\C-m] [C-m]))

(~/setup-C-m)
(add-hook 'tty-setup-hook #'~/setup-C-m)
(add-hook 'window-setup-hook #'~/setup-C-m)
(add-hook 'terminal-init-xterm-hook #'~/setup-C-m)
(add-hook 'after-make-frame-functions #'~/setup-C-m)

Even with all these, starting Emacs with emacsclient --alternate-editor="" --create-frame --frame-parameters="((fullscreen . maximized))" results in input-decode-map being set to this:

Value:
(keymap
 (27 keymap
     (C-backspace)
     (C-delete))
 (C-M-backspace)
 (C-M-delete)
 (M-backspace)
 (M-delete))

Which doesn't include the C-m binding. I've printed the value of input-decode-map when my setup-C-m function is called, and it's always an empty keymap.

How can I ensure that my setup-C-m function runs every time I create a frame and properly sets input-decode-map?

3
  • That's quite some bizarre prefix you've got here. The code in your example won't work because you haven't defined such a function.
    – wasamasa
    Aug 4 '17 at 15:46
  • Yup, of course, sorry for the typo. The question stands, of course.
    – Clément
    Aug 5 '17 at 13:08
  • I use ~/ as a prefix for all my personal functions.
    – Clément
    Aug 5 '17 at 13:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.