ghc-mod icon indicating copy to clipboard operation
ghc-mod copied to clipboard

emacs can't move to next or previous errors

Open TheCrafter opened this issue 10 years ago • 7 comments

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).

TheCrafter avatar Sep 04 '15 19:09 TheCrafter

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.

kazu-yamamoto avatar Sep 09 '15 02:09 kazu-yamamoto

Hang on didn't the haskell-mode people talk about some error overlay support? Maybe that's them overriding our keybindings?

DanielG avatar Sep 09 '15 02:09 DanielG

There you go: https://github.com/haskell/haskell-mode/blob/ea977e9bfab40eaf12d8ecbba50e23f3764afef0/haskell.el#L53

DanielG avatar Sep 09 '15 02:09 DanielG

Also: https://github.com/haskell/haskell-mode/issues/856

DanielG avatar Sep 09 '15 02:09 DanielG

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 avatar Sep 09 '15 08:09 TheCrafter

@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 avatar Mar 16 '16 15:03 gbrsales

@gbrsales

Okay it seems to be working. Thanks for your help!

TheCrafter avatar Mar 17 '16 22:03 TheCrafter