Thanks very much for you kind advice, Frank.<br><br>Seems that ecb has good integration with native emacs keybindings, just like buffer-menu, ediff,dired. Well, I still feel that using ecb with evil is terrible, and I don't use ecb now; it's a pity, but I have no choice:-(<br>
<br>Many thanks,<br><br>Hongxu Chen<br><br><div class="gmail_quote">On Sat, Mar 16, 2013 at 4:24 AM, Frank Fischer <span dir="ltr"><<a href="mailto:frank-fischer@shadow-soft.de" target="_blank">frank-fischer@shadow-soft.de</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">On 2013-03-02, Hongxu Chen <<a href="mailto:leftcopy.chx@gmail.com">leftcopy.chx@gmail.com</a>> wrote:<br>
> --===============1925688492==<br>
<div class="im">> Hi all,<br>
><br>
> � � I am new to Emacs(and evil-mode). Currently I have difficulties in<br>
</div>> using evil-mode when *ecb mode* is activated. The problem is that the *Enter<br>
> *key is no longer available in any windows of ecb, so I cannot switch from<br>
<div class="im">> the navigation window to the source code window at the right side. I also<br>
> tried `(evil-set-initial-state 'ecb-minor-mode 'emacs)`, this time I can<br>
</div>> use the default key-bindings in ecb(and so is the *Enter *key). What annoys<br>
<div class="im">> me is that when I switch to the source code, evil-mode key-bindings are<br>
> deactivated. And even I now toggle ecb-minor-mode off, the key-bindings are<br>
> still not available. So I have to `M-x evil-mode` �twice to use the right<br>
> evil-mode.<br>
<br>
</div>I do not know ecb in detail, but ecb-minor-mode seems to be active in<br>
each buffer when ecb is active. Hence, using 'ecb-minor-mode to modify<br>
Evil states is a bad idea, because it will influence every buffer.<br>
<br>
Unfortunately ecb buffer windows do not have a specific major mode.<br>
However, there are several hooks. I suggest you try the following<br>
hooks (but note that you must not enable/disable evil mode while ecb is<br>
active because these hooks are only called when the ecb buffers are<br>
created, and you must install these hooks *before* ecb is activated):<br>
<br>
� (add-hook 'ecb-history-buffer-after-create-hook 'evil-emacs-state)<br>
� (add-hook 'ecb-directories-buffer-after-create-hook 'evil-emacs-state)<br>
� (add-hook 'ecb-methods-buffer-after-create-hook 'evil-emacs-state)<br>
� (add-hook 'ecb-sources-buffer-after-create-hook 'evil-emacs-state)<br>
<br>
Alternatively if only the *Enter* key annoys you, you can disable<br>
evil's special binding of RET:<br>
<br>
� (define-key evil-motion-state-map (kbd "RET") nil)<br>
<br>
I have the feeling that this function needs a rewrite anyway. Yes, it<br>
simulates Vim's behaviour of the Enter key, but it often makes trouble<br>
if Enter is bound to something special in some modes. I think, it is<br>
not really useful in most motion state buffers, so maybe you should<br>
just bind it in normal state only:<br>
<br>
� (define-key evil-normal-state-map (kbd "RET") 'evil-ret)<br>
<br>
If you remove the RET key from motion-state, then you should be able<br>
to use motion-state in ecb windows, which gives you a few bindings<br>
like h j k l:<br>
<br>
� (add-hook 'ecb-history-buffer-after-create-hook 'evil-motion-state)<br>
� (add-hook 'ecb-directories-buffer-after-create-hook 'evil-motion-state)<br>
� (add-hook 'ecb-methods-buffer-after-create-hook 'evil-motion-state)<br>
� (add-hook 'ecb-sources-buffer-after-create-hook 'evil-motion-state)<br>
<br>
Hope this helps,<br>
Frank<br>
<br>
<br>
_______________________________________________<br>
implementations-list mailing list<br>
<a href="mailto:implementations-list@lists.ourproject.org">implementations-list@lists.ourproject.org</a><br>
<a href="https://lists.ourproject.org/cgi-bin/mailman/listinfo/implementations-list" target="_blank">https://lists.ourproject.org/cgi-bin/mailman/listinfo/implementations-list</a><br>
</blockquote></div><br>