Use abstract key codes in haskell-indentation.el #291
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
haskell-indentation rebinds the return, backspace, and delete keys by
looking up the raw key codes for those three keys. This commit instead
binds the more abstract key codes
"RET"
,"DEL"
, and"<deletechar>"
.This has a couple of benefits.
a terminal with
emacs -nw
. Raw key codes such as[?\r]
,[backspace]
, and[?\C-d]
are only available when Emacs is running inan X environment, and by default Emacs translates them into
UI-independent key codes such as
"RET"
,"DEL"
, and"<deletechar>"
,unless something binds them directly.
Evil-mode doesn't expect other modes to rebind raw key codes because
of the issue above.
In particular, evil-mode is supposed to treat backspace and return
as movement commands (left and down, respectively) when in the
<N>
state, and release those keys back to the ambient keymap (in this
case, the one provided by haskell-mode and haskell-indentation) when
in the
<I>
state.However, it is currently unable to grab the backspace and return
keys in
<N>
state because it waits for Emacs to translate theX-specific raw key codes before it binds them, in order to respect
the abstraction there. If haskell-indentation binds the raw key
codes, evil-mode can't get to them first.
I reported this issue on the evil-mode mailing list back in September
2012 [1] but didn't get around to fixing it until today. Sorry for the
delay!
[1] http://thread.gmane.org/gmane.emacs.vim-emulation/1667