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

spacemacs related - not working on evil-hybrid/normal-state change #12

Closed
et2010 opened this issue Feb 1, 2016 · 21 comments
Closed

spacemacs related - not working on evil-hybrid/normal-state change #12

et2010 opened this issue Feb 1, 2016 · 21 comments

Comments

@et2010
Copy link

et2010 commented Feb 1, 2016

Thank you for this amazing repo! fcitx.el is really a life-saver, with it I can use my favorite input method with evil instead of those far more inferior emacs counterparts. But the tradeoff is: it doesn't work on spacemacs hybrid state. Currently, My work around is to fork this repo and search-replace every insert-state with hybrid-state. It's ugly but that's all I can do right now since I'm not skilled in emacs lisp. So I'm wondering if this feature will be added in the future considering the fast growing spacemacs users? Thanks!

@cute-jumper
Copy link
Owner

So I'm adding a new variable fcitx-active-evil-states. This variable contains all the evil states in which we should activate fcitx. The default value is '(insert emacs).

If you want evil-hybrid-state to be one of them, use the following code in your init file:

(setq fcitx-active-evil-states '(insert emacs hybrid))

I would update the documentation later. Please report issues here if you find any problems! Thank you!

@et2010
Copy link
Author

et2010 commented Feb 1, 2016

I'll try it when melpa updates the package, and I'll post the result here. Thanks for your fast reply!

@et2010
Copy link
Author

et2010 commented Feb 2, 2016

It works! But I found a weird thing: when I hit C-s in hybrid state to enter search pattern in the mini buffer, the fcitx im is not disabled even with aggressive setup. It's not a big issue since I can always hit Enter to enter the word/char, but it feels a bit clumsy.

The same thing happens when I hit C-h k to interactively call describe-key (I've already added C-h to fcitx prefix key). Even worse, when I quit the popup buffer of describe-key, the fcitx im is gone and I have to re-enable it.

I think this is not related to the hybrid state, since same thing happens when insert state is used. Maybe I should open a new issue.

@et2010
Copy link
Author

et2010 commented Feb 2, 2016

I figured that maybe the C-s behavior is intended? Wow, that's cool since I never thought that we could search chinese char like this. I used to use pinyin-search package. I feel really dumb now. 😭

@cute-jumper
Copy link
Owner

These two features don't exist in the current version.

I have thought about adding isearch support but it seems to me that if you've enabled fcitx in the current buffer, most of the buffer content should be Chinese characters and it is normal that you want to search the Chinese characters. So I leave it unimplemented. It is OK to add the support:-)

C-h k is a little bit different. It looks like these functions, read-char, read-key, read-key-sequence and etc., do not set up the minibuffer the same way as read-string. Adding advice to these functions should solve the problem.

I'll update the code a little bit later.

@et2010
Copy link
Author

et2010 commented Feb 2, 2016

Yes, current implementation of C-s rocks! Goodbye, pinyin-search!

@cute-jumper
Copy link
Owner

I'm going to add these features in case someone finds them useful, but the isearch feature would not be enabled in the pre-defined setup functions. Note that I haven't done anything to C-s. It is the default behavior you can get even without this package.

@et2010
Copy link
Author

et2010 commented Feb 2, 2016

Thanks for your clarification, @cute-jumper. That should solve my problems.

@cute-jumper
Copy link
Owner

These two features are now added. I-search support is not enabled in either fcitx-default-setup or fcitx-aggressive-setup, but the support for read-* functions will be turned on in these two setup functions. C-h k should now work fine, and ace-pinyin now works seamlessly together with fcitx.el if you use avy as the jumping method. You don't have to disable fcitx before you use ace-pinyin.

@et2010
Copy link
Author

et2010 commented Feb 3, 2016

Something went wrong. isearch support works fine, but C-h k still not working. I'm using the aggressive setup. Here is my system spec:

  • Archlinux 64 bit (virtualbox vm)
  • emacs 24.5.1
  • spacemacs 0.105.9

fcitx:

  • community/fcitx 4.2.9.1-1 (fcitx-im)
  • community/fcitx-configtool 0.4.8-1
  • community/fcitx-gtk2 4.2.9.1-1 (fcitx-im)
  • community/fcitx-gtk3 4.2.9.1-1 (fcitx-im)
  • community/fcitx-qt4 4.2.9.1-1 (fcitx-im)
  • community/fcitx-qt5 1.0.5-1 (fcitx-im)
  • community/fcitx-rime 0.3.1-2
  • local/fcitx-sogoupinyin 2.0.0.0068-1

@cute-jumper
Copy link
Owner

I see. There is a race condition between the newly added read-* functions and the prefix key polling function. I haven't figured out a good way to solve it. I'll leave this issue open.

@cute-jumper
Copy link
Owner

Just to let you know, the read-* functions support has been removed from the setup function. You have to manually enable it if you need. There are some issues with it on OS X(See #14 ). But if you're using Linux, you can enable this and remember to set fcitx-use-dbus to be t.

@et2010
Copy link
Author

et2010 commented Feb 23, 2016

Thanks for the heads-up.

@colin4124
Copy link

Hi, @cute-jumper

I am spacemacs user, I add the (fcitx-aggressive-setup) to user-config section, but it not work. I must M-x fcitx-aggressive-setup so the (setq fcitx-active-evil-states '(insert emacs hybrid)) works.

@cute-jumper
Copy link
Owner

Can you give steps to reproduce the problem? There is no difference between (fcitx-aggressive-setup) in Elisp and M-x fcitx-aggressive-setup.

@colin4124
Copy link

Indeed (fcitx-aggressive-setup) in dotspacemacs/user-config () is the same as M-x fcitx-aggressive-setup. But the face that does not work for me.

I use spacemacs, and use chinese layer and set that:

(chinese :variables
chinese-enable-fcitx t
chinese-enable-youdao-dict t)

Is there relative to chinese layer? If you do that and it still works, can I send my .spacemacs to your email and you test whether reproduce the problem?

@cute-jumper
Copy link
Owner

@colin4124 Sorry. It seems that's my fault. You need to put (setq fcitx-active-evil-states '(insert emacs hybrid)) before fcitx-aggressive-setup. That should fix the problem.

@colin4124
Copy link

@cute-jumper it works, thx very much! ^_^

If I set as below:

(setq fcitx-active-evil-states '(insert emacs hybrid))
(fcitx-prefix-keys-add "M-m") ; M-m is common in Spacemacs
(setq fcitx-use-dbus t) ; uncomment if you're using Linux

(fcitx-aggressive-setup) should after '(setq fcitx-active-evil-states '(insert emacs hybrid))' or '(setq fcitx-use-dbus t)' ?

@cute-jumper
Copy link
Owner

As long as (fcitx-aggressive-setup) is after (setq fcitx-active-evil-states '(insert emacs hybrid)), you'll be fine.

@colin4124
Copy link

ok, thx

@cute-jumper
Copy link
Owner

Hi, @et2010

I'm closing this issue and making a new separate issue for C-h k. The original problem that fcitx.el is not working on evil-hybrid/normal-state change has already been solved and I think it is better to keep the discussion of the unsolved C-h k problem in a separate issue and people would not be annoyed by unrelated messages.

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

3 participants