How to make ENTER do go to the selected type or method when using Ensime global search with Emacs --no-window?

StackOverflow https://stackoverflow.com/questions/21776466

  •  11-10-2022
  •  | 
  •  

Question

I'm using Ensime 2.10.0-0.9.8.9 with emacs 23.4.1, and I'm using emacs with --no-window parameter in the gnome terminal (v3.6.1). When I try to search for a scala type or method in my project with global search command C-c C-v v and then press ENTER to go to the selected item, it does not, but just enters a new line in the ensime-search buffer.

The thing is, when I try to do the same thing in normal emacs (without --no-window), all is fine...

Does someone know how to make it work with --no-window too ?

PS: please, don't answer: "just use emacs without --no-window"... :)

Was it helpful?

Solution 2

I finally found out how to solve this problem. I added the following binding in *ensime_2.10.0-0.9.8.9/elisp/ensime-search.el* :

(define-key map (kbd "RET") 'ensime-search-choose-current-result)

in the definition of function ensime-search-mode-map.

PS: as mentionned by Iqbal Ansari, it is better to add the binding in the init file :

(define-key ensime-search-mode-map (kbd "RET") 'ensime-search-choose-current-result)

OTHER TIPS

Ok, for partially fixing this I guess you can rebind the RET key just in scala-mode (or ensime). For that use:

(add-hook 'scala-mode-hook
      (lambda () (local-set-key (kbd "RET") 'newline)))

Anyway, I say partially because I am not sure of what scala-newline does, so maybe there is some functionality that you may lose. You can try and see if that's ok for you.

Hope it helps :)

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