ghc-mod
ghc-mod copied to clipboard
emacs can't move to next or previous errors
I use the latest ghc-mod (I downloaded and compiled the master branch). Before I describe the problem here is some information about my environment:
Platform: Windows 8.1 x64
cabal: version 1.22.6.0 using version 1.22.4.0 of Cabal library
ghc: version 7.10.2
I cannot move to next and previous error in emacs. It says No further notes from Haskell compiler. (When I move manually my cursor on those errors I can use M-? to inspect them).
Are you talking about M-p and M-n? If so, I guess you (accidentally) override the key-bindings to M-p and M-n since No further notes from Haskell compiler is not generated from the Emacs frontend.
Hang on didn't the haskell-mode people talk about some error overlay support? Maybe that's them overriding our keybindings?
There you go: https://github.com/haskell/haskell-mode/blob/ea977e9bfab40eaf12d8ecbba50e23f3764afef0/haskell.el#L53
Also: https://github.com/haskell/haskell-mode/issues/856
Yeah but how can I change it?
Writing this in my .emacs:
(defun haskell-mode-keys ()
"Modify keymaps used by `haskell-mode'."
(local-set-key (kbd "M-n") 'ghc-goto-next-error)
(local-set-key (kbd "M-p") 'ghc-goto-prev-error))
; add to hook
(add-hook 'haskell-mode-hook 'haskell-mode-keys)
is not enough.
Well, of course I can always assign it another hotkey.
@TheCrafter
You can change the keymap like this:
(add-hook 'haskell-mode-hook
(lambda ()
(ghc-init)
(substitute-key-definition 'haskell-goto-next-error 'ghc-goto-next-error
interactive-haskell-mode-map)
(substitute-key-definition 'haskell-goto-prev-error 'ghc-goto-prev-error
interactive-haskell-mode-map)))
@gbrsales
Okay it seems to be working. Thanks for your help!