Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to set C-c C-k to check kind? #210

Closed
HaskellZhangSong opened this issue Nov 1, 2013 · 3 comments
Closed

How to set C-c C-k to check kind? #210

HaskellZhangSong opened this issue Nov 1, 2013 · 3 comments

Comments

@HaskellZhangSong
Copy link

I found there is a pieces of code to check the kind of a term in inf-haskell.el
(defun inferior-haskell-kind (type)
"Query the haskell process for the kind of the given expression."
(interactive

I bind the key as following
(define-key map (kbd "C-c C-k") 'inferior-haskell-kind)
and restart emacs but still cannot use it.
I am a new user of haskell-mode. Could any explain to me a little bit.

@sergv
Copy link
Contributor

sergv commented Nov 2, 2013

Assuming that map refers to haskell-mode-related keymap like haskell-mode-map, one reason why inferior-haskell-kind could not be used is that C-c C-k binding is shadowed by the same keybinding in some minor mode. To test this just temporarily rebind inferior-haskell-kind to some bizzare combination that is unlikely to be bound and try it out, or type in, while you're in haskell-mode buffer and there's some type name at point, M-x eval-expression (inferior-haskell-kind (haskell-ident-at-point)).

If it turns out to be true, i.e. inferior-haskell-kind function is working for you, you can start hunting for offending mode that binds C-c C-k as follows: in buffer with active haskell mode issue M-x eval-expression (minor-mode-key-binding (kbd "C-c C-k")) which should return list of minor modes that bind C-c C-k. If returned list is empty you still can try, in the same buffer with active haskell mode, C-h m to get list of all active modes in the buffer and search for C-c C-k there. When mode name with C-c C-k keybinding is found you can disable it like this (add-hook <MODE>-hook (lambda () (define-key <MODE>-map (kbd "C-c C-k") nil))), of course using actual mode name instead of <MODE>.

@ardumont
Copy link
Contributor

To sum up, in this case, I believe it's:

(add-hook 'inferior-haskell-mode-hook
          (lambda ()
            (define-key inferior-haskell-mode-map (kbd "C-c C-k") nil)
            (define-key inferior-haskell-mode-map (kbd "C-c C-k") 'inferior-haskell-kind)))

@gracjan
Copy link
Contributor

gracjan commented Mar 27, 2015

@HaskellZhangSong: did you manage to solve this problem? If not do not hessitate to write a note here and we will reopen this issue again.

@gracjan gracjan closed this as completed Mar 27, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants