Question

My MacBook has two enter keys.

  1. One is return
  2. Other is enter key placed right beside command key on right hand side.

I have recently started using Emacs24. I have noticed, whenever I am in viper-mode and I issue any command, for example

M-x toggle-viper-mode

Return key does not work. Instead I get an error.

Wrong type argument: characterp, return

I have to use fn+return or Ctrl+m or the enter.

If I disable viper-mode return works without any error.

I tried using a solution from Gnu Emacs mailing list archive but it didn't work.

(define-key function-key-map [return] [?\C-m])

How can I fix it so that return key works with commands in viper-mode too?

Update

The result of C-h k for return key when viper-mode is not loaded.

<return> runs the command autopair-newline, which is an interactive Lisp function in `autopair.el'.
It is bound to RET, <return>.

The result of C-h k for enter key when viper-mode is not loaded.

RET (translated from <kp-enter>) runs the command autopair-newline, which is an interactive Lisp function in `autopair.el'.
It is bound to RET, <return>

The result of C-h k for return key when viper-mode is loaded.

<return> runs the command autopair-newline, which is an interactive Lisp function in `autopair.el'.
It is bound to RET, <return>.

The result of C-h k for enter key when viper-mode is loaded.

RET (translated from <kp-enter>) runs the command autopair-newline, which is an interactive Lisp function in `autopair.el'.
It is bound to RET, <return>.

The problem is return key does not work in minibuffer when viper-mode is loaded, although the mappings are similar as you can see above.

Was it helpful?

Solution

So it appears that autopair-newline is not working correctly in viper-mode. The source for that function indicates is has some special handling of the "RET" keyboard binding.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top